Repository navigation
tests: follow the remote-connection contract through its refactor - #8467
Conversation
Both assertions pin implementation details that moved, so they fail on working code and red-line Repo tests (CPU) on every PR. The inline `Promise.allSettled(backfillTasks)` is now behind settleTasksIfCurrent, which adds a staleness guard. Assert the call and what the helper does, so "every backfill task is settled, one slow task cannot drop the rest" stays pinned rather than assumed. Provider hydration moved off the chat page into the credential bootstrap that the root route runs, so connections hydrate app-wide rather than only once chat mounts. The test follows it there and is renamed, since it is no longer the chat page that does this. Assertions match the call sites, not the bare names: an import survives deleting the call, so a name-only check would pass on a startup that hydrates nothing. Verified by mutation - breaking allSettled, the sync call, the bootstrap call and the settle call each fail the test.
Two more assertions pinning shapes that moved, failing on working code. The lost-POST proof left settleLostGeneration: the id snapshot is now taken by the caller before the request and handed over as a NewRecordProbeBaseline, and the comparison lives in hasUnknownRecord. That is stronger than before, since the set can no longer be rebuilt in the catch. The test follows it into lib/gallery-flags.ts and additionally pins the canJudgeUnpinned guard, which is what stops an inconclusive listing from reading as proof. effectiveRecommended became a Set, so picking the representative is a membership test rather than an equality check. Mutation tested, seven for seven: breaking the unknown-id check, the canJudgeUnpinned guard, the probe call, the pre-request snapshot, the error message and either half of the representative rule each fail the tests.
…y group Review caught three assertions that pass while the behaviour they name is broken, and one of them was covering a real bug. footprintVariants picked its per-group representative from the flattened effectiveRecommended set, so with two families in one neutral repo sharing quant names, the other group's recommended quant could stand in here and resolve companions against the wrong base repo. That is the exact case this contract exists for. effectiveRecommendedByGroup is already built above and key is in scope, so the lookup is keyed now. The hydration test only proved bootstrapPersistedCredentials() appears inside CredentialBootstrapGate, not that the gate is mounted, so removing the wrapper stopped hydration with the test still green. It pins the mount too. The lost-POST test checked three strings that can each be present while the baseline handed to the probe is recomputed after the POST. It now pins the order and the flow: snapshot before generateDiffusionImage, that same probeBaseline into settleLostGeneration, and that baseline into hasUnknownRecord. Mutation tested, nine for nine: each of the three new holes, plus the six from the earlier rounds.
Three conflicts, all of them main and this branch repairing the same contract drift independently. tests/studio/test_remote_connection_models_contract.py, both hunks: main (#8506) already followed the sync backfill to settleTasksIfCurrent and renamed the hydration test, so the branch's version of that work is redundant. Kept main's naming, docstring and the robust "allSettled" in helper check, and folded in the one thing the branch had that main did not: the assertions match CALL sites rather than bare names. "bootstrapPersistedCredentials" alone is satisfied by the import on line 23 of __root.tsx, so main's assertion passes on a root that imports the bootstrap and never runs it; "bootstrapPersistedCredentials()" pins the call on line 108, and "<CredentialBootstrapGate>" pins that the gate wrapping it is actually rendered. Same for the bootstrap's own call, "syncExternalProvidersFromBackend(providers". tests/studio/test_model_picker_contracts.py, the lost-generate-POST test: main followed the proof into hasUnknownRecord loosely ("baseline" in fn, the export exists); this branch pinned the data flow instead -- the baseline is built BEFORE the POST and the probe refuses to judge an inconclusive listing. Those are different guarantees, so both are kept; the branch's local name for the helper file was dropped in favour of main's. tests/studio/test_model_picker_contracts.py, the footprint-group test: main tracked the source through effectiveRecommended becoming a Set and asserted membership in it. That set is flattened across dependency groups, which is the bug this branch fixes in pickers.tsx, so main's assertions describe the behaviour being removed. Took the branch's keyed-lookup assertions. One resolution beyond the marked conflicts: main moved the row badge off the flattened effectiveRecommended set (effectiveRecommendedByGroup.get (group.key) === v.quant) and this branch moves the footprint representative off it, so after the merge the memo has no readers left. Deleted it, along with the comment that named the footprint representative as its reason for existing. biome runs correctness rules with "all": true, so leaving it would fail lint.
|
Merged current main in ( Three conflicts, and one resolution outside the marked hunks that I want a second pair of eyes on. Conflicts
The part worth checkingMain moved the row badge off the flattened set (
Why this one is worth keeping, unlike #8429It carries a live source fix main does not have. |
… key
The footprint representative buckets rows by the backend's dependency_key
("flux.2-klein:<digest>"), but looked the recommendation up in
effectiveRecommendedByGroup, which is keyed by presentation group
("quantizations", "text-frames", "reference-media"). Every lookup was
undefined, so the recommended-quant branch never ran and whichever row tier
ordering put first spoke for the group, sending its filename and download
state to resolveDownloadFootprint. The recommendation is now reachable from
the variant object the presentation grouping already placed, which keeps the
per-group scoping without joining two key spaces.
Also scope the backfill contract's allSettled assertion to the body of
settleTasksIfCurrent. reconciliation.ts allSettles again in
runCredentialBootstrap, so the module-wide search stayed green when
settleTasksIfCurrent was regressed to Promise.all, which is the
one-failure-sinks-the-rest bug that assertion exists to catch.
…ling Two contracts passed on code that was broken. The lost-generate probe contract only checked that the id snapshot expression existed somewhere, that the baseline was built before the POST, and that probeBaseline reached the probe. Swapping the knownIds argument for a fresh empty set kept all three true while every record already on the page read as unknown, so a POST that never reached the backend was reported as a finished image. Capture the snapshot variable and pin it as the third argument, over whitespace-normalised source so reformatting the call cannot break the pin. The provider backfill contract asserted the call and the allSettled by substring, neither of which contains await. Dropping await from the helper or from its call site left it green even though the sync then resolves with the writes still in flight, which loses them on an immediate close or a session transition. Add tests/studio/test_provider_backfill_awaits_batch.py, which slices both hops verbatim into the node harness and drives them with timer-backed tasks, and give the frontend suite the same delayed-task case against the real helper. Normalise whitespace in the remaining wiring assertion, which a wrapped argument list was already enough to fail.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Resolves the contract-test conflict: main reformatted the Vulkan gate assertion in unslothai#8467 while this branch scoped the gate to the GGUF picker. Keeps both, as one named literal.
Problem
tests/studio/test_remote_connection_models_contract.pyhas two assertions that fail onmaintoday, soRepo tests (CPU)is red on every PR:Both pin implementation details that have since moved. The behaviour they exist to protect is intact:
Promise.allSettled(backfillTasks)is nowawait settleTasksIfCurrent(backfillTasks, isCurrent). That helper (features/credentials/reconciliation.ts) doesawait Promise.allSettled(tasks.map((task) => task()))behind a staleness guard, so every backfill task is still settled and a stale response no longer applies.features/credentials/bootstrap.ts, whichapp/routes/__root.tsxruns. Connections now hydrate app-wide instead of only once chat mounts.So the tests fail on working code, and simply deleting the assertions would stop pinning the contract at all.
Fix
Follow the code. The backfill test asserts the call plus what the helper does; the hydration test asserts the bootstrap call and the root route that runs it, and is renamed since the chat page is no longer what does this.
Assertions match the call sites, not the bare names. An import survives deleting the call, so
"syncExternalProvidersFromBackend" in sourcewould pass on a startup that hydrates nothing. That was a real weakness in my first draft, caught by mutation testing rather than by reading.Testing
pytest tests/studio/test_remote_connection_models_contract.py: 7 passed.Mutation-tested, since a contract test that cannot fail is worse than none:
Promise.allSettledtoPromise.allin the helpersyncExternalProvidersFromBackend(providers, ...)call in bootstrapbootstrapPersistedCredentials()call in the root routesettleTasksIfCurrent(backfillTaskscall in sync