Skip to content

config: guard review.fields key list against silent drift - #6092

Merged
JSONbored merged 2 commits into
mainfrom
review/config-fields-codegen
Jul 15, 2026
Merged

config: guard review.fields key list against silent drift#6092
JSONbored merged 2 commits into
mainfrom
review/config-fields-codegen

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Closes #6070.

Stacked on #6088 (the config-merge PR) since this touches the same .loopover.yml.example/loopover.full.yml region, just to keep line-shifted diffs clean — this PR's own diff doesn't otherwise depend on that one's content.

Summary

The review.fields key list is hand-copied in 7 places. I found a scope change from the issue's original proposal worth flagging explicitly: a single generated line (à la gen-cf-typegen.mjs) can't cleanly regenerate all 7 copies, because they're not the same text in different files — they're 4 genuinely different formats of the same information (a YAML block comment in the two .yml.example files, a single-line inline comment in .loopover.yml/the bundled TS fallback, and an English sentence in CONTRIBUTING.md). Auto-generating into hand-written prose risked producing something that reads worse than what a maintainer would write, for marginal benefit over a guard.

So this PR guards drift instead of eliminating the copies:

  • New test (config-templates.test.ts): for each of the 5 documentation-bearing files (.loopover.yml, .loopover.yml.example, config/examples/loopover.full.yml, src/config/loopover-repo-focus-manifest.ts, CONTRIBUTING.md), assert every entry in the real REVIEW_FIELD_KEYS constant appears somewhere in that file. A key added to the source without updating one of these copies now fails CI instead of rotting silently.
  • Proof the guard is real, not just decorative: CONTRIBUTING.md was already stale (missing improvementSignal) — fixed as part of this PR, and the new test would have caught it before merge.
  • test/unit/signals-coverage.test.ts's hardcoded KEYS array (the other genuinely-unguarded copy) now derives from REVIEW_FIELD_KEYS directly (filtered to exclude improvementSignal, which that test's scenario never triggers) instead of duplicating the list a second time — this one copy is eliminated outright, not just guarded.

Test plan

  • npx vitest run test/unit/config-templates.test.ts test/unit/signals-coverage.test.ts — 76/76 pass, including 5 new drift-guard cases (one per documentation file)
  • npx tsc --noEmit clean
  • npm run docs:drift-check, npm run manifest:drift-check — pass
  • git diff --check clean

.loopover.yml.example had TWO top-level review: keys 546 lines apart:
a "live" one holding auto_review + ~16 display/behavior toggles, and a
second, fully-commented-out one 546 lines later holding everything
else -- including footer/note/fields, the keys that actually control
what renders in the PR comment. Most of the second block's keys
(inline_comments, changed_files_summary, effort_score, impact_map,
culture_profile, selftune, memory, finding_categories, auto_review)
were themselves already documented in the first block, hand-duplicated
rather than shared.

Merged into one contiguous review: section: genuinely-unique keys
(exclude_paths, path_filters, tone, profile, security_focus,
instructions, path_instructions, linkedIssueSatisfaction,
pre_merge_checks, enrichment, ai_model, visual, footer, note, fields)
moved up; duplicate keys dropped from the second copy. Fixed the
section-3 divider (it labeled itself "settings:" while preceding
review:) and added a section-4 divider for the actual settings: block.
config/examples/loopover.full.yml resynced to match byte-for-byte
(enforced by test/unit/config-templates.test.ts).

Closes #6071
The review.fields key list (linkedIssue | relatedWork | reviewLoad |
validationEvidence | openPrQueue | contributorContext | gateResult |
improvementSignal) is hand-copied in 5 documentation places plus one
test fixture, each in a different textual format (YAML comment vs.
prose vs. inline comment) -- too varied for a single generated line to
regenerate safely, so this guards drift instead: a new test asserts
every REVIEW_FIELD_KEYS entry appears in each doc copy. CONTRIBUTING.md
was already stale (missing improvementSignal) -- fixed here, and the
new guard would have caught it.

test/unit/signals-coverage.test.ts's hardcoded KEYS array (the other
previously-unguarded copy) now derives from REVIEW_FIELD_KEYS directly
instead of duplicating it a second time.

Closes #6070
Base automatically changed from review/config-merge-review-block to main July 15, 2026 09:02
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.23%. Comparing base (1c25803) to head (332969e).
⚠️ Report is 12 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6092      +/-   ##
==========================================
- Coverage   95.23%   95.23%   -0.01%     
==========================================
  Files         595      595              
  Lines       47015    47013       -2     
  Branches    15015    15015              
==========================================
- Hits        44773    44771       -2     
  Misses       1493     1493              
  Partials      749      749              
Flag Coverage Δ
shard-1 43.95% <ø> (+<0.01%) ⬆️
shard-2 36.58% <ø> (-0.01%) ⬇️
shard-3 31.96% <ø> (-0.01%) ⬇️
shard-4 33.78% <ø> (+<0.01%) ⬆️
shard-5 31.46% <ø> (+<0.01%) ⬆️
shard-6 44.70% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

@JSONbored JSONbored self-assigned this Jul 15, 2026
@JSONbored
JSONbored merged commit 9c80f8a into main Jul 15, 2026
14 checks passed
@JSONbored
JSONbored deleted the review/config-fields-codegen branch July 15, 2026 09:15
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config: codegen the review.fields doc block instead of 7 hand-synced copies

1 participant