Fixes #10605.
Why
pm-aggregator tests → browser acceptance (MOB-00) has been red on main since it was added. Run 43804024455 (workflow_dispatch, head 3fb67243f5bfa3c3bff06eba9f18e7800516344c), job browser acceptance (MOB-00):
Locator: locator('#queue-main article.card').filter({ hasText: 'Dispatch trial: doc/README.md starting point (#762)' })
Error: element(s) not found at test/browser/mobile-work-view.spec.ts:66:22
The trace had no /frag/queue request and the retained error context still showed Loading queue….
Root cause: the shell placeholders bootstrap their fragment fetch with data-on-load, which is not a Datastar v1 attribute. The vendored src/assets/datastar.js is Datastar v1.0.0, where listeners are data-on:<event> and one-shot init is data-init (data-init already works in this app — the theme toggle at render.ts:580 uses it). load also never fires on a div. So /frag/* was only fetched after the freshness client dispatched dashrefresh; on a quiet stream the page sat on the skeleton forever.
What changed
src/render.ts — the queue, today, overview and board shell placeholders (and the three attention shell sections via attentionFragment(..., { initial: true })) now use data-init="@get('/frag/...')", keeping data-on:dashrefresh__window for refresh. attentionFragment gains an initial option so the shell and the fragment payload can differ.
src/server.ts — the four /frag/* payload wrappers drop the load attribute entirely. They are applied with mode outer, so the payload replaces the shell element; an init trigger inside the payload would fetch itself again on every patch. First paint is the shell's data-init, refresh is dashrefresh only.
src/freshness-delivery.ts — the freshness re-mount frame patches a skeleton, so it needs a trigger to re-fetch once: data-on-load → data-init. The /frag/* payload it lands carries no init, so this cannot loop.
- Tests (
test/boot.test.ts, test/frag-watchdog-1503.test.ts, test/freshness-delivery.test.ts) now pin data-init, assert shells carry no data-on-load, and assert /frag/* payloads carry neither data-init nor data-on-load (the no-loop property). The freshness test asserts the re-mount frame does carry data-init.
No dashboard redesign, no Datastar bundle upgrade, no workflow trigger change (dispatch-only by #6126).
Verification
cd pm-stack/aggregator && bun test (bun 1.4.4, with HOME pointed at an isolated temp dir and a free PM_AGG_FRESHNESS_PORT; see note below):
2767 pass
0 fail
24300 expect() calls
Ran 2767 tests across 213 files. [25.35s]
bunx tsc --noEmit — clean (exit 0).
Browser (system Chromium via a temporary Playwright config; the 1.64 Playwright browser download is not installed here; temporary config/specs deleted before committing). With /freshness/stream blocked at the network layer:
✓ /queue hydrates with the freshness stream blocked, exactly once
✓ /today hydrates with the freshness stream blocked, exactly once
✓ / hydrates with the freshness stream blocked, exactly once
✓ /board is a full server render: no fragment fetch needed
4 passed (13.8s)
Each shell test asserts: the fragment paints (skeleton gone), exactly one /frag/* request on first paint, still exactly one after 2.5 s idle (no loop), and exactly one more after a dispatched dashrefresh (refresh path intact). The real MOB-00 spec (only its ORIGIN port changed, because another local aggregator instance holds 4797) passes:
✓ pmo_mob_03/04_mobile_queue_keyboard_and_viewport_contract (863ms)
1 passed (1.6s)
Note on the local suite: with the default HOME, /quota blocks ~10 s on the real opencode DB held by the running session, so test/boot.test.ts times out locally; this reproduces identically on unmodified b84c351bbe (git archive of the base commit), so it is a host artifact, not this change. Under an isolated HOME (the CI condition) the full suite is green. No proxy file or test was modified for that.
CI cannot be triggered for this PR by design: verification is a manual workflow_dispatch of pm-aggregator tests, where browser acceptance (MOB-00) and aggregator tests and typecheck should now pass. The fetched-vs-loop behaviour was verified locally as above.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.