Summary
The codeindex_meta table stores versioning metadata for multiple independent subsystems: fold_key_version/fingerprint (#86), CSharpSymbolNameContractVersion (#435), SqlGraphContractVersion, HotspotFamilyVersion (per-language), and MetadataTargetVersion (per-language). There is no mechanism to detect or clean up stale keys when a new binary version deprecates or renames a key. ClearHotspotFamilyReady() at line 887 manually sets specific keys to null, but no systematic policy exists. A future version bump that renames fold_key_version to fold_schema_version will leave the old key behind indefinitely, creating confusion and silent feature-detection bugs if readers check only the new key.
Where
src/CodeIndex/Database/DbWriter.cs:887-898 (ClearHotspotFamilyReady sets keys to null manually)
src/CodeIndex/Database/DbWriter.cs:869-879 (MarkHotspotFamilyReady cleanup example)
src/CodeIndex/Database/DbContext.cs:672-680 (codeindex_meta table definition)
Suggested approach
- Add a
codeindex_meta_schema_version key that increments when the set of recognized keys changes
- Build a static registry of "expected keys" keyed by binary version number
- When opening the DB, compare the stored
codeindex_meta_schema_version with the binary's expected version
- If they differ, apply a migration that removes unrecognized keys and adds missing ones with default values
- Document this policy in a SCHEMA.md file alongside versioning rules
- Add a
cdidx status --detailed subcommand that dumps all codeindex_meta contents for debugging
Summary
The
codeindex_metatable stores versioning metadata for multiple independent subsystems: fold_key_version/fingerprint (#86), CSharpSymbolNameContractVersion (#435), SqlGraphContractVersion, HotspotFamilyVersion (per-language), and MetadataTargetVersion (per-language). There is no mechanism to detect or clean up stale keys when a new binary version deprecates or renames a key.ClearHotspotFamilyReady()at line 887 manually sets specific keys to null, but no systematic policy exists. A future version bump that renamesfold_key_versiontofold_schema_versionwill leave the old key behind indefinitely, creating confusion and silent feature-detection bugs if readers check only the new key.Where
src/CodeIndex/Database/DbWriter.cs:887-898(ClearHotspotFamilyReady sets keys to null manually)src/CodeIndex/Database/DbWriter.cs:869-879(MarkHotspotFamilyReady cleanup example)src/CodeIndex/Database/DbContext.cs:672-680(codeindex_meta table definition)Suggested approach
codeindex_meta_schema_versionkey that increments when the set of recognized keys changescodeindex_meta_schema_versionwith the binary's expected versioncdidx status --detailedsubcommand that dumps all codeindex_meta contents for debugging