refactor: prune narration and history comments#19559

merged11
main
refactor/prune-comments
opened10d agobyMmaria
View on GitHubTwo-way sync enabledPR last imported 4d ago

Which version did the judges prefer? With comments 21, without comments 18, no difference 21, out of 60 blind verdicts.

Quality score by judge model, with vs without comments: Claude Opus 5.5 8.0 vs 7.9, GPT-6.1-Sol 8.5 vs 8.7, GPT-6-Astra 8.3 vs 8.5.

Same work, same cost: checks passed 85% vs 95%, tokens 857k vs 844k, files read 7.9 vs 8.1, minutes 3.2 vs 3.0.

Removes comments that repeat the code, document the obvious, or record history, in source and tests. Agents copy these into new files, where they go stale. A comment stays only when someone reading the code would likely break something without it: a security check, a race, a provider or OS quirk, or an invariant another file relies on. Lint directives, knip tags, and suppression reasons stay. Comment lines in the touched files drop from 63,684 to 18,432. Outside the lint rule below, code is unchanged: every pruned file parses to the same syntax tree as main.

A new t3code/no-low-value-comments lint rule keeps the mechanical cases out: section dividers, Arrange/Act/Assert labels, TODOs without an issue link, JSDoc types in TypeScript, empty @param/@returns tags, commented-out code, and comments that only repeat the name below them. AGENTS.md now tells agents that comments say why.

To check the effect on agents, gpt-6.1-sol did the same 10 tasks on main and on an earlier cut of this branch. 6 judges compared each pair without knowing which was which. 21 verdicts favored main, 18 favored the branch, and 21 were ties. Tokens, files read, and time stayed within 6%. The bench has not been rerun on this cut.

Done by claude-opus-5-5 (Claude Code) coordinating gpt-6.1-sol (Codex) subagents.

Checks

All checks passed
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The PR is largely a mechanical comment cleanup with a development-only lint rule and no apparent product behavior changes. Its mobile fingerprint inputs nevertheless trigger the repository's native-change flow, which can block production OTA delivery until a new store build ships.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB4.9 KiB−30 B (−0.6%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB−30 B (−2.5%)2.0 KiB✅
CodexLive turn WebSocket decoded20.9 KiB20.8 KiB−41 B (−0.2%)29.3 KiB✅
CodexLive turn messages21−1 (−50.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB+31 B (+0.6%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB+31 B (+2.6%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB+41 B (+0.2%)29.3 KiB✅
ClaudeLive turn messages12+1 (+100.0%)8✅

Baseline: ba35822 · PR result: 391c8d3 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Added 4 commits

  • refactor: prune comments that restate code2f302bb
  • refactor: drop comments that don't explain a constraint3e7e430
  • fix: keep jsdoc types in widget asset catalog pluginc4eb580
  • Merge remote-tracking branch 'origin/main' into refactor/prune-commentsd55e4eb

Added 2 commits

  • Merge remote-tracking branch 'origin/main' into refactor/prune-commentsc0a7aba
  • Merge remote-tracking branch 'origin/main' into refactor/prune-comments560fdb1

Note

Written by claude-opus-5-5 on behalf of Maria

The frozen-lockfile change in scripts/setup-worktree.ts comes from main (#19747) via the merge. Against main, this PR only removes the doc comment in that file. Every changed file has the same syntax tree as main once comments are stripped, so this PR changes no runtime code.

Added 2 commits

  • feat(lint): reject comments that restate code, divide sections, or narrate tests81dc047
  • Merge remote-tracking branch 'origin/main' into refactor/prune-comments1f731fb
oxlint-plugin-t3code/rules/no-low-value-comments.tsline 11Outdated · 81dc047Open thread
……@@ -0,0 +1,118 @@
8+const TASK_MARKER_PATTERN = /\b(?:TODO|FIXME|XXX|HACK)\b/u;
9+const TASK_LINK_PATTERN = /#\d+|https?:\/\//u;
10+const JSDOC_TYPE_PATTERN = /^@(?:param|returns?|type|typedef)\s+\{/u;
11+const EMPTY_JSDOC_TAG_PATTERN = /^@(?:param|returns?)(?:\s+\[?[\w$.]+\]?)?$/u;
MmacroscopeappBoton line 119d ago

🟡 Medium rules/no-low-value-comments.ts:11

A one-word return description such as @returns milliseconds is reported as an empty JSDoc tag, so meaningful documentation is rejected. The pattern allows an optional word after both @param and @returns; only parameter tags have a name to skip. Match an optional name only for @param, and match @returns only when it has no following text.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
text
1In file @oxlint-plugin-t3code/rules/no-low-value-comments.ts around line 11:
2
3A one-word return description such as `@returns milliseconds` is reported as an empty JSDoc tag, so meaningful documentation is rejected. The pattern allows an optional word after both `@param` and `@returns`; only parameter tags have a name to skip. Match an optional name only for `@param`, and match `@returns` only when it has no following text.

Note

Written by claude-opus-5-5 on behalf of Maria

Fixed in 56df2bd07c: only @param skips a name now, so @returns milliseconds passes and a bare @returns is still flagged.

Added 1 commit

  • fix(lint): allow one-word @returns descriptions56df2bd

Added 2 commits

  • Merge remote-tracking branch 'origin/main' into refactor/prune-comments8a65ca8
  • Merge remote-tracking branch 'origin/main' into refactor/prune-comments391c8d3