Repository navigation
docs: correct design doc, ADR and spec statements that no longer hold - #350
Merged
Merged
Conversation
A newcomer reading docs/ in the order AGENTS.md prescribes was misled about the wire format, local storage, the refresh UI and which spec still applies. Each statement here was re-checked against the code on main and either corrected or recorded as a decision in the owning ADR. Closes #294
nownabe
added a commit
that referenced
this pull request
Sep 20, 2026
#353) ## 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 #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
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
docs/had accumulated statements that no longer describe the code: a wireformat two versions old, a storage backend that was never built, an ADR rule the
UI does not follow, and superpowers specs that contradict the ADRs without saying
so. A newcomer following the reading order AGENTS.md prescribes was being misled.
Documentation only — no behaviour change. The ADRs were amended heavily between
the issue and this PR (#303–#348), so every item was re-audited against the code
on
main(9465718) before editing; two were already fixed and are recorded assuch below.
What
Per item of #294:
ADR 0003 §7 "Legacy metadata is discarded" → rewritten as "read, never
rewritten".
lib/pr/metadata.tsacceptsbark:v1and itsdocreview:v1alias read-only (
extractMetadata→parseV1) and maps them to the v2 shape;only an unparseable, invalid or unknown-version payload is dropped. The note
says why there is no migration path: v1 payloads live in comment bodies on
github.com, which no client release can rewrite. The two cross-references that
repeated the old claim (ADR 0001 and ADR 0002 closing notes) now distinguish
local legacy keys, which are dropped, from on-GitHub metadata, which is not.
ADR 0004 §5 force-push bullet → replaced.
GET contents?ref={sha}addresses a commit object, not a ref, so a force-pushed sha normally stays
fetchable (and PR heads are retained under
refs/pull/N/head); re-anchoringproceeds through the line map as usual, and only a real 404 (garbage-collected
commit, path or repo gone) leaves
FileContentmissing and yieldsoutdated.Design doc §12-3 is closed accordingly.
ADR 0005 §1/§5 manual refresh → amended to match the code rather than
gating the fab.
DebugFabis always rendered; the Refresh button lives oneclick deeper, inside the debug popover, next to the internal-state dump. §5
carries an explicit amendment note saying that is accepted for v1 and why.
docs/design-principle.md's floating-controls bullet now states the rule thetwo FABs actually follow: reveal-only may ship, behaviour-changing is
build-gated (
.role-fab/BARK_DEV_ROLE_SWITCH).Design doc §7.1 / §7.7 / §10 → the raw-JSON
bark:v1example is replacedby a real
bark:v2base64 envelope with its decoded payload, the optionalresolvedandquoteDigest/quoteLength(fix(pr): bound the comment body to GitHub's 65,536-character limit #334) fields, and a pointer tolib/pr/metadata.tsas the authoritative field list. §7.7 now describeschrome.storage.localas the only store, lists the three per-PR keys, andstates plainly that the IndexedDB plan was never built; §10's "persist state to
IndexedDB" bullet and its ETag sentence are rewritten to what the client does.
2026-06-18 resolve spec → the superseded banner added by feat(pr): resolve out-of-diff threads via the root comment fence #310 is present
and correct; verified, not touched. Its plan had none, so it got one. The
design doc's authority paragraph now covers
docs/superpowers/explicitly:history, not authority, and the absence of a banner is not a promise of
currency.
§7.9
addressedvs ADR 0004shifted→ ADR 0004 §4 gains a paragraphstating that
shiftedis the raw mechanical signal and R9'saddressed(R9: Track review↔fix round history #3)is derived from it plus the review rounds, specified separately and stored
nowhere. Design doc §7.9 now references the ADR statuses instead of inventing
its own, and notes that the
addressedByShainlib/github.tsis anunreferenced legacy type, not part of the model.
Design doc §11 status → R8 cross-file navigation is marked shipped (the
changed-
.mdselector inTopbar.tsx, fed byRemoteState.changedFiles), soM5 is done and M4 (R9/R10) is the remaining open work.
ADR statements not implemented — decided in favour of the code:
SuggestionEditis persisted on its own:suggestion-editskey (400 msdebounce, read-modify-write per path), stays "live" in the editor until
Submit, and only then becomes draft
Comments whose id is derived, notminted, from
(path, baseSha, range, replacement)(fix(review): derive a suggestion draft's cid from the hunk it materialises #337/[Medium] Retry after a partial suggestion failure posts the same edit twice (unstable suggestion cid) #308). The stale"lost on reload" trade-off and the auto-save Deferred item are replaced by
the real consequence: two persistence paths, with folding
SuggestionEditinto the Repository as the deferred work.
replaces
RemoteStatewholesale, refetching every pair; the sentence isreplaced by why that is fine (ETag
If-None-Matchon every GET, 304 costs norate limit) and a pointer to the still-deferred persistent cache.
useAppState— already fixed by refactor(review): delete the parked AppV2 surface and its Provider-only hooks #329; §4 is the conflictpolicy and names no hook. Verified, no change.
Also folded in (from the #299 agent, found while reviewing PR #349):
lib/github.tsas "GitHub API". Itis not: it holds PR types and four pure helpers, while the client, the
Repository pipeline, re-anchoring and the wire format all live in
lib/pr/.Both are rewritten around
lib/pr/as the place to start, and the non-existentlib/reanchor.tsis dropped. (CLAUDE.mdis a symlink toAGENTS.md, so oneedit covers both.)
deriveRoleand aGitHubClient.getAuthenticatedUserlookup; the live derivation iscomputeRolein
lib/pr/appstate.ts, which also withholdsauthorwhenheadRepoisnull([Medium] Fork PRs: PullRequest has no head repository, so Commit targets the base repo #273). Both files get a Superseded banner pointing there and at ADR 0002 §4.
Every ADR amended here records it in the header in ADR 0004's existing
- Amended: <date> (#issue) — <what>format; two prior amendments that hadchanged an ADR body without a header line (#267 on ADR 0004/0005, #289 on
ADR 0001) are backfilled from their commits, and ADR 0002's in-place 2026-07-22
note is now also listed in the header.
Testing
No test accompanies this change: it edits only Markdown, and there is no
assertion a docs edit could make fail. The verification was reading each claim
against the code it describes —
lib/pr/metadata.ts,lib/pr/reanchor.ts,lib/pr/remote-fetcher.ts,lib/pr/chrome-storage.ts,lib/drafts.ts,entrypoints/review/hooks/useSuggestionEdits.ts,entrypoints/review/components/DebugFab.tsx,entrypoints/review/reviewItems.ts— and the base64 example in §7.1 is generated, not hand-written, so it decodes to
the JSON printed beneath it.
Checks
bun run test(822 pass / 0 fail, 65 files) ·check:lint·check:format·typecheck·build— all clean. Note for future docs PRs:oxfmtdoesformat Markdown in this repo, and it reflowed the README table.
Noted, out of scope
lib/storage.ts:2-3still promises "IndexedDB: per-PR pending comments/suggestions, snapshots (later slice)" in its header comment — the same drift as
item 4, but in code. Left for a code PR since this one touches no
.ts.lib/github.tskeeps the deadCommentStatus/ReviewComment/addressedByShatypes that nothing imports. PR refactor: give PrRef, ChangedFile and PullRequest one home each #349 removes them.docs/superpowers/ordocs/chrome-web-store/, anddocs/adr/has no index page. The authority paragraph now explains whatsuperpowers/is, which covers the misleading part; an index is a separatequestion.
Closes #294