Skip to content

unsloth_cli tests: stop the mklink kwargs assertion breaking on an unrelated keyword - #10231

Merged
danielhanchen merged 1 commit into
mainfrom
fix-mklink-kwargs-double
Sep 3, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-mklink-kwargs-double

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Repo tests (CPU) runs unsloth_cli/tests as its last step, so nothing there reports while an earlier step is red. With the tests/ step failing on test_context_dependent_unsloth_zoo_findings_are_digest_pinned (#10206), this has been hidden:

FAILED unsloth_cli/tests/test_start.py::test_create_directory_junction_uses_windows_mklink
E   AssertionError: assert {'capture_out...replace', ...} == {'capture_out...check': False}
E     Full diff:
E       {
E           'capture_output': True,
E           'text': True,
E     +     'encoding': 'utf-8',
E     +     'errors': 'replace',
E           'timeout': 30,
E           'check': False,
E       }

#10192 added encoding = "utf-8", errors = "replace" to _create_directory_junction's subprocess.run so a localized Windows console cannot lose the child's whole output stream. That change is right. The test was the problem: it asserted whole-dict equality on the captured kwargs, so it is a tripwire for any keyword the call gains, related or not.

This pins the values the call has to keep, and refuses a shell separately, rather than forbidding every future keyword:

Once #10206 lands and the tests/ step goes green, this is what Repo tests (CPU) fails on next, on every open PR. Verified locally on origin/main: unsloth_cli/tests/test_start.py goes from 1 failed / 601 passed to 602 passed / 3 skipped.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T09:27:20.358489Z 76554cb Manual request
🔒 Security Review ✅ Completed 2026-09-03T09:28:30.909397Z 76554cb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 76554cb418

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 76554cb418

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@danielhanchen
danielhanchen merged commit 521ac5d into main Sep 3, 2026
48 of 50 checks passed
@danielhanchen
danielhanchen deleted the fix-mklink-kwargs-double branch September 3, 2026 09:50
danielhanchen added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 4, 2026
…slothai#10289)

`Repo tests (CPU)` is red on `main`, on one test out of 15,843, asserting `const writesByKey = new Map<string, Promise<void>>();`.

unslothai#10160 is right and reordered nothing. Letting the API load settings panel forget an entry means `putModelOverride` returns a `ModelOverrideWriteResult` carrying `removedKeys` rather than `void`, and the queue it is stored in changed type with it. Three of the test's four assertions still match byte for byte: the key folded through `modelOverrideKey(normalizeModelIdentity, normalizeGgufVariantIdentity)`, the chain on the settled tail, and only the last writer clearing the slot. 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 assertion now pins serialisation through one in-flight promise per key without naming what that promise resolves to. Re-syncing the literal instead would leave it failing the next time the result type changes, which is a change that reorders nothing; this is the same shape as unslothai#10267 and unslothai#10231.

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, compared with what a plain re-sync of the literal would give:

| edit | re-synced literal | this change |
| --- | --- | --- |
| baseline | passed | passed |
| result type changes again, ordering untouched | failed | passed |
| the tail is never stored, a real ordering loss | passed | failed |
| serialisation removed entirely | failed | failed |
| writes no longer chain on the tail | failed | failed |
| any writer clears the slot, not just the last | failed | failed |
| the key stops folding the identity | failed | failed |

The two middle rows are the point: the re-sync stays brittle against a harmless change and stays blind to a real one.

`tests/studio/test_model_picker_contracts.py`: 191 passed. No source changes. Staging CI green.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant