Repository navigation
Condense module docstrings, keeping the guarantees they state - #15594
Merged
Merged
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. |
This was referenced Oct 30, 2026
danielhanchen
added a commit
that referenced
this pull request
Nov 9, 2026
…auri (#16109) Condenses the multi-line comments, docstrings and JSDoc / block comments that landed in the Studio frontend (`studio/frontend`) and the Tauri shell (`studio/src-tauri`) 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). 109 files, +343 / -582 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 - 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.
danielhanchen
added a commit
that referenced
this pull request
Nov 9, 2026
…nd CI (#16112) Condenses the multi-line comments, docstrings and JSDoc / block comments that landed in the installer helpers, scripts and CI (`studio/*.py`, `studio/scripts`, `scripts/`, `.github`, `docker`) 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). 50 files, +669 / -1,747 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 - 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.
danielhanchen
added a commit
that referenced
this pull request
Nov 9, 2026
Condenses the multi-line comments, docstrings and JSDoc / block comments that landed in the Studio backend (`studio/backend`) 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). 922 files, +5,663 / -11,400 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 - 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.
danielhanchen
added a commit
that referenced
this pull request
Nov 9, 2026
…16111) 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The earlier comment-trim PRs skipped every module (top-of-file) docstring outside tests. This condenses 556 of them across
studio/backend,unsloth,unsloth_cli,scriptsand the top-levelstudio/*.pyhelpers, from 5,673 lines to 959. Nothing else changes.Each docstring keeps what the module is for plus the rules other code relies on: fail-open or best-effort behaviour, import-time safety ("stdlib only, safe to import early"), compatibility promises, route lists, security reasons, ordering rules. For example
studio/backend/routes/llama.pynow readsllama.cpp prebuilt update routes: GET /api/llama/update-status, GET /api/llama/update-changelog, POST /api/llama/update; fail open; old top-level fields keep shape so older clients work; whisper and audio.cpp chain as phases.Help text and anything that reads a docstring is left alone
A module docstring was only touched when an AST pass over every Python file in the repo (nothing imported) found no way for it to be read:
__doc__(description=__doc__,print(__doc__),globals(),sys.modules[__name__]);<module>.__doc__through its imports, and no file that imports the module reads.__doc__on a base that cannot be resolved;inspect.getdoc,inspect.getcomments,pydocorhelp(), or the whole module toinspect.getsource;__doc__throughgetattr/varswhile naming the module;80 modules failed one of these and are unchanged, including every
scripts/file whose argparse help isdescription=__doc__,studio/install_python_stack.py, and modules that tests read whole withinspect.getsource(core/inference/diffusion.py,llama_cpp.py,video.py, ...).How it was checked
main(every other statement, docstring and string literal is byte-identical), and the file is on the safe list.comment_tools.py check --strict-ext --allow-docstring-editspasses on all 556 files.main:unsloth --helpand all 40 subcommand help pages, pluspython <file> --helpfor all 65 scripts with an argparse/click/typer parser and a__main__block. Two scripts cannot print help in this environment on either side (kv_cache_multiturn_benchmark.pyneeds a GPU to import,kernel_install.pymust run as a module);python -m utils.kernel_install --helpis identical on both, and the benchmark's parser has no description.mainvs this branch on the same commit: every backend test file that reads source text, docstrings or line numbers (905 files:read_text,open(,getsource,linecache,lineno,__doc__,get_docstring,ast.parse,tokenize), the full root andunsloth_clisuites, and every frontend test that reads a.pyfile. Failing IDs matchmain; the few one-off differences pass 3/3 alone on both sides.