[AIR #943] codev doctor/update: warn on PR-producing protocol overrides missing a pr gate#944
Merged
Conversation
…r` gate Post-#927 guardrail. #927 made Needs Attention surface PRs via the universal `pr` gate (porch requests the gate when a protocol's PR-creating phase completes; `derivePrReady` reads the pending gate). A tier-1/2 protocol override that lacks a `pr` gate therefore silently loses PR surfacing — and `codev update` preserves user-modified files as overrides, so it neither fixes nor flags the breakage. Add `lib/pr-gate-audit.ts`: resolves each bundled PR-producing protocol (bugfix, air, spir, aspir, pir) through the 4-tier resolver and flags any whose resolved definition has no phase gated `pr`. Surfaced as a non-fatal warning in `codev doctor` (exit code unchanged) and printed after the `codev update` summary. experiment/maintain are excluded (not PR-producing). Overrides are not auto-modified — warn + instruct only, consistent with update's preserve behavior. Tests: pr-gate-audit unit suite plus doctor/update integration tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #943.
Summary
Post-#927 guardrail. #927 made Needs Attention surface PRs via the universal
prgate: porch requests theprgate when a protocol's PR-creating phase completes, andderivePrReadysurfaces the PR from that pending gate. A PR-producing protocol whose resolved definition (a tier-1/2 local override) carries noprgate is therefore never requested, and its PRs silently vanish from Needs Attention. Becausecodev updatedeliberately preserves user-modified files as local overrides, it neither fixes nor flags such an override — the breakage is silent (an adopter's gatelessbugfixoverride caused exactly this).This adds a check that resolves each bundled PR-producing protocol through the 4-tier resolver and warns loudly — with the fix — when one lacks a
prgate, surfaced in bothcodev doctorandcodev update.What changed
packages/codev/src/lib/pr-gate-audit.ts(new) —auditPrGates(root)resolves each protocol inPR_PRODUCING_PROTOCOLS(bugfix,air,spir,aspir,pir) viaresolveCodevFile(tier-1/2 override wins) and flags any whose resolved JSON has no phase gatedpr(handles both the string"gate": "pr"and object"gate": { "name": "pr" }forms, mirroring porch'snormalizePhase).formatPrGateWarning(w)builds the shared, loud message.experiment/maintainare excluded — not PR-producing.doctor.ts— new "Protocol PR Gates" section. Clean repos show✓ All PR-producing protocols are pr-gated; offenders get a⚠line and appear in the summary. Non-fatal — exit code unchanged (warnings never set exit 1).update.ts— prints the same warnings after the update summary and exposes them onUpdateResult.prGateWarnings. Does not auto-modify the override (consistent with update's preserve-customizations behavior) — warn + instruct only.Example output
Against a
bugfixoverride whose PR phase lost its gate:Key decisions
derivePrReady's documented set. A new PR-producing protocol adds itself to the constant.prgate at all" is the correct check. Surfacing requires porch to request theprgate, which it only does for a phase withgate === 'pr'. If no phase carries it, surfacing is broken — that's exactly what's flagged. (Stock skeletons always carry it, so in practice this only fires for overrides.)gateName()accepts both gate shapes so the audit stays in sync with how porch actually reads gates.Test plan
pr-gate-audit.test.ts(unit): flags a gateless override; passes a correctly-gated one; recognizes the object gate form; skips unparseable/absent protocols without crashing; flags multiple offenders independently; asserts the bundled set excludes experiment/maintain; verifies the message wording.doctor.test.ts/update.test.ts(integration): a gateless override surfaces in doctor output and inresult.prGateWarnings; clean overrides produce the✓/ empty result.codev doctorin this repo prints✓ All PR-producing protocols are pr-gated; against a gateless fixture it prints the warning;codev update --dry-runprints it after the summary.tsc --noEmitclean. Porchbuild+testschecks pass.Out of scope (per issue)
Auto-fixing/migrating overrides; any change to #927's surfacing logic; experiment/maintain completion-gate surfacing.