Skip to content

Trim comments in tests - #13844

Merged
danielhanchen merged 2 commits into
mainfrom
trim-comments-tests
Oct 15, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
trim-comments-tests

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Trims verbose and obvious comments and docstrings in test files only. This is the test-only part of #12968, split out so it can merge first: nothing here ships to users, and the only way a test-comment change can break anything is by failing a test.

Scope

Area Files
tests/studio 532
tests/python 120
tests/sh 86
tests/saving 48
tests/kaggle 47
tests/security 29
unsloth_cli/tests 27
tests/utils 27
tests/version_compat 25
other tests/ dirs, unsloth/kernels/moe/tests 116
scripts/av_shapes_baseline.json 1

1258 files changed, 13,739 insertions, 76,389 deletions.

The one non-test file is scripts/av_shapes_baseline.json: it drops the AV003 entry for tests/python/test_windows_installer_resolver_fallback.py, whose shortened docstring no longer names the construct the entry allowed. Without it lint_av_shapes.py reports a stale baseline entry.

How it was checked

  • comment_tools.py check --changed --strict-ext --allow-docstring-edits against main: 1257/1257 files OK, so code is unchanged in every file and only comments and docstrings differ.
  • Source-reading tests: a scan for string literals that tests and patchers search for (indexOf, in, .find, regex fragments) that were present in a changed file on main and are gone here. Every hit was traced; none reads the changed text.
  • scripts/lint_av_shapes.py: 0 new errors; self-test ok.
  • codespell (same flags as Lint CI): no new hits compared with main.
  • Tests, run on main and on this branch at the same commit, failing test IDs compared:
Suite main This branch
tests/ + unsloth_cli/tests (full, -n 16) 39,502 passed, 1,190 failed 39,508 passed, 1,185 failed
tests/sh/*.sh 94 run, 0 failed 94 run, 0 failed
tests/**/*.ps1 40 run, 0 failed 40 run, 0 failed
Backend tests that read tests/ files 1,216 passed 1,216 passed
Frontend tests that read tests/ files 199 passed 199 passed

The root failures on both sides come from optional packages missing on the test host and are the same IDs, with one exception: tests/test_nf4_triton_gemv.py::test_small_decode_batches_skip_the_dequantize[2] failed on this branch only in the parallel run. It is a GPU Triton test, other tests in the same file fail on main in that run too, and it passes 3/3 run alone on both sides. Its file changes only in comments (checked above). The MoE kernel tests under unsloth/kernels/moe/tests need a GPU and were not run; the comment check covers them.

Comment accuracy was reviewed as part of #12968: every shortened comment was compared with the original text, and lines that lost or changed meaning were corrected before the split.

#12968 keeps the non-test part (unsloth/, unsloth_cli/). Once this merges, the same test changes are already on main, so #12968 shrinks to that part with no conflicts from these files.

Comment and docstring changes only, in test files. Taken from #12968 so the test-only part can merge on its own.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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 ⚠️ Failed 2026-10-15T12:14:08.902570Z ec8c734 PR opened
🔒 Security Review ⚠️ Failed 2026-10-15T12:14:10.375448Z ec8c734 PR opened
ℹ️ 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
danielhanchen merged commit 50b9dea into main Oct 15, 2026
@danielhanchen
danielhanchen deleted the trim-comments-tests branch October 15, 2026 12:30
Etherll added a commit to Etherll/unsloth that referenced this pull request Oct 15, 2026
Conflicts were main's test comment trim (unslothai#13844) against this PR's test
changes, plus the bundle budget. Each test keeps this PR's code with main's
shorter comments and docstrings; the budget keeps main's unslothai#13812/unslothai#13446 notes
and adds this PR's measured growth against 50b9dea (+1,475 B raw / +279 B
transfer) on top of main's limits.
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Oct 22, 2026
Trims verbose and obvious comments in the Studio frontend tests only.
This is the test-only part of unslothai#12966, split out so it can merge first,
like unslothai#13844: nothing here ships to users, and the only way a
test-comment change can break anything is by failing a test.

## Scope

786 files, all under `studio/frontend/tests` (745 test files, 37
helpers, 4 fixtures). 3,033 insertions, 18,719 deletions. No source file
outside `studio/frontend/tests` changes.

## How it was checked

- `comment_tools.py check --changed --strict-ext` against `main`:
786/786 files OK, so code is unchanged in every file and only comments
differ.
- Source-reading tests: a scan for string literals that tests and
patchers search for (`indexOf`, `includes`, `in`, `.find`, regex
fragments) that were present in a changed file on `main` and are gone
here. Every hit was traced; none of the reading files opens a changed
test file.
- `scripts/lint_av_shapes.py`: 0 new errors.
- codespell (same flags as Lint CI): no new hits compared with `main`.
- Tests, run on `main` and on this branch at the same commit, failing
test IDs compared:

| Suite | `main` | This branch |
|---|---|---|
| Frontend (`node --test tests/**/*.test.ts`) | 12,402 passed, 0 failed
| 12,402 passed, 0 failed |
| Root Python tests that read `studio/frontend/tests` files | 208 passed
| 208 passed |
| Backend Python tests that read `studio/frontend/tests` files | 95
passed | 95 passed |

Comment accuracy was reviewed as part of unslothai#12966: every shortened comment
was compared with the original text, and lines that lost or changed
meaning were corrected before the split.

unslothai#12966 keeps the shipped frontend and Tauri part. Once this merges, the
same test changes are already on `main`, so unslothai#12966 shrinks to that part
with no conflicts from these files.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Oct 22, 2026
Trims verbose and obvious comments and docstrings in the Studio backend
tests only. This is the test-only part of unslothai#12967, split out so it can
merge first, like unslothai#13844 and unslothai#13859: nothing here ships to users, and
the only way a test-comment change can break anything is by failing a
test.

## Scope

1,220 files: 1,207 under `studio/backend/tests` and 13 under
`studio/backend/hub/tests`. 13,767 insertions, 70,284 deletions. No
source file outside those test directories changes.

`studio/backend/hub/tests/test_model_services.py` is left out: `main`
edited it after unslothai#12967 was last verified, so it stays in unslothai#12967.

## How it was checked

- `comment_tools.py check --changed --strict-ext
--allow-docstring-edits` against `main`: 1220/1220 files OK, so code is
unchanged in every file and only comments and docstrings differ.
- Source-reading tests: a scan for string literals that tests and
patchers search for (`.find`, `in`, `indexOf`, regex fragments) that
were present in a changed file on `main` and are gone here. Every hit
was traced; none of the reading files opens a changed test file.
- `scripts/lint_av_shapes.py`: 0 new errors.
- codespell (same flags as Lint CI): no new hits compared with `main`.
- Tests, run on `main` and on this branch at the same commit (CPU only,
so GPU tests skip identically on both), failing test IDs compared:

| Suite | `main` | This branch |
|---|---|---|
| `studio/backend/tests` + `hub/tests` (full, `-n 16`) | 72,832 passed,
732 failed | 72,841 passed, 723 failed |
| Root tests that read backend test files | 163 passed | 163 passed |
| Frontend tests that read backend test files | 61 passed | 61 passed |

No test fails on this branch that does not also fail on `main`. The
failures on both sides come from optional packages missing on the test
host and GPU tests with no GPU; the 9 extra passes on this branch are
timing-sensitive sandbox and tool-streaming tests that failed on the
`main` run only.

After `main` moved during that run, it was merged into this branch
(`main` wins on overlapping lines). The 11 test files `main` had touched
were re-checked against the new `main`: comment check 11/11 OK, and
those files give 2,072 passed with the same 5 failures on both sides.

Comment accuracy was reviewed as part of unslothai#12967: every shortened comment
was compared with the original text, and lines that lost or changed
meaning were corrected before the split.

unslothai#12967 keeps the shipped backend part. Once this merges, the same test
changes are already on `main`, so unslothai#12967 shrinks to that part with no
conflicts from these files.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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