Skip to content

refactor: sweep tombstone comments, dead CSS and no-consumer leftovers - #353

Merged
nownabe merged 1 commit into
mainfrom
refactor/301-sweep
Sep 20, 2026
Merged

nownabe merged 1 commit into
mainfrom
refactor/301-sweep

Conversation

@nownabe

@nownabe nownabe commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Why

Comments that say where code used to live, or that name a refactor-plan phase
(Pack B / R8b, L7e-1, Phase 4), send the reader looking for something that
either moved or was never in this repo. CSS rules with no markup and exports with
no importer cost the same kind of lookup. Two of them were worse than noise: the
pr:{owner}/{repo}#{n} key prefix and the UTF-8 base64 decoder each had two
independent definitions that could silently drift.

Net -130 lines (135 insertions / 265 deletions) across 29 files, plus one
deleted file. No behaviour change.

What

1. Tombstone / phase-tag comments. Re-located by content (the issue's line
numbers are from before #303–#350). Rewritten to say what the code is, or deleted
where the comment only described history: App.tsx (a garbled half-sentence, six
"now lives in …" markers, and the L5 / L6c / L6d-1 / L7e-1 / R3 / R6
tags), the five hooks/ headers, both adapters/ headers plus
displayPositionToAnchorStatus.ts, highlight.ts, suggestionView.ts,
lib/drafts.ts, lib/comments.ts, lib/pr/repository.ts. lib/storage.ts's
header advertised an IndexedDB layer that does not exist — it now says
chrome.storage.local and points at ADR 0001 §2. Real "why not" sentences (the
reviewer note on thread visibility, the canAccept rationale, every simplify:
and issue-numbered note) are untouched.

2. Dead CSS. Deleted .field--mono, .badge--review, .badge--suggestion,
.badge--anchored, .composer__routing, .radio-row (+ .radio-row label)
after an exact-token search over entrypoints/, lib/, tests/ found no
producer. .badge--anchored is unreachable by construction as well: ThreadItem
builds badge--${status} from AnchorStatus (current | reanchored |
outdated), gated on STATUS_LABEL[status], which only defines reanchored and
outdated. docs/design-principle.md no longer lists .field--mono.

3. No-consumer leftovers.

  • Deleted the empty root components/ directory (nothing in wxt.config.ts,
    tsconfig.json or the docs configures a root components dir; the real one is
    entrypoints/review/components/).
  • Dropped useUiPanels.closePrInfo (only the hook's own test called it).
  • Un-exported APP_SLUG, SubmitCommitGroup, SubmitSummary — all used only in
    their defining module. SubmitGroup stays exported: SubmitConfirmModal imports it.
  • prStorageKey / prStorageKeys now build on storageKeys.pr, the same prefix
    lib/drafts.ts builds, so fix(storage): bound chrome.storage.local growth and stop quota errors losing drafts #332's eviction and the drafts keys cannot drift.
  • base64Decode is exported from lib/pr/metadata.ts and reused by
    remote-fetcher.ts; the fetcher keeps its own whitespace strip (GitHub wraps
    its base64 at 60 chars) rather than pushing that into the fence decoder.
  • Deleted fetchThreads (no production caller — fetchRemoteState inlines
    listReviewThreads + threadsFromRaw). Its four tests now call
    threadsFromRaw(await listReviewThreads(...)) through a 2-line local helper, so
    the paging coverage is unchanged and the only export is a function production
    actually uses.

4. AppState.currentFiles. Verified no consumer anywhere in entrypoints/;
deleted it with buildCurrentFiles and its two tests.

Test evidence

This is a deletion PR, so there is no red step except for the two shared helpers,
where the rule was to pin current behaviour before unifying:

  • tests/pr/chrome-storage.test.ts — "shares its prefix with the keys
    lib/drafts.ts builds": prStorageKey("acme","site",42) ===
    `${storageKeys.pr("acme","site",42)}:state`. Added and run green against
    the two independent definitions
    , then prStorageKey was rewritten onto
    storageKeys.pr; still green.
  • tests/pr/remote-fetcher.test.ts — "decodes UTF-8 from the line-wrapped base64
    GitHub returns": multibyte source, base64 wrapped at 60 chars. Added and run
    green against the fetcher's private decoder, then repointed at the shared
    base64Decode; still green.

Full set on the rebased branch: 816 pass / 0 fail (bun run test),
check:lint, check:format, typecheck and build all clean.

Dropped from the issue (already fixed on main)

  • DebugFab.tsx's undefined var(--green) — gone with DebugFab's preview.
  • lib/pr/bootstrap.ts:8-17 — the current header describes the live composition
    accurately; nothing to remove.
  • lib/pr/repository.ts:159 — that line is live code today; only the (Phase 4)
    tag on line 8 needed a fix.

Left out, on purpose

Two phase tags remain in App.tsx's submit flow — // already double-written by L4/L6a and // (the L6d-1 effect is best-effort…). Both sit inside the
composeDraftBody call regions that the still-open #351 edits, so they are left
for a one-line follow-up after that merges rather than handed #351 a conflict.

Closes #301

@nownabe nownabe self-assigned this Sep 20, 2026
Comments that described where code used to live, or named refactor-plan
phases (Pack/L*/R*), cost every reader a lookup that resolves to nothing.
Dead CSS rules and exports with no consumer do the same. Remove them, and
collapse the two places that built the per-PR storage-key prefix and the
two private UTF-8 base64 decoders onto one definition each so they cannot
drift.

Closes #301
@nownabe

nownabe commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main after #352. The two phase tags left behind to avoid conflicting with #351 (L4/L6a, L6d-1) are now removed in this PR as well, so no follow-up is needed.

@nownabe
nownabe merged commit 8124157 into main Sep 20, 2026
10 checks passed
@nownabe
nownabe deleted the refactor/301-sweep branch September 20, 2026 11:09
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.

[Refactor] Sweep tombstone comments, dead CSS and no-consumer leftovers

1 participant