Skip to content

Trim comments in studio/backend/tests - #10111

Closed
danielhanchen wants to merge 1 commit into
mainfrom
comment-trim-backend-tests
Closed

danielhanchen wants to merge 1 commit into
mainfrom
comment-trim-backend-tests

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Comment-only pass over the 646 test modules under studio/backend/tests.

before after change
comment lines 29,585 14,887 -49.7%
comment characters 2,142,898 1,137,954 -46.9%

What changed

Removed: restatements of the adjacent line, section banners, spacer lines, type and signature echoes, and fixture narration describing setup that the fixture already shows. Multi-line rationale paragraphs are collapsed to a single claim. No comment line exceeds 120 columns.

Kept: comments naming the regression an assertion guards, and the measured values the fixtures depend on, including the glibc 2.39 strchr behaviour, the b10342/b10360 --help output, published Hub sizes, and the llama_cpp.py line citations the fixtures mirror.

Safety

Nothing outside comments changes. No code, docstrings, string literals, licence headers or pragmas (# noqa, # type: ignore, # pragma: no cover, # fmt:) are touched.

This is verified mechanically rather than by inspection: an AST code-only signature of every file is compared against the base commit, and the check fails closed on any parse or IO error. All 646 files report code unchanged (comments only).

On the size of the cut

An earlier revision of this pass reached 72% by deleting anything that carried no citation or regression keyword. Sampling what that filter discarded showed most of it was load-bearing, so 3,294 of 3,435 deleted blocks were restored. The number here is what survives a keep test applied per block rather than by keyword.

Comment-only pass over the 646 test modules under studio/backend/tests.
Removes restatements of the adjacent line, section banners, spacer lines
and fixture narration, and collapses multi-line rationale paragraphs to a
single claim.

29,585 -> 14,887 comment lines (-49.7%)
2,142,898 -> 1,137,954 comment characters (-46.9%)

No comment line exceeds 120 columns.

Nothing outside comments changes: no code, docstrings, string literals,
licence headers or pragmas. Verified mechanically, an AST code-only
signature of every file is unchanged against the base commit.

Comments naming the regression an assertion guards are kept, as are the
measured values the fixtures depend on (glibc 2.39 strchr behaviour, the
b10342/b10360 --help output, published Hub sizes) and the llama_cpp.py
line citations the fixtures mirror.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 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-01T01:56:26.109428Z 6af41ec 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 marked this pull request as draft September 1, 2026 03:05
@danielhanchen

Copy link
Copy Markdown
Member Author

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:

  • write_bytes truncates first, so one shared directory lets a concurrent leg clobber another
  • n_tokens = 4096 and token_id=128009 survive redaction, which is the assertion's whole point
  • the mirror to /api/chat/settings is a 400ms debounce
  • token caches under $HF_HOME, ~/.netrc and XDG config are dropped from the child environment

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.

@danielhanchen

Copy link
Copy Markdown
Member Author

Closing this one rather than repairing it.

The fact-restoration pass was run over the studio/backend/tests files and the result does not justify a PR. Measured against the base commit, a hand-judged sample of 100 changed comment blocks came out 48 correct. The failure is consistent: the first clause survived and carried the identifier, so every automated check passed, while the clause that made it mean something was gone.

BASE: 80 GB card (30 GB free -> 25.9 GB usable) vs 32 GB card (29 GB free -> 27.4 GB usable). A 27 GB
      model fits the 32 GB card alone; raw-free ranking would try the 80 GB card first.
NOW : 80 GB card (30 GB free -> 25.9 GB usable) vs 32 GB card (29 GB free -> 27.4 GB usable).

BASE: predicted_tokens_seconds stuck at a stale nonzero value while nothing decodes. A rate-based check would miss this.
NOW : predicted_tokens_seconds stuck at a stale nonzero value while nothing decodes.

BASE: `[},]` puts a stray `}` at the primitive position inside a list body. On the buggy parser this hangs
      the server; guard with a wall-clock timeout so the regression fails loudly instead of blocking CI forever.
NOW : `[},]` puts a stray `}` at the primitive position inside a list body.

Repairing this means restoring the baseline comment at roughly 3,900 sites across 290 of the 374 files, which lands the change at approximately zero net reduction with churn in nearly every file. A no-op PR that rewraps 290 files is worse than no PR.

The underlying reason is a property of this directory rather than a mistake in one pass: these are regression tests whose comments are usually the only record of the bug each test pins, so the long ones are load-bearing at a high rate and there is little safe reduction available.

One defensible subset does exist if it is ever wanted: about 141 leading-imperative fixture-narration blocks (Seed ..., Drive ..., Stub ...) that carry nothing load-bearing, worth roughly 15,000 characters. That is a 1.4% reduction and not worth a PR on its own.

Superseded by nothing. studio/backend/tests is left as it is on main.

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