Skip to content

code-trace-index.json traced_files get overwritten by regeneration hooks #25

@jobordu

Description

@jobordu

Problem

Manual additions to code-trace-index.json (marking files as traced via the traced_files field) are silently overwritten when the solve pipeline regenerates the index. The C→R residual never decreases because user-acknowledged traces are lost.

Reproduction

  1. C→R scanner reports bin/aggregate-requirements.cjs as untraced (residual=2)
  2. User adds it to code-trace-index.json:
    {
      "traced_files": {
        "bin/aggregate-requirements.cjs": {
          "traced_to": "TOOL-INTERNAL",
          "reason": "nForma toolchain"
        }
      }
    }
  3. Next solve run or hook regenerates the file, resetting traced_files to {}
  4. C→R residual stays at 2

Expected Behavior

  • traced_files entries added by users should be preserved across regeneration
  • The regeneration logic should merge new data with existing user entries, not overwrite
  • Alternatively, provide a separate acknowledged-traces.json file that is user-owned and never auto-generated

Impact

Users cannot reduce C→R residual. The "trace a module to a requirement" workflow is broken because the persistence layer doesn't respect manual entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions