Repository navigation
fix(drift): skip the live re-collect in drift-sync-check for deprecation-only syncs - #605
Merged
Merged
Conversation
…ion-only syncs The Fix Drift defense-in-depth step ran drift-sync-check.ts with no way to skip gate-3, so a deprecation-only sync that drift-sync had already (correctly) applied was vetoed by an unrelated live flake (run 42286556743, exit 22 on Live:managed:modeContinuation). The CLI now takes --base <pre-sync sha>, re-derives the change set from the diff, and applies drift-sync's own gate3SkipReason to it. Only a diff that touches model-registry.ts alone and only appends to deprecatedFamilies skips the re-collect; any other change still runs it. Gates 1 and 2 always run.
commit: |
…en the skip After drift-sync commits, git status is empty and the pin baseline at HEAD equals the edit, so gate-1 and gate-1b approved an empty diff. With --base, the changed files, the pin baseline and the skip decision all read <base>..HEAD. The deprecation-only skip now accepts only the writer's exact line shape (one literal, a comma, an optional // comment); anything else runs the re-collect. --base is resolved to a commit with rev-parse --end-of-options, and a value starting with '-' is a config error instead of a git option.
jpr5
added a commit
that referenced
this pull request
Nov 9, 2026
…ns (#608) Drift-sync's routine PR #606 (17 openai deprecations recorded in `deprecatedFamilies.openai`) failed CI run 42346883216 (`test (20)`). The tests assumed that ledger is empty. drift-sync itself works correctly; this PR changes tests only. ## Root cause - `drift-sync-core.test.ts`: "a whole morning's worth of deprecations…" took its stand-ins from `[...includeFamilies.openai].slice(0, 10)`. "recording a deprecation leaves the includeFamilies checksum pin GREEN" hard-coded `gpt-4` and `gpt-4-turbo`. `detectDeprecatedFamiliesForSync` correctly drops families the real ledger already records (`scripts/drift-sync.ts:450-454`), so after #606 those stand-ins are no longer reported. Fix: derive them with `unrecordedFamilies(provider, n)`, which is the existing anthropic-only helper made to work for any provider. - `drift-sync-check.test.ts` (same class of failure; it only showed up once #605 landed on main): the fixtures add run 42286556743's 17 deprecations on top of the real registry. Once #606 commits those same 17, the writer refuses to add a duplicate and the file throws at load. Fix: start from the real registry with `deprecatedFamilies.openai` emptied back to its comment-only shape. ## RED / GREEN - RED (main + #606 diff): `drift-sync-core` had 2 failures: `expected … to have a length of 10 but got 6` and `expected [ 'gpt-4o' ] to deeply equal [ 'gpt-4', 'gpt-4-turbo', 'gpt-4o' ]`. `drift-sync-check` failed at load with `fixture: could not add gpt-3.5-turbo to deprecatedFamilies.openai`. - GREEN: all 34 drift test files pass both with and without the #606 diff applied (1096 passed). - The tests still catch regressions (checked with #606 applied, in a scratch copy). Processing only the first candidate makes both core tests fail. Removing a zero-reference family from includeFamilies makes 3 tests fail. Making `deprecationOnlyOutcomes` bail on families that are already recorded makes 5 check tests fail. - Full suite passes: 487 files. Typecheck, lint, prettier, and build are clean.
jpr5
added a commit
that referenced
this pull request
Nov 10, 2026
…R delta gate (#609) ## Problem `drift-live-pr` > "Delta gate" throws `Unexpected retained-policy Gemini gateway response` on PRs. It failed on #605 and on both attempts of #606 (run 42697621424). The same `classifyNative` check also runs in the scheduled job. The gate allowed only one exact real Gemini unauthenticated body. Google's gateway now returns two bodies, and they alternate: **Old** (seen Nov 7 10:07 PM PST scheduled, and again Nov 9 10:30 PM PST in run 42768299471): ```json {"status":403,"body":{"error":{"code":403,"status":"PERMISSION_DENIED","message":"Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API."}}} ``` **New** (seen in run 42697621424 attempts 1 and 2 on Nov 9 at 1:01 PM and 1:13 PM PST, and in the scheduled run 42766538763 on Nov 9 at 10:13 PM PST): ```json {"status":403,"body":{"error":{"code":403,"status":"PERMISSION_DENIED","message":"Permission denied on the service.","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"ACCESS_DENIED","domain":"googleapis.com","metadata":{"service":"generativelanguage.googleapis.com"}},{"@type":"type.googleapis.com/google.rpc.LocalizedMessage","locale":"en-US","message":"Permission denied on the service."}]}}} ``` The status, `error.code`, and `error.status` did not change. The new body has a different message and adds `error.details`. ## Fix The gate now accepts exactly these two documented bodies (deep-equal) and nothing else. aimock's local 401 `UNAUTHENTICATED` contract stays the same, and so does the retained `Gemini native authentication` / `inbound policy divergence` entry. ## Red/green (real gate script extracted from the workflow, run on the captured run artifacts in delta mode) | Artifacts | main | this PR | |---|---|---| | #606 attempt 1 (new body) | `Error: Unexpected retained-policy Gemini gateway response`, exit 1 | `Drift gate PASSED`, exit 0 | | #606 attempt 2 (new body) | same throw, exit 1 | `Drift gate PASSED`, exit 0 | | run 42768299471 (old body) | PASSED, exit 0 | PASSED, exit 0 | | any of the above, mutated to status 500 or given an extra `error` key | — | throws, exit 1 | `src/__tests__/native-cursor-workflow.test.ts` gets new cases that run the real workflow gate. The current body is accepted in scheduled and delta modes; this fails on main and passes here. A server error, an extra error key, or a changed message is still rejected.
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.
Failing run
Fix Drift 42286556743: drift-sync applied 17
deprecatedFamilies.openaientries (reason=ok-applied), then the "Assert drift-sync-check (defense-in-depth)" step exited 22 (residual-critical-drift) onOpenAI Live/managed lifecycle: Live:managed:modeContinuation, a live leg that does not readdeprecatedFamilies.Root cause
drift-sync.tsskips gate-3 (the live re-collect) for deprecation-only runs viagate3SkipReason(49f9b22). The standalonedrift-sync-check.tsCLI had no skip, so the defense-in-depth step re-ran every live surface and any unrelated flake vetoed a correct edit. It also could not see the edit at all: drift-sync has already committed it, so the diff against HEAD is empty.Fix
drift-sync-check.ts --base <pre-sync sha>: re-derives the change set from the diff (base vs working tree) and applies drift-sync's owngate3SkipReasonto it. It does not trust drift-sync's output.model-registry.tsis the only changed file and the diff only appends todeprecatedFamilies(removing exactly the added lines reproduces the base file byte for byte). Any include/exclude change, removal, or other file runs the full re-collect. Gates 1 and 2 always run.familySetMemberLinesexported fromdrift-sync.ts(the writer's own AST locator).fix-drift.ymlAssert step passes--base "${BASE_SHA}"fromsteps.gitcfg.outputs.base_sha.RED / GREEN (real CLI, no secrets)
Real
npx tsx scripts/drift-sync-check.ts. The 17 run entries are committed on top of the base, as the workflow does. A PATH stub replaces onlynpx tsx scripts/drift-report-collector.tsand writes the run'sLive:managed:modeContinuationcritical.STUB LIVE COLLECTOR INVOKED→DRIFT SYNC NOT RESOLVED [residual-critical-drift] … Live:managed:modeContinuation,exit=22--base): collector not invoked →drift-sync-check passed … (live re-collect NOT RUN — this run only RECORDED deprecations, and no live drift surface reads deprecatedFamilies …),reason=ok,exit=0exit=22Unit tests cover the same cases. With the runCli wiring reverted, the GREEN test fails. With the byte-for-byte check removed, the include/removal tests fail. Typecheck, lint, prettier, actionlint and build are clean. The full suite has no new failures compared with main: the ~50 failures it reports are the same CLI/timing tests that fail on main, and
misbehavior-loadingpasses 104/104 on both when run alone.