Skip to content

runtime/flybot-image: keep the model-api recipe test off the host secret store - #3492

Merged
Birfy merged 1 commit into
mainfrom
dev/3490-hermetic-model-api-tests
Dec 2, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/3490-hermetic-model-api-tests

Conversation

@Birfy

@Birfy Birfy commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

What changed

runtime/flybot-image's model-api test asserted that resolveModelApiPath({}) and loadModelApi({}) are undefined. That only holds on a host with no provisioned model-api file: on a configured host /run/secrets/flybot-workspace-model-api.json exists, the default candidate list finds it, and both assertions fail. CI stays green only because the runner has no such file, so the recipe suite can never be green on an operational host.

  • resolveModelApiPath(env, defaults = DEFAULT_FILES) and loadModelApi(env, defaults = DEFAULT_FILES): the default candidate list becomes an optional second argument. Single-argument callers (runtime/flybot-image/ds-bot-bridge.mjs, launch.mjs) behave exactly as before.
  • The test passes an explicit empty list, so the "nothing configured" case is simulated instead of read from host state.
  • New assertion: every entry of DEFAULT_FILES lives under an ALLOWED_PREFIXES directory. This keeps the invariant the old assertion was reaching for — the defaults must be paths readModelApiFile accepts — and is why ALLOWED_PREFIXES is now exported.

Acceptance

  • On a host with the real secret file present: runtime/flybot-image npm test gives 29/29 pass; base a062ba2158261ed0e5e5e217723e19df290ff02a gives 28/29 with this test as the single failure.
  • The new assertion is not vacuous: dropping the optional defaults argument makes it fail again.

Local readings (not CI)

  • runtime/flybot-image npm test: 29 tests, 29 pass, 0 fail, rc 0 (host has /run/secrets/flybot-workspace-model-api.json, 272 B).
  • Repo root node --test --test-concurrency=2 tests/*.test.mjs: 974 pass, 0 fail, rc 0, 8.3 s.
  • Base tree 3f164e11 test/model-api.test.js alone: 4 pass, 1 fail.

Scope

Two files. The default resolution path for production callers is unchanged; only the test's view of host state changes.

Refs #3490

…ret store

The model-api test asserted that resolveModelApiPath({}) and loadModelApi({})
are undefined, which only holds on a host without a provisioned model-api
file. On a configured host the default candidate list finds the real
/run/secrets file, both assertions fail, and the recipe suite can never be
green there while CI stays green because the runner has no such file.

Take the default candidate list as an optional second argument, pass an
explicit empty list from the test, and assert that every default candidate
lives under an allowed prefix. Production callers keep the single-argument
form, so the default resolution path is unchanged.

Refs #3490
@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Dec 2, 2026
@Birfy
Birfy added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 1f62d02 Dec 2, 2026
18 checks passed
@Birfy
Birfy deleted the dev/3490-hermetic-model-api-tests branch December 2, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant