Commit e510e49
chore(scan,dsn): trim session cruft from comment-heavy files (#810)
## 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-ignore`s 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
- [x] `bunx tsc --noEmit` — clean
- [x] `bun run lint` — clean (1 pre-existing markdown warning)
- [x] `bun test --timeout 15000 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 pre-trim
numbers)
- [x] `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](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a8bceda commit e510e49
12 files changed
Lines changed: 306 additions & 1014 deletions
File tree
- script
- src/lib
- dsn
- init/tools
- scan
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
21 | 11 | | |
22 | 12 | | |
23 | 13 | | |
24 | 14 | | |
25 | 15 | | |
26 | 16 | | |
27 | 17 | | |
28 | | - | |
29 | 18 | | |
30 | 19 | | |
31 | 20 | | |
| |||
0 commit comments