Skip to content

fix: allow attribute names starting with 'index' in declarations#1412

Merged
dimitri-yatsenko merged 1 commit intomasterfrom
fix/index-attribute-regex
Mar 9, 2026
Merged

fix: allow attribute names starting with 'index' in declarations#1412
dimitri-yatsenko merged 1 commit intomasterfrom
fix/index-attribute-regex

Conversation

@dimitri-yatsenko
Copy link
Member

Summary

  • Tighten the index detection regex in declare.py:373 to require parentheses, preventing attribute names like index, index_id, index_value from being misclassified as index declarations
  • Update test_regex_mismatch to verify these attributes now declare successfully (renamed to test_index_attribute_name)
  • Fix pre-existing mypy errors in hash_registry.py, filepath.py, and attach.py (type annotations + assert narrowing for conditional config imports)

Closes #1411

Test plan

  • test_index_attribute_name passes on MySQL and PostgreSQL — attributes named index and index_value declare and appear in heading
  • Existing index declaration tests still pass (actual index(col) syntax unaffected)
  • mypy passes cleanly on all modified files

🤖 Generated with Claude Code

The index detection regex in declare.py matched any line starting with
"index", misclassifying attributes like `index: int` or `index_value`
as index declarations. Tighten the regex to require parentheses,
matching only actual index declarations like `index(col1, col2)`.

Also fix pre-existing mypy errors: add type annotations to
hash_registry.py functions and assert-based narrowing for conditional
config imports in filepath.py, attach.py, and hash_registry.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dimitri-yatsenko dimitri-yatsenko merged commit 34acbbe into master Mar 9, 2026
7 checks passed
@dimitri-yatsenko dimitri-yatsenko deleted the fix/index-attribute-regex branch March 9, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Cannot create attributes with names starting with 'index' due to regex mismatch in declaration parser

2 participants