Skip to content

Condense comments added since the last cleanup: core, CLI and tests - #16111

Merged
danielhanchen merged 12 commits into
mainfrom
trim-comments-r2-core
Nov 9, 2026
Merged

danielhanchen merged 12 commits into
mainfrom
trim-comments-r2-core

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Condenses the multi-line comments, docstrings and JSDoc / block comments that landed in the core package (unsloth/), the CLI (unsloth_cli/) and tests/ after the last cleanup (#12966, #12967, #12968, #12969, #15333, #15594). Same rules as before: every fact a reader needs stays (the reason for a workaround, version bounds, shapes and dtypes, env vars and flags, issue numbers, must / never rules, ordering and security reasons); narration, step-by-step restatement and history go. Informative one-line comments are not touched.

No code changes: every changed file has an identical code token stream (and, for Python, an identical AST once docstrings are removed).

437 files, +2,397 / -4,483 lines.

Scope

Only sections of 2+ lines whose lines were mostly written after the last cleanup merged. A rewrite is applied only when it saves at least one line, so tight comments are left as they are.

Left untouched:

  • section delimiters, license / SPDX headers, tool directives (noqa, type: ignore, eslint-disable, @ts-expect-error, biome-ignore, shellcheck, #region, ...), PowerShell comment-based help, JSX {/* */} comments
  • Python docstrings that can be read at runtime (decorated routes / tools / commands, pydantic models, classes outside tests, anything in a file that reads __doc__; module docstrings only where a reader analysis over the whole repo found no reader)
  • scripts that read their own text back ($0 / BASH_SOURCE / $PSCommandPath / __file__)
  • any comment containing a string literal that a test or source-reading script searches for, in a file that reader names (including escaped multi-line literals)
  • any comment inside a span that a frontend test regex matches in the source it reads
  • the line scripts/lint_av_shapes.py keys its baseline on
  • the derivation, diagram and tuning-table comments in unsloth/kernels (the cross entropy loss math, num_warps tables, fitted fused-vs-dense thresholds, GEMV config notes)
  • helpers that exist in more than one file (the shared install.ps1 / studio/setup.ps1 functions, a few Python helpers): every copy keeps the same comments, since tests compare the copies as text

Verification

  • comment_tools.py check --strict-ext --allow-docstring-edits passes on every changed file (code tokens identical, all languages).
  • Delimiter and tool-directive comment sequences are identical in every changed file.
  • scripts/lint_*.py (av_shapes, exec_literals, risky_loaders, workflow_triggers, no_parallel_clamp, no_duplicate_ts_imports, duplicate_definitions, backend_python_floor) and ruff check give the same result on main and on this branch.
  • CLI help: every --help surface (41 unsloth CLI commands, 40 scripts with a parser) is byte-identical to main.
  • Tests (no GPU), main vs all five round-2 branches together, compared by failing test ID: Studio backend tests that read source text (69,853 tests), root and unsloth_cli tests that read source text (41,578 tests), and every frontend node test (14,542 tests). No test fails only on the branch once ordering effects are rerun alone; the real readers this and staging CI turned up (a sidebar layout regex, the av_shapes baseline line, and the test that compares the install.ps1 / studio/setup.ps1 helpers) are handled by keeping those comments verbatim. Functions that were identical across files on main (PowerShell, shell, Python) are still identical on the branches.
  • PowerShell and shell tests that name install.ps1, studio/setup.ps1 or the changed shell test (64 files, run with pwsh / bash): all pass on main and on the branches.
  • Each rewrite was reviewed for meaning lost or claims added, removals in files that other files read were checked for readers, and proposed corrections went through a second check; anything flagged without a confirmed correction keeps its original text.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T11:36:04.476696Z
We couldn’t complete this review. Comment @codex review to try again.
60b5d9f 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.

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