Skip to content

fix(serving): browser Back no longer restores a public patch with a dead client - #368

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/341-bfcache
Sep 24, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/341-bfcache

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

Leaving a public patch and coming back with browser Back could restore a page that looked ready but whose client had already closed. Every route change then failed with unknown_outcome until you reloaded by hand. Fixes #341.

Stacked on #367 (branch fix/324-unicode-route).

The broker and client close on pagehide, and a back/forward-cache restore resumes that closed document without running setup again. The shell now reloads when it gets a pageshow with persisted set. That gives a fresh document and broker, and pending work is never replayed or sent over the old port. Reloading beats marking the public shell no-store: we keep its one-minute public cache, and no-store no longer reliably keeps a page out of the back/forward cache in Chromium or Safari. ADR-0010 now says this in one sentence.

Test evidence

  • A new tier-1 Playwright case, "Back to a cached public patch leaves a working client", uses the browser's real back/forward cache. It runs full Chromium without Playwright's --disable-back-forward-cache flag, because the headless build refuses to cache. It checks that pageshow.persisted was true, then clicks the in-patch "Next route" button until the URL changes.
    • On the unfixed broker the restore is confirmed, but the clicks never move the URL off /items/2.
    • With the fix the test passes.
  • The Chromium tier-1 suite passes (6 of 6). Firefox couldn't run locally because its Playwright build isn't installed.
  • pnpm typecheck and pnpm lint pass.
  • pnpm test: 955 of 957 passed. The 2 failures were 5-second timeouts in the integrations Postgres suites, which this change doesn't touch; both files pass when run alone.

Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area size:s Under 100 changed lines labels Sep 23, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Astra review

Reviewed origin/fix/324-unicode-route...af60cd0 against issue #341, in one pass without subagents. Merge blockers only.

Standards

No merge-blocking method or YAGNI findings. The persisted pageshow handler is the small, direct fix requested. Reusing the existing context setup avoids duplicating the offline guard. The regression exercises a real BFCache restore and a working route button, rather than a synthetic lifecycle event. No future-facing machinery was added.

Spec

No merge-blocking intent findings. The shell reloads only on a persisted return. Existing broker/client teardown remains intact; the change neither reopens the old port nor adds replay of pending operations. ADR-0010 records that behavior. No missing requirement or unrelated behavior change found.

Verification: the focused Chromium test passed, 1/1:

pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium --grep "Back to a cached public patch leaves a working client"

The test confirmed pageshow.persisted and successful navigation from /items/2 to /items/3. I did not run Firefox or the full suite.

Summary: Standards 0 blockers, none; Spec 0 blockers, none.

… a closed client

The broker and client close on pagehide. A back/forward-cache restore resumed
that closed document, so every route call rejected unknown_outcome until a
manual reload. On a persisted pageshow the shell now reloads, getting a fresh
document and broker; pending work is never replayed and the old port stays
closed. Public shells keep their one-minute cache rather than opting out with
no-store, which Chromium and Safari no longer treat as a reliable opt-out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 91ec460 into main Sep 24, 2026
8 checks passed
@allisonmahmood
allisonmahmood deleted the fix/341-bfcache branch September 24, 2026 15:20
allisonmahmood added a commit that referenced this pull request Sep 24, 2026
…array elements (#369)

Stacked on #368 (branch fix/341-bfcache).

Fixes #340. Postgres relation reads (`list`, `get`, `getMany`) rounded `bigint[]` and `numeric[]` elements, so two distinct external ids like `9007199254740992` and `9007199254740993` came back equal. `query` on the same columns already returned them exactly, as strings.

The relation mapping projected every array through `to_jsonb`, which turns elements into JSON numbers. Arrays whose element is int8 or numeric now go through `text[]` first, so elements arrive as strings, matching the scalar and query paths. Nulls and dimensions are kept, domain arrays and arrays of int8/numeric domains are covered, and older snapshots without element metadata fall back to the builtin array name. Other arrays (such as `integer[]`) still return numbers. The postgres skill and `docs/product.md` now say array elements of int8/numeric are strings.

Tests:
- New parity case discovers a table with `bigint[]`, `numeric[]` (with a null), an int8-domain array, a domain over `bigint[]`, a 2-D `bigint[]` and an `integer[]` control, then checks list/get/getMany against query on both native Postgres and the PGlite dev fixture. It failed on the unmodified code with the ticket's exact rounding, on each surface separately.
- Mapping unit test covers which arrays get the text projection, with and without element metadata.
- `pnpm typecheck` and `pnpm lint` pass. The integrations suite passes. The full `pnpm test` had 4 timeouts under machine load (Operations, Runtime, PgliteCompanyDatabases); those files pass when run alone.

Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

serving: browser Back can restore a public patch with a closed client

1 participant