0052 — PR lifecycle: the phase chip tells the truth #132
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/0052-pr-lifecycle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The header phase chip (and the PR transcript card) said "PR open" forever after a
create_prcall returned a URL — merges/closes happen on the host and nothing ever asked again. 0052 makes them ask: while the derived phase is an open PR, the client pollsGET /api/x/prs(visible-tab, 5 s, stops once settled) and the chip relabels to PR merged / PR closed per the host's live answer.derivePhasestays pure (0041 holds) — the override is render-time (applyPRState); the transcript snapshot keeps recording what was true when the call ran.Pieces
GitHost.getPRState(github + forgejo) — GETpulls/{n}, merged/closed/open mapping, errors → null, never throwsGET /api/x/prs?url=…— batched, cap 10, credential-resolved by host scope, unresolvable → null, never 500susePRStates— theuseChildStatuspolling rule; settled PRs are never refetchedPullRequestToolCardpill follow the live state;create_prresult now recordsstate: "open"docs/0052-pr-lifecycle.md(approved in chat); AGENTS.md phase-chip bullet updatedEvidence
npm run typecheckclean,npm run lint0 errors,npm run test838 passed / 16 skipped (pre-existing spike skips) — run in this checkout, twice (before and after review fixes)8a8985b(listener always removed on stop, empty-url early return, owner/repo path-encoded). Follow-up noted, not blocking: the hook's fetch loop has no direct test coverage — the repo has no DOM test env and adding one is a new dependency (needs your sign-off if wanted).0052: one route answers every visible PR at once. Each ?url= resolves host + credential by the 0004 host-scope rule (github.com, the forgejo instance), asks the seam, and returns { [url]: state | null } keyed by the exact input URL. Bad URLs, missing credentials, host errors all map to null — the route never 500s. Capped at 10 URLs.