Repository navigation
refactor: delete scripts/ and the duplicate lib/linemap.ts - #315
Merged
Merged
Conversation
Owner
Author
nownabe
added a commit
that referenced
this pull request
Sep 20, 2026
…317) ## Why `bun run typecheck` is red on `main` since #310 merged: it added `setIssueThreadResolved` to the `Transport` interface, while `tests/AppSubmitFailure.test.tsx` (added by #307, which branched before #310) still builds two `Transport` mocks without it. Every open PR's CI inherits the failure. ## What Add a `setIssueThreadResolved` stub (`{ ok: true }`) to `failingTransport()` and `happyTransport()` in `tests/AppSubmitFailure.test.tsx`. No behaviour change; the five tests in that file still pass. Checks: `typecheck` clean, `test tests/AppSubmitFailure.test.tsx` 5 pass, `check:lint` and `check:format` clean. Merge this first so the CI of #315 and the other open PRs goes green.
nownabe
force-pushed
the
refactor/297-delete-scripts-linemap
branch
from
September 20, 2026 06:34
4c99277 to
1848277
Compare
These three scripts were never wired into package.json, CI or docs, and their assertions are already covered by tests/suggest.test.ts, tests/github.test.ts and tests/pr/metadata.test.ts. Keeping them only invites drift against the modules they poke at.
lib/linemap.ts was a second LCS line map with the same contract as lib/pr/linemap.ts; production only ever imported the latter, so the copy was reachable from its own test alone. Two implementations of the same contract can silently diverge, and the trailing-newline convention lib/anchor.buildLineIndex depends on is exactly the kind of thing that drifts. The port of that convention test now asserts the trailing empty line maps too, so it actually fails if the split convention changes.
nownabe
force-pushed
the
refactor/297-delete-scripts-linemap
branch
from
September 20, 2026 07:02
1848277 to
92dc2c2
Compare
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.
Why
Two pieces of the tree had no consumers and only cost maintenance:
scripts/check-metadata.ts,scripts/check-suggest.ts,scripts/check-suggestion.tswere manual one-off checks never wired intopackage.json, CI or docs. What they assert is already covered bytests/suggest.test.ts,tests/github.test.tsandtests/pr/metadata.test.ts, so they could only drift against the modules they poke at (two of them still import the v1 codec slated for removal in [Refactor] Remove the dead resolve-event path and the v1 metadata codec #298).lib/linemap.tswas a second LCSbuildLineMapwith the same contract aslib/pr/linemap.ts. Production imports onlylib/pr/linemap(vialib/pr/reanchor.tsandlib/suggest.ts); the copy was reachable from its own test alone. Two implementations of one contract silently diverge — and the trailing-newline convention thatlib/anchor.buildLineIndexdepends on is exactly the kind of thing that drifts.What
git rm -r scripts/(144 lines).lib/linemap.ts+tests/linemap.test.ts(104 lines), after porting the trailing-newline convention case intotests/pr/linemap.test.ts.biome-ignorecomment inlib/pr/linemap.ts— the repo lints with oxlint, so it directed nothing.249 lines removed, 9 added.
Deletion safety
Grepped the whole tree (excluding
node_modules/.git) forscripts/check,check-metadata,check-suggest,check-suggestion: three hits, all inside the scripts' own// Run:header comments.package.json,.github/workflows/*,README.md,AGENTS.mdanddocs/have none. Importers of the top-levellib/linemap: exactlytests/linemap.test.ts:2. There is no@/libalias and nolib/index.tsbarrel, so no indirect path existed.Test evidence
The ported case as written in
tests/linemap.test.ts:47-52passes againstlib/pr/linemap.tsunchanged — both implementations split on"\n"identically. That makes it a green-on-arrival test, so I checked it actually has teeth by mutatinglib/pr/linemap.tsto strip a trailing newline before splitting:The original assertions (
a → 2,b → 3) survived that mutation untouched — they never tested the convention. The ported test therefore also asserts that the trailing empty line maps (map.get(3) === 4), which is the assertion that fails when the convention changes. Mutation reverted; suite green.Checks
bun run test689 pass / 0 fail (61 files, down from 695/62 — the 6 dropped are the deletedtests/linemap.test.ts),check:lintclean,check:formatclean,bun run buildOK.bun run typecheckfails ontests/AppSubmitFailure.test.tsx:81,105(Property 'setIssueThreadResolved' is missing ... in type 'Transport'). This is pre-existing onmainat 7e0ecb9 and unrelated to this PR: that file was last touched by #307 and #310 later addedsetIssueThreadResolvedtoTransportwithout updating its two mock transports. This PR touches neither file. It needs its own fix.Closes #297