fix(scripts): resolve Record<K,V> intersection-type keys in check-docs-drift's field walker (#8656) - #8720
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…s-drift's field walker
extractTypeLiteralFieldEntries parses a type by brace-counting from the first '{' to its match. For an
intersection like 'export type FocusManifestFeaturesConfig = { present: boolean } & Record<ConvergedFeatureKey,
boolean | null>', that stops at the object literal's own '}', so the '& Record<...>' half -- the 8 real
feature keys (rag, reputation, safety, grounding, e2eTests, screenshots, improvementSignal,
amsReputationBridge) and FocusManifestExperimentalConfig's 'gittensor' -- was never inspected. The checker
had zero power to catch a 9th/renamed key landing without a doc update.
Parse the intersection's 'Record<K, V>' half and resolve K's string-literal members to their own field
entries: inline '"a" | "b"' literals, a locally-declared string-literal union, or the
'(typeof SOME_ARRAY)[number]' const-array indirection ConvergedFeatureKey/ExperimentalPluginKey actually use.
Fully general -- any '{...} & Record<...>' in the scanned source, no type name hardcoded. A non-literal key
(Record<string,V>, etc.) resolves to nothing, inventing no field names.
The real FocusManifest field count rises 106->115 (the 8 feature keys + gittensor), and the drift check still
passes against the current .loopover.yml.example (all 9 already documented -- no false positives). Tests:
a fixture exercising every key form (inline / named union / typeof-array / non-literal) plus a live-source
assertion that the 8+1 real keys are now surfaced.
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 05:09:06 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8720 +/- ##
=======================================
Coverage 93.80% 93.80%
=======================================
Files 797 797
Lines 79493 79493
Branches 24085 24085
=======================================
Hits 74567 74567
Misses 3555 3555
Partials 1371 1371
Flags with carried forward coverage won't be shown. Click here to find out more. |
Problem
Closes #8656.
scripts/check-docs-drift.ts'sextractTypeLiteralFieldEntriesparses a type by brace-counting from the first{to its match. For an intersection type like:brace-counting closes right after
present: boolean, so the& Record<...>half — the 8 real feature keys (rag,reputation,safety,grounding,e2eTests,screenshots,improvementSignal,amsReputationBridge) andFocusManifestExperimentalConfig'sgittensor— was never inspected. The checker had zero power to catch a 9th or renamed key landing without a doc update.Fix
Parse the intersection's
Record<K, V>half and resolveK's string-literal members to their own field entries:"a" | "b"literals;(typeof SOME_ARRAY)[number]const-array indirection thatConvergedFeatureKey/ExperimentalPluginKeyactually use.Fully general — any
{ ... } & Record<...>in the scanned source, no type name hardcoded. A non-literal key (Record<string, V>, anumberalias, an unresolvable identifier) resolves to nothing, so no field names are ever invented.The real
FocusManifestfield count rises 106 → 115 (the 8 feature keys +gittensor), and the drift check still passes against the current.loopover.yml.example(all 9 already documented — no false positives).Tests
test/unit/check-docs-drift-script.test.ts:(typeof ARR)[number]const-array union, direct string-literal union, and non-literal keys (number/string/unresolvable) that must yield no fields — covering every new branch.features.rag … features.amsReputationBridgeandexperimental.gittensorare now surfaced from the realfocus-manifest.ts.git diff --checkclean.