fix(drift): stop gemini-interactions provider-mode false positive#296
Merged
Conversation
The daily Drift Tests / Fix Drift jobs failed every run because the Gemini model-availability check scrapes `gemini-*` tokens from source files (including README.md) with a greedy regex, then verifies each against Google's live model list. Commit 4753feb documented the aimock `gemini-interactions` provider mode in README.md as a bare token; the scraper grabbed it as if it were a Gemini model id, the availability check failed (it is not a real Google model), and drift-report-collector.ts crashed as an "unparseable" failure — firing a daily false-positive "providers changed response formats" Slack alert with no real drift. Fix (two layers of defense): - Extend the Gemini stable filter to exclude aimock provider-mode names via an explicit AIMOCK_GEMINI_PROVIDER_MODES set, so a scraped provider-mode token is never drift-checked (the real fix). - Reword the README so the provider mode is no longer written as a bare model-id token, so the greedy scraper does not pick it up in the first place. Extract scrapeModels / GEMINI_MODEL_PATTERN / sourceFiles / filterStableGeminiModels as exports and add models-scrape.drift.ts, a regression guard that exercises the real scrape + filter surface (no fakes) so a future doc mention re-introducing this false positive is caught here instead of in the live nightly job.
commit: |
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.
Root cause
The daily Drift Tests and Fix Drift jobs have been failing every run, firing a daily
HTTP API drift detected ... providers changed response formatsSlack alert — but there is no real drift.The Gemini model-availability check (
src/__tests__/drift/models.drift.ts) scrapesgemini-*tokens from source files (includingREADME.md) with a greedy regex\b(gemini-(?:[\w.-]+))\b, then verifies each against Google's live model list. Commit4753febdocumented the aimockgemini-interactionsprovider mode inREADME.md:148as a bare token. The scraper grabbed it as if it were a Gemini model id; the availability check failed (it is not a real Google model); andscripts/drift-report-collector.ts:~791then fatally crashed (exit 1) because thatAssertionErroris neither a parseable drift block nor classifiable as infra.The fix (two layers of defense)
AIMOCK_GEMINI_PROVIDER_MODESset, so any scraped provider-mode token is never drift-checked. Resilient to future doc mentions of the same mode.README.mdso the provider mode is no longer written as a bare model-id token, so the greedy scraper does not pick it up in the first place.Extracted
scrapeModels/GEMINI_MODEL_PATTERN/sourceFiles/filterStableGeminiModelsas exports and addedsrc/__tests__/drift/models-scrape.drift.ts, a regression guard that exercises the real scrape + filter surface (no fakes) so a future doc mention re-introducing this false positive is caught here instead of in the live nightly job.Red / Green (real surface, not fakes)
RED — production (already failing on main)
Drift Tests(scheduled) run 29312286967 → failureFix Driftrun 29312327186 → failureVerbatim from the failing
driftjob log:RED — local (pre-fix scrape + filter surface)
Replicating the exact pre-fix scrape + stable filter over the real README:
gemini-interactionssurvives the pre-fix filter — exactly what then gets checked against Google's model list, fails, and crashes the collector. A regression assertion (expect(preFixStable).not.toContain("gemini-interactions")) against this pre-fix state FAILS:GREEN — local (post-fix, same surface)
gemini-interactionsis no longer treated as a model id; the false positive is gone.GREEN — live workflow (authoritative; PR CI skips the live drift leg)
The
driftjob is guardedif: github.event_name != 'pull_request', so PR CI does not exercise this fix. Dispatched the liveworkflow_dispatchon this branch:Drift Testsrun 29360718724 → conclusion:success—driftjob passed in 39s, "Fail if critical drift detected" step skipped (no critical drift).Quality gate
pnpm run format:check— clean (only the git-ignored local.impeccable/hook.cache.jsonwarns; not part of this change, not in CI)pnpm run lint— cleantsc --noEmit— zero errors in the changed files (models.drift.ts,models-scrape.drift.ts); pre-existing unrelated test-file type errors exist on main independentlypnpm test— 147 files, 4364 tests, all passpnpm test:drift— 15 passed / 10 skipped (no live keys locally; provider blocks skip); the new regression test passespnpm build— clean