Repository navigation
Studio: assert the write ordering, not what the write resolves to - #10289
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Codex Review: Didn't find any major issues. 🎉 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". |
This was referenced Sep 4, 2026
Souravrajvi0
pushed a commit
to Souravrajvi0/unsloth
that referenced
this pull request
Sep 4, 2026
…rd (unslothai#10307) `Repo tests (CPU)` was red on `main` at `99a83f6a6` and `a2a4143ce`, and so on PRs branched from them, on one test out of 15,899: ``` FAILED tests/studio/test_auth_form_input_count.py::test_auth_flow_routes_do_not_mount_global_settings assert 'if (!active || !mounted) return null;' in mount ``` unslothai#10237 gave `SettingsDialogMount` a second surface, so the single lazy-mount flag became two: ```diff - const [mounted, setMounted] = useState(open || monitorOpen); - if (!active || !mounted) return null; + if (!active || !(settingsMounted || monitorMounted)) return null; ``` That is right and it did not open the auth routes. `!active` still short-circuits, so an inactive mount still renders nothing, which is the whole of what this test is named for. The other two assertions in the test still match byte for byte, so the chain it protects, auth route to `active={false}` to nothing rendered, is intact at every link. The assertion had simply quoted the auth gate and the lazy-mount bookkeeping as one string. ## The change Assert the property rather than a spelling: `SettingsDialogMount` must return null from its own top level on every inactive render. The guard is read as a parse, because a textual match is what got us here: - Comments and string bodies are blanked first, in a same-length copy so indices still line up. The assertion this replaces matched `// if (!active || !mounted) return null;` just as happily as the live line, so the guard could have been struck out entirely and the test would have stayed green. - The slice is the real function body. The signature is `({ active }: { active: boolean })`, so the body brace is found by walking the parameter list rather than taking the first brace after the name. - Only statements directly in that body count, so `(active) => { if (!active) return null; }` cannot answer for the component. - The condition must be a disjunction whose first operand is `!active`. A top-level `?` or `,` disqualifies it, since both bind looser than `||`: `!active || mounted ? false : true` and `!active || track(), active` each leave the disjunction as a discarded sub-expression and skip the return while inactive. `?.` and `??` are neither. - `{ return null; }` is accepted alongside `return null;`, so a bracing pass does not go red for nothing. This is the same shape as unslothai#10267, unslothai#10231, unslothai#10289 and unslothai#10297. The file had already reached that conclusion twice on its own, as "Lock the count, not the spelling, so a rename does not falsely fail" and "Lock the behaviour, not one spelling of it, so either form passes". This assertion had not had the treatment. ## Verified by breaking it The predicate was checked directly against 15 conditions, all correct. Then fifteen edits to `settings-dialog-mount.tsx`, each run against the test, next to what a plain re-sync of the literal would give: | edit | re-synced literal | this change | | --- | --- | --- | | baseline | passed | passed | | both mount flags renamed | **failed** | **passed** | | a third surface joins the mount | **failed** | **passed** | | the operands reordered | **failed** | **passed** | | back to a single flag, as before unslothai#10237 | **failed** | **passed** | | optional chaining in the second operand | **failed** | **passed** | | the guard braced by a formatter | **failed** | **passed** | | the `!active` half dropped | failed | failed | | `||` becomes `&&` | failed | failed | | the whole guard deleted | failed | failed | | the gate inverted to `active` | failed | failed | | a ternary swallows the disjunction | failed | failed | | a comma expression discards the disjunction | failed | failed | | the guard moved into a nested callback | failed | failed | | the guard survives only as a comment | **passed** | **failed** | Six harmless forms pass where a re-sync goes red on all six, none of which touches the auth routes. Nine real regressions fail. The last row is the one that matters most: a re-sync, and the assertion that was there before it, both accept a guard that exists only as a comment. `tests/studio`: 7483 passed, 195 skipped. No source changes. Staging CI green.
This was referenced Sep 5, 2026
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.
Repo tests (CPU)is red onmainat2d346cce0, on one test out of 15,843:#10160 is right, and reordered nothing
That PR lets the API load settings panel forget an entry, so
putModelOverridenow returns aModelOverrideWriteResultcarryingremovedKeysinstead of returningvoid. The queue it is stored in changed type with it:The ordering itself is untouched. Checked line by line against the source rather than assumed:
writesByKeymodelOverrideKey(normalizeModelIdentity, normalizeGgufVariantIdentity)previous.catch(() => {}).then(() => sendModelOverride(Three of the four assertions still match unchanged. The one that broke names the promise's value type, and what a write resolves to has nothing to do with the order writes commit in.
The change
Assert that writes are serialised through one in-flight promise per key, without naming what that promise resolves to.
The obvious alternative, re-syncing the literal to
Promise<ModelOverrideWriteResult>, is worse than it looks: it leaves the test failing the next time the result type changes, which is a change that reorders nothing. This is the same shape as #10267 and #10231, an assertion written as one exact literal over something that is not fixed.While here, one assertion is added rather than only relaxed:
writesByKey.set(key, write);. Without the tail being stored, every writer chains on the same empty slot and the ordering is gone, and nothing in the test noticed.Verified by breaking it
Six edits to
model-overrides.ts, each run against the test:The middle two rows are the point. The first column is what a plain re-sync gives you: still brittle against a harmless change, and still blind to a real one.
tests/studio/test_model_picker_contracts.py: 191 passed. No source changes.