Skip to content

refactor(review): delete the parked AppV2 surface and its Provider-only hooks - #329

Merged
nownabe merged 1 commit into
mainfrom
refactor/296-delete-appv2
Sep 20, 2026
Merged

nownabe merged 1 commit into
mainfrom
refactor/296-delete-appv2

Conversation

@nownabe

@nownabe nownabe commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Why

AppV2 was parked; App.tsx is the ADR target and already reads the new data layer through useAppStateFromRepository. AppV2Mount was imported by nothing, AppV2 only by its own mount and test, and the Provider-only hooks in lib/pr/react.tsx had exactly one consumer: AppV2. App.tsx even wrapped its tree in RepositoryProvider that nothing below it read. Keeping the surface compiled cost a second mental model on every change to the review UI for no benefit.

What

1,821 lines removed, 15 added (net −1,806).

  • git rm entrypoints/review/AppV2.tsx (659), entrypoints/review/AppV2Mount.tsx (219), tests/AppV2.test.tsx (744).
  • styles.css: the 34-line appv2 boot-gate block.
  • App.tsx: the dead RepositoryProvider wrapper and its import — the review tree is now returned directly.
  • lib/pr/react.tsx: RepositoryProvider, useRepository, the two file-private useLocal/RemoteStateInternal helpers and useAppState; useAppStateFromRepository (the one hook the live surface uses) stays, with the header rewritten to describe the single remaining read path.
  • tests/pr/react.test.tsx: the Provider/useAppState cases dropped; the useAppStateFromRepository coverage kept (the "Provider-free use" case is now just "renders in a component tree of its own").
  • Reworded the AppV2 mentions in main.tsx, the lib/pr/bootstrap.ts header (it sketched a <RepositoryProvider> entrypoint that will now never exist) and tests/useAuthFlow.test.tsx.

Verification

AppV2, appv2, RepositoryProvider, useRepository( and useAppState( now have zero hits across entrypoints/, lib/, tests/ and docs/; repo-wide, the only file still mentioning them is CHANGELOG.md (historical release notes, intentionally untouched).

The issue also asks to update ADR 0001 §4 "where it names useAppState" — no doc under docs/ mentions useAppState, useRepository or any Provider, so there was nothing to change. ADR 0001 §4 is the conflict policy; the "React reads AppState" wording it is cited for stays accurate.

This is a deletion, so there is no red-test step. The suite is green with the AppV2 tests gone: 668 pass / 0 fail across 61 files (was 699 / 63).

Checks

bun run test (668 pass / 0 fail), check:lint, check:format, typecheck, build — all green on top of origin/main.

Closes #296

@nownabe nownabe self-assigned this Sep 20, 2026
…ly hooks

AppV2, AppV2Mount and their Provider hooks had no mounted consumer: App.tsx is the ADR target and reads AppState via useAppStateFromRepository. Keeping ~1,800 unreachable lines compiled only added a second surface to reason about on every change.
@nownabe
nownabe force-pushed the refactor/296-delete-appv2 branch from db06ebc to 7bfc231 Compare September 20, 2026 07:16
@nownabe
nownabe merged commit 9f1d057 into main Sep 20, 2026
10 checks passed
@nownabe
nownabe deleted the refactor/296-delete-appv2 branch September 20, 2026 07:19
nownabe added a commit that referenced this pull request Sep 20, 2026
…#350)

## Why

`docs/` had accumulated statements that no longer describe the code: a
wire
format 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 as
such below.

## What

Per item of #294:

1. **ADR 0003 §7 "Legacy metadata is discarded"** → rewritten as "read,
never
rewritten". `lib/pr/metadata.ts` accepts `bark:v1` and its
`docreview:v1`
alias 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.

2. **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-anchoring
proceeds through the line map as usual, and only a real 404
(garbage-collected
commit, path or repo gone) leaves `FileContent` missing and yields
`outdated`.
   Design doc §12-3 is closed accordingly.

3. **ADR 0005 §1/§5 manual refresh** → amended to match the code rather
than
gating the fab. `DebugFab` is always rendered; the Refresh button lives
one
click 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 the
   two FABs actually follow: reveal-only may ship, behaviour-changing is
   build-gated (`.role-fab` / `BARK_DEV_ROLE_SWITCH`).

4. **Design doc §7.1 / §7.7 / §10** → the raw-JSON `bark:v1` example is
replaced
by a real `bark:v2` base64 envelope with its decoded payload, the
optional
`resolved` and `quoteDigest`/`quoteLength` (#334) fields, and a pointer
to
`lib/pr/metadata.ts` as the authoritative field list. §7.7 now describes
`chrome.storage.local` as the only store, lists the three per-PR keys,
and
states 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.

5. **2026-06-18 resolve spec** → the superseded banner added by #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.

6. **§7.9 `addressed` vs ADR 0004 `shifted`** → ADR 0004 §4 gains a
paragraph
stating that `shifted` is the raw mechanical signal and R9's `addressed`
(#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 `addressedBySha` in `lib/github.ts` is an
   unreferenced legacy type, not part of the model.

7. **Design doc §11 status** → R8 cross-file navigation is marked
shipped (the
changed-`.md` selector in `Topbar.tsx`, fed by
`RemoteState.changedFiles`), so
   M5 is done and M4 (R9/R10) is the remaining open work.

8. **ADR statements not implemented** — decided in favour of the code:
- **ADR 0002 §6** rewritten to describe materialise-at-submit as
implemented:
`SuggestionEdit` is persisted on its own `:suggestion-edits` key (400 ms
debounce, read-modify-write per path), stays "live" in the editor until
Submit, and only then becomes draft `Comment`s whose id is derived, not
minted, from `(path, baseSha, range, replacement)` (#337/#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
`SuggestionEdit`
     into the Repository as the deferred work.
- **ADR 0005 §2** "already-fetched pairs are retained" deleted. A full
refresh
replaces `RemoteState` wholesale, refetching every pair; the sentence is
replaced by why that is fine (ETag `If-None-Match` on every GET, 304
costs no
     rate limit) and a pointer to the still-deferred persistent cache.
- **ADR 0001 §4 `useAppState`** — already fixed by #329; §4 is the
conflict
     policy and names no hook. Verified, no change.

Also folded in (from the #299 agent, found while reviewing PR #349):

- **AGENTS.md / README.md layout** described `lib/github.ts` as "GitHub
API". It
  is 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-existent
`lib/reanchor.ts` is dropped. (`CLAUDE.md` is a symlink to `AGENTS.md`,
so one
  edit covers both.)
- **2026-06-21 author-role-derivation spec and plan** describe
`deriveRole` and a
`GitHubClient.getAuthenticatedUser` lookup; the live derivation is
`computeRole`
in `lib/pr/appstate.ts`, which also withholds `author` when `headRepo`
is `null`
(#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
had
changed 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: `oxfmt`
**does**
format Markdown in this repo, and it reflowed the README table.

## Noted, out of scope

- `lib/storage.ts:2-3` still 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.ts` keeps the dead `CommentStatus` / `ReviewComment` /
  `addressedBySha` types that nothing imports. PR #349 removes them.
- Nothing links to `docs/superpowers/` or `docs/chrome-web-store/`, and
`docs/adr/` has no index page. The authority paragraph now explains what
`superpowers/` is, which covers the misleading part; an index is a
separate
  question.

Closes #294
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] Delete the parked AppV2 surface and its Provider-only hooks

1 participant