Skip to content

Tests: keep the zoo num_proc anchor tests meaningful once the zoo adopts the edit - #13269

Merged
danielhanchen merged 2 commits into
mainfrom
tests/zoo-num-proc-adopted
Oct 13, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
tests/zoo-num-proc-adopted

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up to unslothai/unsloth-zoo#1674, which makes sft_prepare_dataset in the zoo use get_dataset_num_proc directly.

The canary and drift tests in tests/utils/test_dataset_num_proc.py read the installed zoo's sft_prepare_dataset block and expect the old host-wide text. Against the new zoo they either failed (4 tests) or tested nothing. They now accept a zoo that already adopted the block, run the drift cases against the old anchor text, and add a test that an adopted block is left unchanged, with no warning and valid code.

Tests only, no runtime change. tests/utils/test_dataset_num_proc.py + test_train_on_responses_only_num_proc.py: 139 passed against both the current and the new zoo.

… edit

unsloth_zoo now ships the sft_prepare_dataset worker-count block exactly as rl_replacements.py rewrites it. The canary counted the old anchor in the installed zoo and the drift tests mutated it, so they failed or tested nothing against a newer zoo. Treat an adopted block as done, run the drift tests against the anchored spelling, and pin that an adopted block is left untouched with no warning (the narrow fallback must not rewrite its first line).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-10-11T07:15:38.952918Z 5c8ae68 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c8ae689da

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


def _zoo_adopted_the_num_proc_edit(source):
"""Whether the Zoo already ships the replacement itself, which the edit's idempotence check leaves alone."""
return _num_proc_replacement() in source

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize quotes when recognizing an adopted block

If the Zoo ships the adopted block with single-quoted strings, _replace_or_fallback correctly treats it as already applied because its _same_source check normalizes quote style, but this exact substring test returns false. Consequently, the anchor canary requires the removed old block, while test_a_zoo_that_adopted_the_num_proc_edit_is_left_alone attempts to replace that nonexistent block and fails its adopted != source assertion, causing CI failures for a Zoo spelling explicitly supported by the production helper.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zoo block (unslothai/unsloth-zoo#1674) is spelled byte for byte as unsloth's replacement text, so the exact match is what ships; a zoo reformat that changed quote style is what this canary should flag, not silently accept.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5c8ae689da

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant