refactor(signals): extract gate:-to-settings override mapping into its own function - #3373
Conversation
…s own function resolveEffectiveSettings inlined a ~40-line chain of field-by-field gate.* -> RepositorySettings mappings, mixed in with the settings spread, the sparse typeLabels/linkedIssue*/blacklist merges, and the post-merge normalization safety nets. Split it into applyGateConfigOverrides, a single named place a gate:-related field maps onto its settings counterpart, so resolveEffectiveSettings itself reads as: spread settings, apply sparse overrides, apply gate overrides, normalize. No behavior change -- FocusManifestGateConfig's shape and every existing consumer (predicted-gate.ts, mcp/server.ts) are untouched, and gate: still wins over an overlapping settings: value for the same field, matching documented precedence.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3373 +/- ##
=======================================
Coverage 93.89% 93.89%
=======================================
Files 283 283
Lines 30573 30573
Branches 11138 11138
=======================================
Hits 28705 28705
Misses 1211 1211
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 05:31:53 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 4 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
resolveEffectiveSettings(src/signals/focus-manifest.ts) inlined a ~40-line chain of individualif (gate.field !== null) effective.otherFieldName = gate.field;mappings, mixed together with the settings spread, the sparsetypeLabels/linkedIssueLabelPropagation/linkedIssueHardRulesmerges, and the post-merge normalization safety nets (therequireLinkedIssue-implies-blockrule, thequalityGateMode: "block"downgrade). Extracted the gate-mapping chain into its own named function,applyGateConfigOverrides(effective, gate), soresolveEffectiveSettingsitself now reads as a short, linear sequence: spread settings → apply sparse overrides → apply gate overrides → normalize.FocusManifestGateConfig's shape is completely untouched, so every existing direct consumer ofmanifest.gate.*(src/rules/predicted-gate.ts— the engine behind thepredict_gateMCP tool contributors run pre-push — andsrc/mcp/server.ts) needed zero changes.gate:still wins over an overlappingsettings:value for the same field (the extracted function still runs after the settings spread), matching the documented precedence in the self-hosting-configuration docs.FocusManifestGateConfig's field names, which are read directly (by the OLD names) inpredicted-gate.ts(~15 references) andmcp/server.ts— i.e. it would mean rewriting the gate-prediction engine itself for a purely non-functional cleanup. Not worth that risk for no behavior gain, so this PR does the safe, contained version: same names, same shape, same precedence, just a named extraction.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typecheck(clean)npx vitest run test/unit/focus-manifest.test.ts test/unit/focus-manifest-loader.test.ts test/unit/selftune-readback.test.ts test/unit/repository-settings-enforcement.test.ts(300/300 passing, unchanged)npx vitest run test/unit/predicted-gate.test.ts(44/44 passing, unchanged — confirms zero impact on the untouched gate-prediction consumer)npx vitest run test/unit/queue.test.ts(483/483 passing — full end-to-end review-pipeline regression check, since this function sits on the hot settings-resolution path)npm run test:workers/npm run build:mcp/npm run test:mcp-pack/npm run ui:openapi:check/npm run ui:build— not run individually this PR; no worker/MCP/OpenAPI/UI surface touched (this PR moves existing lines within onesrc/file;FocusManifestGateConfig's public shape and every serializer/consumer are unchanged). Ran the fullnpm run test:cigate once already this session (PR fix(settings): authorize circuit-breaker hold labels via merge/close autonomy #3363) with no relevant failures.focus-manifest.test.tssuite already exercises every line of the extracted function via its existing calls intoresolveEffectiveSettings, and continues to pass unchanged.Safety
predicted-gate.ts/mcp/server.tsconsumers verified unaffected (see Validation).UI Evidencesection below. — N/A, no visible UI change.Notes
src/signals/focus-manifest.ts(the core review engine), so I'd expect the gate to hold it for owner review regardless of CI outcome — that's the correct, expected disposition for a change to this file, not a signal anything is wrong.