Skip to content

Reject a new studio union offender even when the recorded count is unchanged - #9856

Merged
danielhanchen merged 1 commit into
mainfrom
studio-union-ratchet-reject-new-offenders
Sep 21, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-union-ratchet-reject-new-offenders

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

test_studio_evaluated_unions_do_not_grow computes added, the offenders that are not in STUDIO_UNION_DEBT_FILES, and then never asserts on it. Only the cardinality is compared:

added = [p for p in offenders if p not in STUDIO_UNION_DEBT_FILES]
assert len(offenders) <= len(STUDIO_UNION_DEBT_FILES), ...

A change that fixes one recorded file and adds one new offending studio module leaves both sides at 35, so the ratchet passes and a module that raises TypeError on import at the declared 3.9 floor ships unnoticed. The comment directly above claims the opposite, that a swap "cannot slip through on set membership alone".

The swap does not have to happen in one commit. The assertion is <= and nothing makes the recorded list shrink when a file is fixed, so every unrecorded fix leaves permanent slack for a later addition to sit in.

Nothing else covers this: test_no_pep604_unions_are_evaluated_on_the_declared_floor gates annotation scanning on PACKAGE_ROOT in path.parents and skips everything outside unsloth/.

Change

Assert not added alongside the count. The count stays, since it still catches net growth that introduces no new path, which is what an unrecorded fix produces. The comment is reworded to describe what the assertion now does.

Verification

Simulating the swap on a clean tree, by adding from __future__ import annotations to a recorded offender and adding a new studio/backend/routes/ module annotated int | None, so the count stays at 35:

  • before: 1 passed, the new module is invisible to the ratchet
  • after: 1 failed, naming studio/backend/routes/brand_new_route.py

With the swap reverted, tests/test_python39_compatibility.py is 8 passed, so a clean tree is unaffected.

Reported against #9826, which merged before it was addressed.

@danielhanchen
danielhanchen force-pushed the studio-union-ratchet-reject-new-offenders branch from 241b3eb to 9c98e23 Compare September 21, 2026 08:33
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 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-21T08:36:34.728726Z 9c98e23 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9c98e23fa1

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

@danielhanchen
danielhanchen merged commit 8a4777f into main Sep 21, 2026
17 of 18 checks passed
@danielhanchen
danielhanchen deleted the studio-union-ratchet-reject-new-offenders branch September 21, 2026 09:16
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
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