Skip to content

test: make TestParseExamples validate against the committed models.dev snapshot - #4147

Merged
aheritier merged 3 commits into
mainfrom
fix/4134-hermetic-models-dev-test
Sep 3, 2026
Merged

test: make TestParseExamples validate against the committed models.dev snapshot#4147
aheritier merged 3 commits into
mainfrom
fix/4134-hermetic-models-dev-test

Conversation

@aheritier

Copy link
Copy Markdown
Collaborator

Closes #4134.

Problem

TestParseExamples resolved example model references via modelsdev.NewStore(),
which tries a live HTTP fetch to models.dev before falling back to the embedded
snapshot.json. On CI's normal internet egress this meant the test validated
against whatever the live catalog said at the instant it ran, not the snapshot
committed to the repo — so an unrelated, unmodified PR could go from green to red
hours later purely because the live catalog moved on (observed on #4121, where
nebius dropped a model between two runs of the same commit).

Fix

  • pkg/modelsdev: new EmbeddedSnapshot() (the committed catalog, no network/disk)
    and Fetch() (always hits the live API, surfaces failures instead of degrading).
  • TestParseExamples now resolves via NewDatabaseStore(EmbeddedSnapshot())
    hermetic, safe as a required/blocking check. Shared skip logic extracted into
    catalogModelRefs.
  • New opt-in TestExamplesAgainstLiveModelsDev (gated on CHECK_MODELS_DEV_LIVE,
    same pattern as the existing CHECK_MODELS_SNAPSHOT_FRESHNESS) hits the live API
    and reports drift with an explicit "this is external catalog drift, not this PR"
    message.
  • New task check-models-live + scheduled/dispatch-only models-live-check.yml
    workflow runs it daily. Deliberately not added to ci.yml, so live drift can
    never block a PR.

Scope note

pkg/model/provider/bedrock/client_test.go's three TestDetectCachingSupport_*
tests had the identical live-NewStore() bug; fixed the same way as same-root-cause
scope. A repo-wide search found no other live models.dev lookups left in tests.

Testing

task build, task test (full suite, excluding two pre-existing environment
failures unrelated to this diff — pkg/cache and pkg/rag/treesitter, verified
present on main too), task lint, ./scripts/workflow-lint.sh, and
task check-models-live (live network) all pass. Verified TestParseExamples
stays green with an unreachable proxy (proving hermeticity).

EmbeddedSnapshot exposes the build-time snapshot.json catalog as a
read-only singleton, and Fetch hits the live models.dev API directly,
surfacing a network failure instead of silently degrading to a cache
or the embedded snapshot.

Together with the existing NewDatabaseStore these let callers build a
Store that is either provably hermetic or provably live, instead of
Store's usual best-effort network-then-cache-then-snapshot fallback.

Groundwork for #4134.
TestParseExamples used to resolve model references via
modelsdev.NewStore(), which tries a live HTTP fetch to models.dev
before falling back to the embedded snapshot. On CI's normal internet
egress this meant the test validated against whatever the live
catalog said at the instant it ran, not against the snapshot
committed to the repo — so an unrelated, unmodified PR could start
failing hours after a green run once the live catalog moved on
(observed on #4121).

TestParseExamples now resolves against
modelsdev.NewDatabaseStore(modelsdev.EmbeddedSnapshot()) only, so it
is hermetic and safe as a required, PR-blocking check: it can only
fail when the PR's own diff introduces an inconsistency.

The shared skip-and-resolve logic is extracted into
catalogModelRefs() and reused by a new, opt-in
TestExamplesAgainstLiveModelsDev (gated on CHECK_MODELS_DEV_LIVE,
mirroring the existing CHECK_MODELS_SNAPSHOT_FRESHNESS pattern), which
hits the live API and reports drift as explicitly external, not
PR-caused.

The bedrock TestDetectCachingSupport_* tests had the identical live
NewStore() bug; switched to the same hermetic store for the same
reason.

Fixes #4134.
Adds `task check-models-live` and a new, non-blocking
models-live-check workflow (workflow_dispatch + a daily schedule)
that runs TestExamplesAgainstLiveModelsDev against the real
models.dev API.

Deliberately not part of ci.yml or any required check: a failure here
means the external catalog drifted, which can strike any PR (or none)
at any time and gives the PR author no actionable signal — see #4134.
The failure step appends a summary explaining that explicitly.
@aheritier aheritier added area/ci CI/CD workflows and pipeline area/config For configuration parsing, YAML, environment variables area/models LLM model integrations and model providers area/providers/bedrock AWS Bedrock provider support area/testing Test infrastructure, CI/CD, test runners, evaluation kind/test Test-only changes labels Sep 3, 2026
@aheritier
aheritier marked this pull request as ready for review September 3, 2026 15:31
@aheritier
aheritier requested a review from a team as a code owner September 3, 2026 15:31
@aheritier
aheritier merged commit bb4b2de into main Sep 3, 2026
17 checks passed
@aheritier
aheritier deleted the fix/4134-hermetic-models-dev-test branch September 3, 2026 16:22
aheritier added a commit that referenced this pull request Sep 3, 2026
accounts/fireworks/models/kimi-k2-instruct does not exist in the
fireworks-ai models.dev catalog and never has. Replace it with
accounts/fireworks/models/kimi-k3, which is present in the current
snapshot, across DefaultModels, examples/fireworks.yaml, tests, and
the Fireworks provider docs (including the stale Available Models
table, which also listed two other nonexistent ids).

Also teach examples_test.go to resolve the actual models.dev catalog
id for providers where it diverges from the docker-agent provider
name (fireworks -> fireworks-ai, together -> togetherai, moonshot ->
moonshotai, chatgpt -> openai, opencode-zen -> opencode) instead of
unconditionally skipping validation, so this class of drift is caught
automatically going forward. vercel now validates directly (models.dev
catalogs it as-is); dmr/ovhcloud/cloudflare-* remain skipped with
updated, accurate comments.

Rebased onto main after #4147 (issue #4134/#4133) merged and added
TestDefaultModelsExistInModelsDev, which validates DefaultModels
directly against the models.dev provider id without the catalog-alias
resolution above; apply the same modelsDevCatalogProviders mapping
there so fireworks/together/moonshot/chatgpt/opencode-zen resolve
correctly instead of failing on the raw docker-agent provider name.

Fixes #4132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci CI/CD workflows and pipeline area/config For configuration parsing, YAML, environment variables area/models LLM model integrations and model providers area/providers/bedrock AWS Bedrock provider support area/testing Test infrastructure, CI/CD, test runners, evaluation kind/test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestParseExamples conflates hermetic snapshot-consistency checks with live models.dev catalog drift

2 participants