Skip to content

fix(drift): skip the live re-collect in drift-sync-check for deprecation-only syncs - #605

Merged
jpr5 merged 2 commits into
mainfrom
fix/drift-sync-check-deprecation-skip
Nov 9, 2026
Merged

jpr5 merged 2 commits into
mainfrom
fix/drift-sync-check-deprecation-skip

Conversation

@jpr5

@jpr5 jpr5 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Failing run

Fix Drift 42286556743: drift-sync applied 17 deprecatedFamilies.openai entries (reason=ok-applied), then the "Assert drift-sync-check (defense-in-depth)" step exited 22 (residual-critical-drift) on OpenAI Live/managed lifecycle: Live:managed:modeContinuation, a live leg that does not read deprecatedFamilies.

Root cause

drift-sync.ts skips gate-3 (the live re-collect) for deprecation-only runs via gate3SkipReason (49f9b22). The standalone drift-sync-check.ts CLI 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 own gate3SkipReason to it. It does not trust drift-sync's output.
  • Skips only when model-registry.ts is the only changed file and the diff only appends to deprecatedFamilies (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.
  • familySetMemberLines exported from drift-sync.ts (the writer's own AST locator).
  • fix-drift.yml Assert step passes --base "${BASE_SHA}" from steps.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 only npx tsx scripts/drift-report-collector.ts and writes the run's Live:managed:modeContinuation critical.

  • RED (main): STUB LIVE COLLECTOR INVOKED → DRIFT SYNC NOT RESOLVED [residual-critical-drift] … Live:managed:modeContinuation, exit=22
  • GREEN (this branch, --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=0
  • Control (this branch): includeFamilies add + re-pin → collector invoked, exit=22

Unit 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-loading passes 104/104 on both when run alone.

…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.
@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@605

commit: c51b06e

…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
jpr5 merged commit d72b45c into main Nov 9, 2026
39 of 40 checks passed
@jpr5
jpr5 deleted the fix/drift-sync-check-deprecation-skip branch November 9, 2026 20:28
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant