Repository navigation
Trim comments in tests, scripts, CI helpers and unsloth_cli - #10113
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85a07f8dfb
ℹ️ 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".
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU Lesser General Public License as published by | ||
| # the Free Software Foundation, either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU Lesser General Public License for more details. |
There was a problem hiding this comment.
Restore the complete license notices
This comment-trimming pass removes substantive clauses from established license headers across 26 files, leaving fragments such as “either version 3 ... or / but WITHOUT ANY WARRANTY” without the omitted later-version option, grant/purpose text, or warranty wording; the same issue truncates Apache notices in tests/saving/test_gguf_disk_preflight.py, tests/test_prefetch_snapshot_scope.py, and tests/utils/test_q_galore.py. When these scripts or tests are copied or distributed independently, the resulting headers no longer communicate their licensing terms coherently, contrary to this change's stated intent not to touch license headers, so the complete notices should be excluded from comment trimming.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
|
Moving this to draft. A check that was not run before opening it has now been run, and it fails. Every verification behind this PR looked at what survived: the AST gate proves no code changed, the length rule proves no comment line is over 120 columns, and reading the diff shows sensible comments. None of those can see a fact that was dropped while a comment was being shortened, because the result still reads as a complete, well formed comment. Measuring the other direction, comparing distinctive facts in the base commit's comments (identifiers, filenames, constants, issue references, measured values) against the text that survives, this PR has lost a material fraction of them. Sampling the losses with their original context shows they are not restatements that were correctly removed. Examples of the class:
These are the invariants and measured values the code cannot state, and they are exactly what the pass was supposed to protect. I am running a restoration pass over the affected files and will push an update and mark this ready for review once the fact retention is measured and above threshold. Nothing here should be merged in its current state. The underlying lesson, which is worth more than this PR: a comment-reduction pass cannot be validated by inspecting its output. It has to be validated by sampling what it discarded and what it rewrote, against the original. |
|
Updated, and ready for review. The fact-restoration pass described in the previous comment is now applied to both halves of this PR. tests, scripts, CI helpers
studiobench and unsloth_cli
Current totals against the base commit
Lower than the -43.1% first reported, and the difference is the restored material. Gate: 623/623 files report What the restoration put backThe losses were concentrated in comments that were kept and then shortened, not in comments that were deleted. Examples now restored:
Note on the other PRs in this seriesThe sibling comment-trim PRs are still in draft pending the same pass. Two of them are being closed rather than repaired, because restoring their losses converges on the original text and leaves no useful reduction. This one is being marked ready because the reduction survives the restoration. |
3d69ec3 to
1f74d3a
Compare
|
Second update. Two further defects found and fixed since the last push. Slot 10 half re-run with the block-level method. The earlier pass judged against the single best-matching line, which under-represents a block that was compressed into three or four lines. Re-judged against the actual surviving block: all 210 compression cases judged individually, 19 further restorations, and a systematic re-audit of 100 of those decisions upheld 94 and reversed 6. The six reversals were restored, not just reported. They share one shape: a compression accepted because the headline claim survived, where the dropped clause was the evidence for the claim rather than decoration. Restored among them: the pacer's proof numbers (150 chunks, 3,581 characters, 73 ms cadence), the probe's runnable invocation, Duplicate insertions from the restoration itself. Restoring a recovered sentence next to a surviving paraphrase produces two adjacent comment lines saying the same thing. Nothing in the AST gate, the length rule or a read of the diff can see this. A near-duplicate scan (token overlap at or above 0.75 between lines inside one comment block) found 4 in the studiobench half and 25 in the tests and scripts half. All are removed, keeping whichever line matches the base commit: Current state
Retention: 91.6% and 92.7% on the two halves. Hand-judged: 81 of 100 and 94 of 100. Gate: 623/623 |
1f74d3a to
52b945d
Compare
|
Third update, and a correction to a claim in the PR description. The description says pragmas are untouched. That was not true. A sweep across the whole batch found 81 functional pragmas deleted, of which this PR's files held some. All are restored and re-verified. Deleted pragmas are invisible to the AST comment-only gate for the same reason a deleted licence header is: to the gate, One case was worse than a deletion. In
Gate re-run after the restoration: all files still report |
|
Back to draft, pending one more check. Slot 5's pass found a limitation in the survivor detector this PR's verification relied on. The detector matches a baseline comment to its surviving shortened version by text prefix. Where a pass re-authored the OPENING of a comment rather than only trimming its tail, the current text no longer starts with any baseline phrase, so the matcher classifies the block as deleted or drops it entirely. Measured on another slot, the prefix rule found 291 survivors where a DP alignment found 515, a 43% shortfall. The hand-judged accuracy figures quoted above remain valid for the cases that were judged. They simply cover a smaller share of the damage than assumed, because a portion of the compression losses were never surfaced for judgement at all. Re-running detection with a union rule, prefix match or Jaccard overlap over blocks or shared distinctive identifier, then judging and restoring whatever it surfaces. I will mark this ready again once the count is honest, or close it if restoring the newly surfaced population leaves no useful reduction, as happened with #10111. |
52b945d to
565d507
Compare
|
Scope narrowed and ready for review. This PR now covers only Current state, 453 files
What the verification actually covers now. The survivor detector was re-run with a union rule (prefix match, or Jaccard overlap over blocks, or shared distinctive identifier) rather than prefix alone, because a prefix rule cannot see a comment whose opening was re-authored. On these files that surfaced 62 additional cases out of 1,314, all judged and handled. The narrow rule worked here because the compression in this slot always kept the leading clause and dropped from the tail, so the surviving text still opens with a baseline phrase. One correction worth recording for anyone doing similar work. The first restoration attempt used a composer that replaces the surviving comment run. It reported 51 blocks restored while the fact count went backwards by 44 net, because it overwrote lines an earlier round had already restored. A per-block progress count cannot see that. The working method appends the missing clause below the surviving run and never rewrites it, and both it and the duplicate scan skip any run containing a pragma, The CI and packaging helpers under |
565d507 to
0df22a5
Compare
|
Moving this back to draft. An independent pass over the whole diff found a defect class that none of the checks I had been running can see, and it is not a handful of slips. The two items above were real, and I fixed them in 9c4ba34. But they turned out to be a sample rather than the whole story. Counting comment blocks that read as sentence fragments, baseline to head: 98 -> 522. That is +424. I hand-checked 12 of the 522 at random against The reflow did not only truncate, it re-anchored. Confirmed examples:
Worth saying plainly why this got as far as it did. I would rather regenerate this from |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c4ba344d7
ℹ️ 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".
| try: | ||
| survey = survey_kernels(api) | ||
| except Exception as exc: # noqa: BLE001 | ||
| # An unreadable quota is not permission to spend it -- and it is not evidence of exhaustion either, so it stays |
There was a problem hiding this comment.
Keep the quota-failure rationale on the quota branch
When changing Kaggle gate failure policy, this comment now labels a survey_kernels exception as an unreadable quota and is truncated before explaining the resulting skip. The quota failure is handled by the preceding else, whereas this handler means concurrency could not be established; attaching the rationale here conflates two operational failures with different evidence.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not this PR. gate.py is byte identical between the merge base 31af9ab and this head, and the restructure you are reading came from #10121, which merged into main. The confusion is mine: this branch was cut at 1d2679f and 33 main commits have landed since, so a diff taken against that old base shows upstream work as if it were ours.
| # warn, measuring an environment Unsloth never claimed to support. | ||
| # One resolution with the zoo requirement present, so pip picks the newest release of each that zoo's |
There was a problem hiding this comment.
Reassemble the canary resolution explanation
When changing the experiment's dependency resolution, these two lines are reversed fragments of the original explanation: the first begins with the conclusion about pip warning, while the second ends before stating that a separate upgrade could violate Zoo's constraints. The resulting comments no longer explain why the canary installs ZOO and its upgrades in one resolution, making a future split into separate installs appear harmless.
Useful? React with 👍 / 👎.
9c4ba34 to
d6bbbdb
Compare
|
Triaged all 14 items: 12 genuine (thumbs up, each one a real relocation, inversion or truncation), 2 rejected. The two rejects are my fault rather than a bad review: this branch was cut at I am not going to fix the 12 and re-request review, because they are a sample rather than the population. Measuring the whole branch against the correct base:
A 6.4x increase while the total block count FELL, so it is not a volume artifact. 292 of the 448 changed files gained new fragments. A blind 30-block sample against base came back 20 damaged (67%, 95% CI roughly 49-81%): 10 fragments, 7 lost facts, 3 relocations. The mechanism is that the 120-column rule was enforced by truncating rather than rewrapping. Not one added comment line exceeds 120 characters, and the tail clause is simply gone. A second mechanism shifted rewritten headers onto neighbouring functions, which is where the inversions come from: in So this stays in draft. The right fix is to redo the trim from Unrelated, and worth its own PR: the failing "Build PR AppImage" check is not caused by this branch. |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
One conflict, in the remote-connection contract. main tightened the
assertion to the gate's new active={!isAuthFlowRoute} form and added a
note about the chat page hydrating its own settings; this branch had
only rewrapped the comment above it. Took main's assertion and its new
comment, kept the rewrap.
|
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". |
Twenty-five sites, and almost none of them were the trim's. Round nine was called "move the row and branch notes back onto what they describe", and it moved a good many onto things they do not describe: the xpu swap tests had the pinned-mirror rationale on the test that asserts the index is dropped, the cuda repair file had a whole run of rationales slid one test upward, and several notes were duplicated onto a neighbour rather than moved. Where a clause was already correct on its real anchor, the copy is deleted rather than parked somewhere new. Separately, this PR had been changing code, and the gate could not see it. Five files: three where a repair split a tuple across lines to make room for a restored trailing comment, two where the trim deleted a trailing comment and then joined up the wrapping that existed only to carry it. Parentheses and line breaks leave the parse tree untouched, so an AST comparison calls all of it comments. Every one is back to base byte for byte, with the comments that justified the wrapping restored. scripts/code_reflow.py is the check for it: same tokens in a different arrangement is a code change, whatever the AST says.
Both were split only to make room for a trailing comment. Round ten cut those comments back to what is true of the row, the expressions now fit, and the formatter joins them. Running it is not optional: pre-commit.ci was red on exactly these two.
One conflict, in the settings-tabs driver. main added the persisted monitor assertion and the section 2 banner above the tab loop; this branch had neither. Took main's side whole.
Five sites. Three were duplicates: the correct sentence still sits on the test it describes, and a repair pass left a second copy on a neighbour. Moving those would have been the fourth round of shuffling one clause between two tests, so the copies are simply gone. The mislabelling was the point in each case. An empty handover tag and an absent one are different precedence rules, and the PowerShell 7.5 parsing note had been copied from the empty-string test onto the one whose variable is unset. A non-zero-exit rationale sat on a parser test that asserts a successful exit. The other two are the trim's own: "#5854)," with its subject cut away, and a regex description that stopped before naming the self. prefix it matches, which is what explains the narrower filter below it.
Seven had moved one branch or one call down. The autocast one had landed on the case that forces float32 and asserts dtype float16, directly under a note saying there is no dtype at all; the JAX rationale sat on the USE_FLAX env-var case, whose module map has no jax in it; the kill-and-sentinel note sat on a test that only checks a GPU row regex. Each is back on the assert it describes, with a tenth found in the same file as the probe timeouts. Two are the trim's own. A mid-block deletion in the settings-tabs driver spliced two half sentences into "blocking a / error-handling regression and was a stale constant"; the macOS slot table lost the only statement of why macos-14 is absent from a set named for images GitHub still schedules. The retirement dates are restored, verified against all three workflows that carry them. The settings-tabs note is shorter than base on purpose. It now says the invariant, that blocking a panel must not collapse the dialog, and drops the tab count, which nothing asserts.
All twelve had slid onto an adjacent test or branch, and in each the displaced note contradicted what it now sat on. The CPU-backend note about a wheel being left alone had landed on the test asserting a repair runs; the XPU one about a dispatched shard sat on the single-device case; the redirect-body note sat in a test that never binds served; the draft-state refusal sat on the test where the target is present and the run returns 0. One lost text on the way as well: the missing-target rationale had been cut to its first two sentences, dropping the reason the draft and prerelease refusal above it would otherwise degrade into no check. Also a rewrap that duplicated its own tail instead of replacing it, so the merge-budget note read "else a sharded own device, not GPU0, else a sharded model OOMs".
Eight reports, six defects: two pairs described the same misplacement from either side. One was worse than misplaced. "A comment naming a probe is not a probe" had moved onto the metadata scan, whose predicate matches the raw line with no comment handling at all, so it claimed an exemption that scan does not implement. It belongs on the Test-Path scan, the only one that splits on # before matching. Moved, not reworded. The rest argued against the test they sat on. The lazy-trl note was on a stub with no __getattr__ to raise; the bogus-variant note was above a request sending a valid variant; the imported-TensorFlow note was on the case that supplies no tensorflow and asserts the flag is cleared; the 62-token rationale was on the test that asserts 12.
Seven had slid off their anchor, and in most the stray was also cut short, so the fix was to restore the whole sentence where it is true and delete the fragment. The torchao dependency reason sat on a test about re-verification rather than on the --no-deps assertion it justifies; the bitsandbytes heading sat on a test that fetches quantizers_utils.py; the no-selection latch note sat on the delete block, which asserts nothing reaches the action. Two are the trim's own truncations. The stand-aside rationale in the shortcut driver stopped at a colon, losing why Enter on a focused Deny button would otherwise be defaulted away into approve. The kwargs-union case stopped at a semicolon, and the trim had eaten the leading ** from **kwargs as well. One was about the driver rather than a test: the JSON note sat beside the final print, where it described the document, instead of on the stderr redirection that is what actually keeps stdout clean.
|
Codex Review: Didn't find any major issues. Bravo. 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". |
Nine sites. Most are the trim's own truncations: the dill fixture had lost the property that makes lookup by reference fail, so an otherwise unexplained __module__ = "builtins" sat there with no reason; the rope drift test had two clauses spliced into "every buffer keeps scaling in a buffer"; the playwright guard had lost the three command shapes it matches and why the regex is not anchored on an engine list. Three are a shape I had not seen. The reflow rewrote the `#:` variable documentation markers in the fast-copy constructs to `# :`, and dropped stray colons into the wrapped prose, leaving "text : node". Those markers are syntax, not punctuation to be tidied. One was misplacement rather than truncation. The dotted-import rationale had moved onto the second copy of its case and lost its tail, leaving a dangling "and" above a capitalised "Still caught" and the first row bare. Restored where base has it, stray deleted. lint_duplicate_definitions self-test still passes, 63 cases.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7fc2b7357
ℹ️ 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".
| # TODO: there are bad interactions across tests right now, need to figure out how to disable model caching before | ||
| # re-enabling this test |
There was a problem hiding this comment.
Keep the TODO with the disabled full-model test
This TODO previously explained why _test_full_model_fake_quantize is disabled by its leading underscore, but it now sits on test_lora_model_fake_quantize, which pytest actively collects. The phrase “re-enabling this test” therefore describes the wrong function and leaves the actually disabled test unexplained, making maintainers likely to disable or re-enable the wrong QAT coverage.
Useful? React with 👍 / 👎.
| # Let React process compositionstart and update isComposing. | ||
| page.wait_for_timeout(200) | ||
| send_btn_mac_enter = page.locator('button[aria-label="Send message"]') | ||
| # Switch TO Chinese: compositionstart fires but compositionend never arrives. |
There was a problem hiding this comment.
Put the IME-switch comment on the composition event
In the candidate-confirming Enter scenario, this comment now claims that the following call fires compositionstart, but that call actually dispatches a KeyboardEvent for Enter; the real CompositionEvent('compositionstart') is the preceding call. This also replaces the original explanation that Enter must be swallowed while composingRef is pinned, so the test's critical action is now mislabeled and its regression rationale is lost.
Useful? React with 👍 / 👎.
| # The short-circuit must not keep a version-matching install whose recorded digest is not the pin (old | ||
| # remote-SHASUMS install or a tampered artifact). |
There was a problem hiding this comment.
Keep the fallback rationale on the fallback test
This test does not cover the initial short-circuit: it deliberately lets the verified download fail and checks the transient-failure fallback. Moving the short-circuit comment here removes the original distinction that a same-version install with the wrong pinned digest must be rejected while a different usable version may still be retained for offline resilience, making the fallback policy appear stricter than the behavior the surrounding tests preserve.
Useful? React with 👍 / 👎.
| # Default and namespace forms bind a name too, and it is the same ReferenceError when the harness lacks it. | ||
| # chat-adapter.ts has none today, so this is for the first one somebody adds. |
There was a problem hiding this comment.
Keep the import-form note with the matching regex
This note describes default and namespace imports, but it now precedes the second loop, whose regex extracts named imports inside {...}; those forms are handled by the first loop immediately above. The original explanation for this second regex's optional default-import prefix was removed, so a future import-syntax update is directed to the wrong matcher and can leave the harness missing a runtime binding.
Useful? React with 👍 / 👎.
| @@ -697,6 +690,7 @@ class ClassifyCase: | |||
| "src: url(katex/dist/fonts/font.woff2);", | |||
| "css_url", | |||
| ), | |||
| # CSS url() unquoted variant must classify the same as the quoted one. | |||
There was a problem hiding this comment.
Keep the unquoted-URL rationale on the unquoted fixture
The comment says this case protects the unquoted url() variant, but it now sits on U45, whose input is explicitly quoted. U44 immediately above is the actual unquoted fixture and has lost this rationale, making U44 look redundant with U45 even though it covers a separate classifier form.
Useful? React with 👍 / 👎.
The trim slid several notes onto neighbouring tests, where they describe something they no longer sit on: - test_qat.py: the TODO moved off _test_full_model_fake_quantize, whose leading underscore is what keeps pytest from collecting it, onto a test that is collected and was never disabled. - playwright_chat_ime_i18n.py: 6f carried a stray copy of 6e's compositionstart note above an Enter KeyboardEvent, and had lost its own rationale for why Enter reports isComposing=false while composingRef is pinned. - test_install_node_prebuilt_logic.py: the short-circuit note landed on the transient-download-failure test, leaving the SHA-enforcement test bare and dropping the carve-out that a different usable version is still kept for offline resilience. - test_chat_autoload_failure_gate.py: the default/namespace note moved onto the named-import loop, and the mixed-form note explaining that regex's optional prefix was dropped. - test_frontend_dep_removal.py: the unquoted CSS url() note moved onto the quoted fixture, and the HTML package-name-boundary note moved off the script-src case onto the link-href case. Comments only; the gate reports code unchanged on all five files.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
Comment-only pass over 634 files: everything under
tests/outsidestudio/backend, the studiobench harness,scripts/,.github/scripts/andunsloth_cli.What changed
Removed: fixture narration, restatements of the adjacent line, section banners and setup description. No comment line exceeds 120 columns. Comments naming the regression an assertion guards are kept.
The CI and packaging helpers were treated conservatively
.github/scripts/andscripts/are close to the original. Their comments are mostly measured constraints and ordering hazards rather than description, and a sample of candidate deletions there came back 85% load-bearing, against 41-47% for the test directories. Examples kept:os.getpgid()raises once the child is waited onSafety
Nothing outside comments changes. No code, docstrings, string literals, licence headers or pragmas are touched. Verified with an AST code-only signature of every file against the base commit; all 634 report
code unchanged (comments only).