Supertags with duplicate names collapse in the supertags registry
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_sourcenamed "source"tag_booknamed "book", extendstag_source, applied to 5 nodestag_book_dupnamed "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.