Skip to content

chore(scan,dsn): trim session cruft from comment-heavy files#810

Merged
BYK merged 1 commit intomainfrom
byk/chore/trim-session-cruft
Apr 22, 2026
Merged

chore(scan,dsn): trim session cruft from comment-heavy files#810
BYK merged 1 commit intomainfrom
byk/chore/trim-session-cruft

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 22, 2026

Summary

Cleanup pass over the scan/ and dsn/ modules after the grep + worker-pool stack (#791, #804, #805, #807, #797) landed. Removed comment bloat accumulated across the 6+ review cycles those PRs went through — redundant bug-history narration, repeated explanations of ref/unref boolean semantics, "pre-PR-N" references, and other scars that wouldn't survive a fresh-eyes read.

Net −708 LOC across 12 files. No behavior changes.

Per-file reductions

File Before After Δ
src/lib/scan/worker-pool.ts 466 312 −33%
src/lib/scan/grep.ts 985 712 −28%
src/lib/dsn/code-scanner.ts 541 377 −30%
src/lib/scan/grep-worker.js 153 114 −25%
src/lib/dsn/scan-options.ts 70 52 −26%
src/lib/init/tools/grep.ts 122 98 −20%
src/lib/init/tools/glob.ts 74 59 −20%

Plus minor trims in types.ts, walker.ts, path-utils.ts, scan/glob.ts, and script/text-import-plugin.ts.

What was removed

  • Redundant explanations of Worker.ref() / .unref() boolean semantics (stated 3× in worker-pool.ts — kept once, on the primary ref/unref helper pair).
  • Multi-paragraph "earlier iteration did X, deadlocked, so we now do Y" histories — kept in git log where they belong.
  • "pre-PR-3" / "pre-refactor" / "previous version" narration that explained how code used to look before the current session's work.
  • File-header docstrings that repeated what the module structure and exports already told you.
  • Rationale comments for biome-ignores that were already justified by adjacent context.

What was kept

  • Every biome-ignore comment (all still justified).
  • Every "why" comment tied to a real gotcha (e.g., the length-change warning on case-insensitive literal prefilters, the /g flag cloning rationale, the pipeline-failure detector explanation).
  • Every JSDoc on exported functions and types.
  • All inline comments that explain non-obvious constraints (sandbox enforcement, cache-contract stability, etc.).

Test plan

  • bunx tsc --noEmit — clean
  • bun run lint — clean (1 pre-existing markdown warning)
  • bun test --timeout 15000 test/lib test/commands test/types5641 pass, 0 fail
  • bun test test/isolated — 138 pass
  • bun run bench --size large --runs 3 — no perf regression (scan.grepFiles 167ms, scanCodeForDsns 232ms — matching pre-trim numbers)
  • bun run build --single — binary builds and exits cleanly on sentry project view from empty dir (3 consecutive runs, all exit=1)

🤖 Generated with Claude Code

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

Cleanup pass over the scan + DSN modules after the grep/worker-pool
stack (#791, #804, #805, #807, #797) landed. Removed comment bloat
accumulated across the 6+ review cycles those PRs went through —
redundant bug-history narration, repeated explanations of ref/unref
semantics, "pre-PR-N" references, and other scars that wouldn't
survive a fresh-eyes read.

Net -708 LOC across 12 files, no behavior changes.

Per-file reductions:
- `src/lib/scan/worker-pool.ts`: 466 → 312 (-33%)
- `src/lib/scan/grep.ts`: 985 → 712 (-28%)
- `src/lib/dsn/code-scanner.ts`: 541 → 377 (-30%)
- `src/lib/scan/grep-worker.js`: 153 → 114 (-25%)
- `src/lib/dsn/scan-options.ts`: 70 → 52 (-26%)
- `src/lib/init/tools/grep.ts`: 122 → 98 (-20%)
- `src/lib/init/tools/glob.ts`: 74 → 59 (-20%)

Plus minor trims in `types.ts`, `walker.ts`, `path-utils.ts`,
`scan/glob.ts`, and `script/text-import-plugin.ts`.

## Test plan

- [x] `bunx tsc --noEmit` — clean
- [x] `bun run lint` — clean
- [x] `bun test test/lib test/commands test/types` — 5641 pass, 0 fail
- [x] `bun test test/isolated` — 138 pass
- [x] `bun run bench --size large --runs 3` — no perf regression
      (scan.grepFiles 167ms, scanCodeForDsns 232ms, matching the
      pre-trim numbers)
- [x] `bun run build --single` — binary builds and exits cleanly
@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-810/

Built to branch gh-pages at 2026-04-22 09:39 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

138 passed | Total: 138 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 27.78%. Project has 1943 uncovered lines.
✅ Project coverage is 95.21%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/lib/scan/grep.ts 0.00% ⚠️ 12 Missing
src/lib/scan/worker-pool.ts 66.67% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.04%    95.21%    +0.17%
==========================================
  Files          282       282         —
  Lines        40661     40577       -84
  Branches         0         0         —
==========================================
+ Hits         38646     38634       -12
- Misses        2015      1943       -72
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK merged commit e510e49 into main Apr 22, 2026
24 checks passed
@BYK BYK deleted the byk/chore/trim-session-cruft branch April 22, 2026 09:46
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