From 5589909b057ca2611dcfc6968a3ae03e31445c1f Mon Sep 17 00:00:00 2001 From: Lourince Daging Date: Tue, 14 Jul 2026 22:05:59 +0200 Subject: [PATCH] fix(review): add missing duplicationDelta to REES_ANALYZER_NAMES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REES_ANALYZER_NAMES in enrichment-analyzer-names.ts is the canonical list that validates operator `REES_ANALYZERS` env entries and per-repo `.loopover.yml` `review.enrichment` toggles. It listed 56 analyzers but the generated analyzer-metadata.json registry defines 57 — `duplicationDelta` (right next to `duplication`) was the one gap. As a result resolveReesAnalyzers rejected `duplicationDelta` as "invalid" for operators who listed it explicitly, and resolveEnrichmentAnalyzerSelection could never honor a per-repo toggle for it. Add the missing entry so the list exactly matches the metadata registry, and add a parity test asserting REES_ANALYZER_NAMES and the registry stay in sync (set equality against the registry as source of truth, so a future analyzer can't silently drift the two apart), plus a regression assertion for duplicationDelta and a no-duplicates check. --- .../src/review/enrichment-analyzer-names.ts | 1 + src/review/enrichment-analyzer-names.ts | 1 + .../enrichment-analyzers-taxonomy.test.ts | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/packages/loopover-engine/src/review/enrichment-analyzer-names.ts b/packages/loopover-engine/src/review/enrichment-analyzer-names.ts index 7eec217916..1d13489cd4 100644 --- a/packages/loopover-engine/src/review/enrichment-analyzer-names.ts +++ b/packages/loopover-engine/src/review/enrichment-analyzer-names.ts @@ -26,6 +26,7 @@ export const REES_ANALYZER_NAMES = [ "history", "docCommentDrift", "duplication", + "duplicationDelta", "churnHotspot", "blameLink", "approvalIntegrity", diff --git a/src/review/enrichment-analyzer-names.ts b/src/review/enrichment-analyzer-names.ts index 7eec217916..1d13489cd4 100644 --- a/src/review/enrichment-analyzer-names.ts +++ b/src/review/enrichment-analyzer-names.ts @@ -26,6 +26,7 @@ export const REES_ANALYZER_NAMES = [ "history", "docCommentDrift", "duplication", + "duplicationDelta", "churnHotspot", "blameLink", "approvalIntegrity", diff --git a/test/unit/enrichment-analyzers-taxonomy.test.ts b/test/unit/enrichment-analyzers-taxonomy.test.ts index 2f191415ff..4a99e437f4 100644 --- a/test/unit/enrichment-analyzers-taxonomy.test.ts +++ b/test/unit/enrichment-analyzers-taxonomy.test.ts @@ -5,6 +5,7 @@ import { buildEnrichmentAnalyzersTaxonomyDocument, ENRICHMENT_ANALYZERS_URI, } from "../../src/review/enrichment-analyzers-taxonomy"; +import { REES_ANALYZER_NAMES } from "../../src/review/enrichment-analyzer-names"; const metadataPath = join(process.cwd(), "review-enrichment/analyzer-metadata.json"); @@ -45,3 +46,26 @@ describe("enrichment analyzers taxonomy document", () => { expect(ENRICHMENT_ANALYZERS_URI).toBe("gittensory://enrichment-analyzers"); }); }); + +describe("REES_ANALYZER_NAMES stays in sync with analyzer-metadata.json", () => { + const metadataNames = ( + JSON.parse(readFileSync(metadataPath, "utf8")) as { analyzers: Array<{ name: string }> } + ).analyzers.map((a) => a.name); + + it("covers exactly the analyzers the metadata registry defines (no missing, no extra)", () => { + // The canonical name list validates every operator `REES_ANALYZERS` env entry and per-repo + // `.loopover.yml review.enrichment` toggle, so an analyzer present in the metadata registry but absent + // here is silently un-toggleable/un-selectable. Compared as sets against the registry (the source of + // truth) rather than a hardcoded count so a newly-added analyzer can't drift the two apart unnoticed. + expect(new Set(REES_ANALYZER_NAMES)).toEqual(new Set(metadataNames)); + }); + + it("includes duplicationDelta alongside duplication (regression for the one-entry gap)", () => { + expect(REES_ANALYZER_NAMES).toContain("duplication"); + expect(REES_ANALYZER_NAMES).toContain("duplicationDelta"); + }); + + it("has no duplicate entries", () => { + expect(new Set(REES_ANALYZER_NAMES).size).toBe(REES_ANALYZER_NAMES.length); + }); +});