Skip to content

fix(review): REES_ANALYZER_NAMES is missing duplicationDelta, blocking its env/config toggles #5839

Description

@JSONbored

Context

REES_ANALYZER_NAMES in src/review/enrichment-analyzer-names.ts (array starting line 6, closing ] as const at line 63) is documented as "the single source of truth for the analyzer keys that both the operator REES_ANALYZERS env list and the per-repo .loopover.yml review.enrichment toggles are validated against."

review-enrichment/analyzer-metadata.json (the generated REES analyzer-metadata registry, also surfaced via the MCP taxonomy resource in src/review/enrichment-analyzers-taxonomy.ts) lists 57 analyzers, including "duplicationDelta" (defaultEnabled: true, entry starting at line 668 of that file, sitting right next to "duplication" at line 638). REES_ANALYZER_NAMES only has 56 entries and is missing "duplicationDelta" — every other analyzer in the metadata file has a matching entry in this list; this is the one gap.

This is a real config-validation bug with two concrete, reachable breakages in src/review/enrichment-wire.ts:

  • resolveReesAnalyzers rejects "duplicationDelta" as an "invalid" analyzer name if a self-host operator opts into an explicit REES_ANALYZERS env list that includes it.
  • resolveEnrichmentAnalyzerSelection can never let a repo owner toggle duplicationDelta off per-repo via .loopover.yml review.enrichment, since that resolution loop only iterates REES_ANALYZER_NAMES.

No existing test cross-checks the two sources — test/unit/enrichment-analyzers-taxonomy.test.ts only asserts the JSON→document projection, not registry completeness against REES_ANALYZER_NAMES.

Requirements

  • Add "duplicationDelta" to REES_ANALYZER_NAMES in src/review/enrichment-analyzer-names.ts, following the exact pattern of the other 56 string-literal entries (placement next to "duplication"/"churnHotspot" mirrors the metadata file's own ordering, but exact position doesn't affect behavior — a trailing addition is also acceptable).
  • Verify resolveReesAnalyzers and resolveEnrichmentAnalyzerSelection in src/review/enrichment-wire.ts now correctly accept/toggle "duplicationDelta" with no further code changes needed (the fix should be purely additive to the array — if either function requires additional changes to actually pick up the new name, note that in the PR).
  • Add a regression test (or extend an existing one) that would have caught this specific drift: assert every analyzer name present in review-enrichment/analyzer-metadata.json has a corresponding entry in REES_ANALYZER_NAMES (a completeness check between the two sources), so a future new REES analyzer landing in the metadata file without a matching registry entry fails CI immediately rather than silently drifting.

Deliverables

  • "duplicationDelta" added to REES_ANALYZER_NAMES in src/review/enrichment-analyzer-names.ts.
  • A test asserting resolveReesAnalyzers (in src/review/enrichment-wire.ts) accepts "duplicationDelta" in an explicit REES_ANALYZERS list.
  • A test asserting resolveEnrichmentAnalyzerSelection can toggle duplicationDelta on/off via a repo's .loopover.yml review.enrichment config.
  • A drift-guard test (per the last Requirement above) comparing REES_ANALYZER_NAMES against the analyzer names present in review-enrichment/analyzer-metadata.json, placed alongside the existing test/unit/enrichment-analyzers-taxonomy.test.ts suite (or a new dedicated test file if that's a cleaner fit).

Test Coverage Requirements

Aim for 99%+ Codecov patch coverage on the touched lines in src/review/enrichment-analyzer-names.ts (src/** is in coverage.include). review-enrichment/analyzer-metadata.json and review-enrichment/** are REES's own separately-deployed package (Railway, its own build/test pipeline) — the drift-guard test only needs to read that JSON file as fixture data from within src/'s test suite, it does not need REES's own coverage gate to pass.

Expected Outcome

duplicationDelta — a REES analyzer that already exists, is metadata-documented, and defaults to enabled — is now a valid, toggleable analyzer name everywhere REES_ANALYZER_NAMES is the source of truth (operator env-list validation and per-repo .loopover.yml toggles), instead of silently being rejected/un-toggleable due to a one-entry registry gap. A new drift-guard test prevents this specific class of gap from recurring silently for any future REES analyzer.

Links & Resources

  • src/review/enrichment-analyzer-names.ts (REES_ANALYZER_NAMES, lines 6-63)
  • review-enrichment/analyzer-metadata.json (duplicationDelta entry starting line 668, defaultEnabled: true)
  • src/review/enrichment-wire.ts (resolveReesAnalyzers around line 372, resolveEnrichmentAnalyzerSelection around line 324)
  • src/review/enrichment-analyzers-taxonomy.ts (MCP taxonomy resource projection)
  • test/unit/enrichment-analyzers-taxonomy.test.ts (existing test suite to extend)
  • Related: #4812 (duplicationDelta's own matching-algorithm upgrade — confirms the analyzer is real, shipped, and actively maintained; this issue is purely about its registry-completeness gap)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions