EnhancedFilePicker and the download adapter captured showOpenFilePicker
and showSaveFilePicker with `.bind(options)`. A Window operation throws
TypeError("Illegal invocation") when `this` is not the Window, so passing
`window.showOpenFilePicker` / `window.showSaveFilePicker` as-is failed on
every call.
Both are now captured with `.bind(undefined)`. They are still captured at
construction, and Web IDL maps an undefined receiver to the global object,
so the native functions can be injected directly.
Verified: "calls an injected window picker without rebinding its
receiver" and "calls an injected window save picker without rebinding its
receiver" use a fake picker that throws "Illegal invocation" unless `this`
is undefined or globalThis. Both failed before the fix (ok:false) and pass
now. check:architecture, check:types:app, check:types:test, lint,
test:component pass. test:unit passes except removal-fixture, which needs
generated artifacts/release files that a fresh worktree lacks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tab whose BroadcastChannel postMessage failed once called
closeBroadcast(), which also removed its receive listener. Publishers
that broadcast successfully never write a storage pulse, so from then on
the tab missed every other tab's event while reporting
ACTIVE_STORAGE_FALLBACK. A tab whose BroadcastChannel failed to open had
the same blind spot and the same healthy-looking status.
Per D-4 there is no dual broadcast+storage publishing. Instead:
- A publish failure only sets broadcastPublishFailed. Later publishes go
to storage, and the channel stays open for receiving.
- BROADCAST_OPEN_FAILED now yields the additive status
DEGRADED_STORAGE_FALLBACK (the union lives in the adapter and is only
passed through by bootstrap). A browser without BroadcastChannel at all
keeps ACTIVE_STORAGE_FALLBACK, because every tab there uses storage.
- A successful storage publish recomputes the status instead of forcing
ACTIVE_STORAGE_FALLBACK, so it cannot hide the degraded state.
Existing tests fixed: "falls back when BroadcastChannel open or publish
fails" and "enters explicit local-only degradation when every transport
fails" expected ACTIVE_STORAGE_FALLBACK for a tab whose channel failed to
open. The ops runbook lists the new status.
Verified: "keeps receiving broadcasts after its own broadcast publish
fails" (received [] instead of [BROADCAST]) and the open-failure status
assertion (ACTIVE_STORAGE_FALLBACK) failed before the fix and pass now.
check:architecture, check:types:app, check:types:test, lint,
test:component, verify:documentation pass. test:unit passes except
removal-fixture, which needs generated artifacts/release files that a
fresh worktree lacks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-source high watermark was stored with the event's expiresAt and
pruned with it. After a source was quiet for longer than the 60 s event
TTL, its next event had no previous watermark and `sequence > 1`, so it
was delivered as GAP, and the query-cache coordinator then invalidated
every topic.
The watermark now carries only the sequence. It is removed only by the
existing sourceCapacity LRU. Event dedupe entries still expire with the
event TTL.
The existing test "bounds TTL and LRU tracking instead of growing with
remote sources" expected a same-source replay of seq 1 to be delivered
again after the TTL, which only worked because the watermark expired.
It now expects that replay to be dropped as STALE.
Verified: "keeps the per-source sequence watermark past the event TTL"
failed before the fix (seq 2 after 61 s was GAP) and passes now.
check:architecture, check:types:app, check:types:test, lint,
test:component pass. test:unit passes except removal-fixture, which needs
generated artifacts/release files that a fresh worktree lacks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boundedObjectUrlHandoff called resolveByteSource outside its try/finally.
When the authorized source open threw or was aborted, deliver() rejected
with an AbortError instead of returning {ok:false, ABORTED}, the observer
saw nothing, and the holder was never latched closed, so a lease that
arrived later was never closed by compensateLateSource.
Source resolution now runs inside the existing try/catch/finally, the same
shape promptAndStream already uses. The explicit closeHeldSource calls on
the early-return paths are covered by the finally.
Verified: "resolves ABORTED and closes a late lease when a bounded source
open is aborted" failed before the fix (promise rejected with AbortError)
and passes now. check:architecture, check:types:app, check:types:test,
lint, test:component pass. test:unit passes except removal-fixture, which
needs generated artifacts/release files that a fresh worktree lacks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Policy validation only checked partSize × copyFactor against
maxInFlightBytes. With the defaults (5 MiB × 4 into 20 MiB) the runtime
silently clamped workers to 1 while createSession still asked the server
for maxConcurrency 3, contrary to the documented rule that
partSize × concurrency × copyFactor over the budget is refused up front.
Per D-2 the default maxConcurrency is now 1 (the value that actually ran)
and maxInFlightBytes stays 20 MiB. Validation multiplies by maxConcurrency,
so a resolved policy always fits its workers in memory; the now-dead
memory clamp in the range-reader worker count is removed and createSession
requests the concurrency the runtime can run.
Verified: RED in tests/unit/resumable-upload-runtime.test.ts --
"has a valid production default policy" (maxConcurrency 4 over a 48-byte
budget did not throw) and "requests the concurrency the default policy can
actually run" (createSession got requestedMaxConcurrency 3) failed before
the fix and pass after. Existing test and browser-spec policy overrides
already satisfy the rule. Gates: check:architecture, check:types:app,
check:types:test, lint, test:component pass; test:unit passes except
removal-fixture.test.ts, which needs untracked artifacts/release/* absent
from a fresh worktree (unrelated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The control plane accepts base64url IDs (/^[A-Za-z0-9_-]{8,512}$/), but the
presigned provider and executor each re-checked session, resource and
idempotency IDs with their own /^[a-z0-9][a-z0-9._:-]{0,255}$/i. IDs that
start with '-'/'_' (about 3% of random base64url IDs) or exceed 256
characters passed session creation and checkpointing, then every part issue
and the final download issue failed as INVALID_INPUT.
checkpoint-schema.ts now defines SAFE_TRANSFER_ID next to SAFE_OPAQUE_ID as
a superset of it; the provider and executor import it instead of keeping
their own regexes. IDs the presigned layer accepted before are still
accepted (no narrowing for non-upload download resource IDs).
Verified: RED "presigned layer accepts every control-plane opaque ID"
(tests/unit/presigned-transfer-upload.test.ts; leading '-', leading '_',
512 chars, for issueUploadPart + PUT and for issueDownload) returned
INVALID_INPUT before the fix and passes after. Gates: check:architecture,
check:types:app, check:types:test, lint, test:component pass; test:unit
passes except removal-fixture.test.ts, which needs untracked
artifacts/release/* absent from a fresh worktree (unrelated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
snapshotRequest() threw a TypeError when the source exceeded maxFileBytes
or maxPartCount, and upload() mapped every snapshot error to INVALID_INPUT.
The LIMIT_EXCEEDED branch in executeUpload() re-checked the same policy
and could never run, so a 6 GB file was reported as invalid input.
snapshotRequest() now validates only request shape; executeUpload() owns
the size check and returns LIMIT_EXCEEDED before any control-plane call.
Verified: RED "reports a source over maxFileBytes as LIMIT_EXCEEDED"
(tests/unit/resumable-upload-runtime.test.ts) received INVALID_INPUT before
the fix and passes after. A valid policy already bounds the part count by
maxFileBytes, so the maxPartCount branch is covered by the same check.
Gates: check:architecture, check:types:app, check:types:test, lint,
test:component pass; test:unit passes except removal-fixture.test.ts, which
needs untracked artifacts/release/* absent from a fresh worktree (unrelated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dispose() cached its drain promise. When the cleanup deadline expired it
returned UNAVAILABLE/retryable but kept that promise, so a later dispose()
replayed the same failure even after all work had settled: the checkpoint
store was never closed and lifecycle stayed CLOSING.
The one-shot admission close and the quiescence promise now live in
beginTeardown(); each dispose() races that shared quiescence against a new
deadline, and an expired drain resets so the next call can close the store.
Verified: RED "closes on a later dispose() once work that outlived the
deadline settles" (tests/unit/resumable-upload-runtime-teardown.test.ts)
failed with { ok: false } on the second dispose before the fix and passes
after. Gates: check:architecture, check:types:app, check:types:test, lint,
test:component pass; test:unit passes except removal-fixture.test.ts, which
needs untracked artifacts/release/* absent from a fresh worktree (unrelated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/.generated is gitignored, but no entry point rendered it, so a fresh
checkout failed check:architecture, check:types:app/node/test, unit and
component tests, verify:documentation, dev and build.
- run-vitest renders the index before starting Vitest (all vitest suites)
- package scripts that load src (dev, build, storybook, architecture,
app/node/test type checks, the five fixtures that reach the index,
verify:documentation) render it first; CI runs these scripts by name
- tests/unit/product-index-entrypoints.test.ts guards the wiring
Verified from a fresh state (src/.generated removed before each gate):
architecture, types app/node/test, lint, unit 1781/1781, component 132/132,
verify:documentation, build, dev (HTTP 200), check:ci all pass;
fixture route-runtime still fails with its expected TS2740.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>