chore: rename entity_type to note_type#600
Conversation
The `Entity.entity_type` column stores the frontmatter `type` value
(note, spec, schema, person) but its name collides with `SearchItemType`
(entity/observation/relation). This caused real bugs where
`search_by_metadata({"entity_type": "spec"})` would fail because the
metadata filter looked in the wrong JSON column.
Changes:
- Alembic migration renames column + index on entity table, updates
search_index JSON metadata (both SQLite and Postgres)
- ORM model, Pydantic schemas, services, repositories, API routers,
MCP tools/clients, CLI commands, and schema inference engine all
updated to use `note_type`
- `SearchQuery.types` renamed to `SearchQuery.note_types` for clarity
- Type alias `EntityType` renamed to `NoteType`
- ~52 test files updated
Unchanged: `SearchItemType` enum, `entity_types` params that filter by
entity/observation/relation, frontmatter YAML `type:` key,
`entity_metadata` column.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 49s —— View job PR Review: rename entity_type to note_typeThis is a well-executed, comprehensive rename refactor. The change eliminates a genuine naming confusion between Team ChecklistCode Quality & Standards
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Detailed FindingsMigration — Well Done
Minor: Stale
|
The test_project_move_local_only test was matching plain text against Typer/Rich output that contains ANSI escape codes, causing `--cloud` to be split across escape sequences. Check exit_code == 2 instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 22s —— View job PR Review: rename entity_type to note_type
Team Checklist ResultsCode Quality & Standards
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Detailed FindingsMigration — Solid
Stale Comment Fixed
# Note: EntityType uses BeforeValidator(to_snake_case)...The Python type alias was renamed from # Note: NoteType uses BeforeValidator(to_snake_case)...The commit was prepared locally but could not be pushed due to bot permissions. The fix is a single-word change at line 6 that can be applied manually or via Fix this →
|
Summary
Entity.entity_type→note_typeto eliminate confusion withSearchItemType(entity/observation/relation)SearchQuery.types→note_typesand type aliasEntityType→NoteTypeUnchanged:
SearchItemTypeenum,entity_typesparams filtering by entity/observation/relation, frontmatter YAMLtype:key,entity_metadatacolumn.Test plan
just lint— passjust format— passjust typecheck— 0 errorsjust test-unit-sqlite— 1999 passed, 26 skippedjust test-int-sqlite— 278 passed, 4 skipped🤖 Generated with Claude Code