test: reject unsupported quota-axi schema versions and duplicate rows in dispatch-resolve - #5199
Closed
tiago-peixoto wants to merge 1 commit into
Closed
tiago-peixoto wants to merge 1 commit into
tiago-peixoto wants to merge 1 commit into
Conversation
Schema 5 and 6 already resolve through the public interface. Pin that versions 4 and 7, duplicate schema-5 providers, and duplicate schema-6 account keys fail closed as invalid snapshots.
Contributor
Author
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.
Intent
quota-axi now emits schemaVersion 6, but bin/fm-quota-axi-lib.sh accepts only schemaVersion 5. This makes fm-dispatch-resolve reject an otherwise valid 19 KB snapshot and blocks all profile-based launches, including no-mistakes-everywhere-research. Update the compatibility contract with tests and validate current schema semantics before widening acceptance.
What Changed
fm-dispatch-resolveend-to-end cases that turn a quota-axi snapshot withschemaVersion4 or 7 into an error outcome, reported asquota-axi --json returned an invalid snapshot. This pins the accepted contract to exactly versions 5 and 6, not a range.accountKey, and schema 5 rows must be unique on provider.Risk Assessment
✅ Low: The branch only adds tests that run fm-dispatch-resolve end to end, and each one passes because the validator in bin/fm-quota-axi-lib.sh:83-91 rejects that specific input: schemaVersion 4, schemaVersion 7, a duplicate provider+accountKey pair in schema 6, and a duplicate provider in schema 5.
Testing
I ran the real quota-axi 0.1.48 on this host to get a live schema 5 snapshot. With a lab Pi auth file listing two Codex accounts, it also produced a real schema 6 snapshot (about 16 KB) that includes the host's other providers. I fed both through the real fm-dispatch-resolve.sh with an isolated FM_HOME, faking only the typesafe.ai API call. Both snapshots resolved to
status: clear. Under schema 6, each Pi lane was matched to its own account row, and none were matched by position. The pre-fix code (259a669^), given the same live schema 6 bytes, reproduced the original "invalid snapshot" error. Changed copies of the live snapshot (schemaVersion 4, 7, or the string "6", a duplicate row key, a row with no accountKey) were all rejected with a clean error and exit 0. The focused test file passes. A deliberately widened validator makes it fail at "schema 7 is an error outcome", so the new tests do guard the contract; that mutation check exercises the test suite rather than the live product, so it is recorded as untested in the live scenarios. There is no UI surface, so there are no screenshots; the evidence is CLI transcripts and the captured snapshots. Temporary lab directories were removed and the worktree is clean.Evidence: Live schema 6 snapshot from real quota-axi 0.1.48
Source: Live schema 6 snapshot from real quota-axi 0.1.48
Evidence: Live schema 5 snapshot from real quota-axi 0.1.48
Source: Live schema 5 snapshot from real quota-axi 0.1.48
Evidence: fm-dispatch-resolve accepting a live schema 6 snapshot
Source: fm-dispatch-resolve accepting a live schema 6 snapshot
Evidence: Control run and pre-fix repro on the same live schema 6 bytes
Source: Control run and pre-fix repro on the same live schema 6 bytes
Evidence: Mutation check: widening to schema 7 fails the new test
Source: Mutation check: widening to schema 7 fails the new test
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
quota-axi --json(real 0.1.48, real HOME) -> 16.5 KB schemaVersion 5 snapshot, saved as live-snapshot.jsonPI_CODING_AGENT_DIR=<lab dir with openai-codex + openai-codex-work entries> quota-axi --json --no-credential-refresh-> real 16 KB schemaVersion 6 snapshot, 17 rows (codex split across 2 accountKeys, othersdefault), exit 0live-harness.sh <worktree> schema6: real bin/fm-dispatch-resolve.sh calling the real quota-axi in schema 6 mode; only the typesafe.ai HTTP call is fakedlive-harness.sh <worktree> schema5: same, with the real host's schema 5 snapshotlive-harness.sh <worktree> replay:<file>on the exact live schema 6 bytes (control) and on copies changed to schemaVersion 4, 7, the string "6", a duplicate provider+accountKey, a duplicate schema 5 provider, and a row with no accountKeygit archive 259a669^ bin+live-harness.sh <prefix-bin> replay:live-schema6-full-snapshot.json(pre-fix repro)bash tests/fm-dispatch-resolve.test.shMutation check: temporarily widened fm_quota_json_valid to accept schemaVersion 7, re-rantests/fm-dispatch-resolve.test.sh, then restored the file withgit checkout✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.