Skip to content

No versioning policy for codeindex_meta key additions; silent stale-key accumulation #2026

Description

@Widthdom

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

  1. Add a codeindex_meta_schema_version key that increments when the set of recognized keys changes
  2. Build a static registry of "expected keys" keyed by binary version number
  3. When opening the DB, compare the stored codeindex_meta_schema_version with the binary's expected version
  4. If they differ, apply a migration that removes unrecognized keys and adds missing ones with default values
  5. Document this policy in a SCHEMA.md file alongside versioning rules
  6. Add a cdidx status --detailed subcommand that dumps all codeindex_meta contents for debugging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions