supertag-cli icon indicating copy to clipboard operation
supertag-cli copied to clipboard

Supertags with duplicate names collapse in the supertags registry

Open jcfischer opened this issue 1 month ago • 0 comments

Found while trying to reproduce #109.

Symptom

When two tagDefs share a name, only one of them reaches the supertags table. tag_applications still records each application under the real tag ID, so the registry and the applications disagree. If the tag that survives is an empty duplicate, any lookup that trusts the registry by name can pick a tag with no instances.

Synthetic reproduction

Export with three tagDefs (each with the usual metanode and [SYS_A13, SYS_T01, ...] tuple):

  • tag_source named "source"
  • tag_book named "book", extends tag_source, applied to 5 nodes
  • tag_book_dup named "book", no parent, no applications, later in the export

After TanaIndexer.indexExport:

supertags:        source -> tag_source, book -> tag_book_dup
tag_applications: tag_book = 5

tag_book is missing from supertags.

Root cause

TanaExportParser.buildGraph (src/parsers/tana-export.ts) keys the supertags map by tag name, so a later tagDef with the same name overwrites the earlier one. The indexer writes supertags and the field-name mapping from that map.

Expected

  • Every tagDef is registered, keyed by tag ID.
  • Name lookups that find several tags with the same name resolve to one tag by a single rule, the same in the CLI and MCP.

jcfischer avatar Oct 21 '26 18:10 jcfischer