Commit Graph
35 Commits
Author SHA1 Message Date
DongHyeonkaandClaude Opus 5.5 4d8ceade21 fix(storage): match the OPFS runbook to the adapter and drop the dead EFFECT_UNKNOWN branch (05-09)
The runbook named failure codes the adapter stopped using and promised a
resume and a quarantine reconcile never does. It now states the put's own
code with RECONCILE, the skipped and failed row counts, and what reconcile
really does per phase. The worker never sent EFFECT_UNKNOWN and the client
refused it, so the cleanup effect type and its two adapter branches go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:44:51 +09:00
DongHyeonkaandClaude Opus 5.5 2b24f6d8f0 fix(storage): fail a put whose source stalls so the OPFS origin lock is freed (05-07)
A put holds the origin-wide mutation lock from BEGIN to FINISH, and the page
waited on its source with no bound, so one stalled source blocked every
tab's writes until their lock wait failed. Each wait for source bytes is now
bounded by putIdleTimeoutMs; the put fails NOT_READABLE (retryable) and its
compensation releases the lock. The port now says writes are one at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:41:31 +09:00
DongHyeonkaandClaude Opus 5.5 7f45afac7d fix(storage): report a future IndexedDB schema as INCOMPATIBLE and online-only (05-06)
An older tab that met a schema a newer release had upgraded got
MIGRATION_FAILED / READ_ONLY, but could not even read, and operators were sent
to the migration runbook. The VersionError on open now yields UNSUPPORTED /
ONLINE_ONLY with status INCOMPATIBLE, reads and writes give the same answer,
and the OPFS journal answers the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:37:40 +09:00
DongHyeonkaandClaude Opus 5.5 b87ab5ee8e fix(storage): let retention sweep and receipt prune step over a corrupt row (05-05)
One corrupt sidecar or receipt stopped every later sweep or prune, so
expired rows stayed on the device and receipts grew until all writes failed
LIMIT_EXCEEDED. Both now leave the corrupt row, count it and report it as one
CORRUPT_DATA observation, and keep a budget they cannot account for as it is.
A malformed budget row in prune now fails as CORRUPT_DATA, not MIGRATION_FAILED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:33:44 +09:00
DongHyeonkaandClaude Opus 5.5 6ab564f376 fix(storage): sweep a purged OPFS partition's chunks without the GC grace (05-04)
A LOGOUT or ACCOUNT_DELETION purge removed object directories only; chunk
bytes stayed until a GC 24 h later that might never run for that user.
Once every object is gone the purge now sweeps the partition's unreferenced
chunks at once and reports how the sweep ended. Chunks the journal or a
staged put still references are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:29:07 +09:00
DongHyeonkaandClaude Opus 5.5 3e37fbf0ed fix(storage): delete a partition's IndexedDB dataset when an authorized purge cannot open it (05-03)
LOGOUT and ACCOUNT_DELETION purged row by row and so needed an open that a
corrupt budget or binding row always rejected, leaving personal rows on the
device. After authority approval, a purge that finds the dataset rejected by
admission now deletes that partition's own database and reports it; healthy
datasets and other partitions are untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:24:55 +09:00
DongHyeonkaandClaude Opus 5.5 840de45ee7 ci: run every test file in a gate or name why not (12-04, 09-11)
tests/architecture, tests/release, tests/scripts, the top-level
tests/features files and the browser-soak contract now run in
test:coverage (FE-GATE-005); check:adapter-inventory joins FE-GATE-010
and the image resolve-signal type fixture joins FE-GATE-003 (baseline
updated). check:ci fails on a test file no gate command reaches unless
config/ci/ungated-tests.json gives a reason; only the tests/scale suite
is listed, pending 11-03. defineFeatureModule's id mismatch is tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:47:10 +09:00
DongHyeonkaandClaude Opus 5.5 239b22ae1a fix(ci): run every gate a non-matrix job owns and refuse profile/target mismatch (12-02, 13-01)
The generator rendered only gateIds[0] for non-matrix jobs, so
immutable_build never ran FE-GATE-027 and the snapshot test pinned that.
Each owned gate now gets its own run step, check:ci rejects a workflow in
which any contract gate has no run step, and release admission refuses
APP_PROFILE != RELEASE_TARGET. Both variables are documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:36:27 +09:00
DongHyeonkaandClaude Opus 5.5 0114b1e58b fix(ci): move CI contract counts and gate hash to an owned baseline file (14-02)
Gate/command/artifact counts and the gate-shape SHA-256 were code
constants, so any real removal or addition failed check:ci and removal
fixtures passed only in a relaxed mode. They now live in
config/ci/contract-baseline.json (owner, reason) with
update:ci-contract-baseline; update:registry-baseline wraps the existing
registry script. Removal fixtures re-baseline and run canonical check:ci
and check:registries; CI_CONTRACT_MODE, --reduced-removal-fixture and
check:registries:structure are gone. ci-quality-gates.md lists the
baselines a new project resets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:34:12 +09:00
DongHyeonkaandClaude Opus 5.5 412b3d1f1e docs: add the maturity review guide and the 2026-09-25 full review
CLAUDE.md makes the guide the standing review standard for this repo.
The review folder holds 14 area reports and the summary with the
28-perspective table and the finding index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:05:08 +09:00
DongHyeonkaandClaude Opus 5.5 d1a57ae949 fix(build): let the hosting gate accept the selected ACTIVE worker (R3-6)
verify-hosting-headers.ts passed the serviceWorker probe only when
cache-policy.json said `enabled: false` AND dist had no worker script, so no
configuration let a supported ACTIVE build through the hosting gate. The
probe now follows the static selection: ACTIVE requires exactly the selected
`service-worker.js` at the dist root; null / REMOVE_REGISTRATION /
PURGE_OWNED_RESOURCES still reject any worker script. The now-unused
`serviceWorker.enabled` policy flag is removed; the artifact keeps the same
`serviceWorker`/`enabled` probe key.

RED (ACTIVE build from the previous commit, `node scripts/verify-hosting-headers.ts`):
  Hosting cache/content-type/security header verification failed. exit=1
  { surface: serviceWorker, header: enabled, expected: false, observed: true, passed: false }
GREEN: same ACTIVE build -> PASS exit=0 (expected: true, observed: true);
  default build -> PASS; default build + stray dist/service-worker.js -> exit=1
  (reason "dist worker scripts: service-worker.js");
  tests/unit/hosting-probe.test.ts 13 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:42:09 +09:00
DongHyeonkaandClaude Opus 5.5 e0b20f50db docs(auth): document what readSubject must return and the fail-closed default (R3-3)
readSubject/getSubject must be an opaque, non-empty id that is stable per
user and never a token. Without it, every authenticated notification
clears server state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:15:26 +09:00
DongHyeonkaandClaude Opus 5.5 a328776bf2 fix(telemetry): send both telemetry ports through one collector transport (Q-6.9-4)
The application port (best-effort-telemetry) and the feature port
(feature-telemetry pipeline) each posted to TELEMETRY_ENDPOINT on their
own: 20+20 sends per minute, cookies on the application side, no
pagehide flush or dispose abort on the feature side, and no deadline on
any fetch, so a hung collector held activeFlush forever (6.3-10).

New src/adapters/telemetry/telemetry-collector.ts is the one transport:
shared send-rate window (createTelemetrySendRate, now in the platform
pipeline and injectable via `sendRate`), credentials "omit", cache
"no-store", a per-request deadline through the kernel
createAbortableOperation, and one pagehide fan-out. runtime-adapters
builds one collector and passes it to both ports. Body projections are
unchanged and pinned by characterization tests first.

Verified: new tests in tests/unit/telemetry.test.ts (5 RED before
wiring: credentials/cache, hung collector timeout, shared rate,
feature pagehide flush, feature dispose abort); all gates pass except
the known tests/unit/removal-fixture.test.ts (artifacts/ absent);
check:adapter-inventory 137/137; FE-RB-004 drill PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:58:35 +09:00
DongHyeonkaandClaude Opus 5.5 ae2f006b6d refactor(realtime): merge snapshot and race helpers, move shared parsers to kernel (Q-6.4-8)
Realtime kept three DataSnapshot readers and about ten hand-written
abort/timeout races, and two parsers had drifted copies in other adapters.

Snapshot: reconnect-coordinator and bounded-poll now use result.ts
captureRealtimeDataSnapshot (+ `source`, variadic hasExactSnapshotKeys).
Kept the result.ts rules, the stricter ones: Object.hasOwn instead of
`"value" in` (prototype pollution), enumerable fields only, keys read from
one descriptor snapshot, frozen computed at snapshot time instead of a
later Object.isFrozen. Poll therefore now rejects non-enumerable fields;
it also accepts null-prototype records, which the other two copies
already did (pure data, no inherited accessors). Characterization test
added for both in bounded-poll-coordinator.test.ts.

Race: one raceRealtimeTask(task, signal, deadline) in result.ts, built on
kernel createAbortableOperation, replaces fetch-sse timed/cancelReader,
reconnect race/drain (the drain keeps a host timer via timerDeadline,
since the clock itself may hang), poll awaitTaskOrAbort/awaitWithinLease,
live-poll checkpoint + two quiescence races (now one), stream-coordinator
deadline/recovery-wait/close-drain, and the two WS inline races. Kept
semantics: deadline armed first and wins a tie (poll lease), task still
starts when the clock throws (reader cancel), collaborator rejections
still reach stream-coordinator callers, scheduler install failure still
fails closed as a timeout. Small change: nothing starts once the signal is
already aborted (WS apply / SSE onEvent / reader.read could run just
before being reported ABORTED). The mapping adds one microtask per race,
so the reconnect test flush() helper gets 16 turns instead of 8.

Kernel: parseRetryAfterDelay moves to platform/retry-after.ts (realtime
re-exports it; http retry-policy parseRetryAfter now delegates, so it
rejects "", "  ", "1e3", "1.5", "0x10" and non-IMF dates it used to
accept). json-member-scanner moves to platform/; web-push push-codec uses
it instead of its top-level-only duplicate-key check, so nested
duplicates are rejected too. INVENTORY 136 -> 137, detail tables updated.

Tests: RED for http strict Retry-After, web-push nested duplicate, poll
snapshot rules; new direct raceRealtimeTask tests. Gates: architecture,
types app/test (+ service-worker/web-worker), lint, adapter-inventory
(abort ratchet 21/21), test:unit, test:component, realtime-boundaries,
integration/platform all pass. Realtime bundle 40346 -> 39433 gzip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:54:42 +09:00
DongHyeonkaandClaude Opus 5.5 54e6bce9d2 fix(realtime): reset the retry budget only after a signal on a stable open (Q-6.4-7)
isReconnectAttemptResetEligible returned true on either a valid
heartbeat/event or stableOpenMs elapsed. A server or proxy that sends one
`:` comment and drops kept attemptIndex at 0, so the delay stayed in
[0, baseDelay) and maxAttempts/maxElapsed were never reached (many
clients reconnecting in lockstep). Both conditions are now required. The
reconnect coordinator uses this helper at both close paths, so no
coordinator change is needed. The two design docs that stated "or" now
say "and".

Existing tests encoded the old "either" rule (policy unit test and the
coordinator "resets a spent retry" test) and are rewritten. RED: the
policy test (heartbeat-only returned true) and the coordinator test
(heartbeat on an instant close still reset: 3 attempts, expected 2)
failed before the fix. Gates: architecture, types app/test, lint,
adapter-inventory, test:unit, test:component pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:54:29 +09:00
DongHyeonkaandClaude Opus 5.5 bc17ed4bd7 fix(realtime): evict dedupe entries FIFO and store hashed fingerprints (Q-6.4-6)
A full dedupe window (2,048 IDs / 4 MiB) used to trigger a full
DEDUPE_OVERFLOW recovery on every event past capacity, so a steady
3.4 events/s stream re-fetched snapshots and reconnected every window.
The coordinator now drops the oldest entry (Map insertion order equals
apply order) and keeps applying; a replay pushed out of the window still
drops as STALE_EVENT through the sequence check. The design doc row and
the maxDedupeBytes contract comment now say eviction instead of recovery.

The semantic fingerprint is now a 16-char 64-bit FNV-1a hash of the
canonical envelope instead of the canonical text itself (up to 64 KiB
each). The canonical-size EVENT_TOO_LARGE check only bounded that stored
text, so it goes too; the wire-size check stays. pruneDedupe stops at the
first unexpired entry instead of scanning every entry.

The old "recovers instead of evicting" coordinator test encoded the bug
and is replaced by an eviction test. RED: the eviction test (got
RECOVERED/DEDUPE_OVERFLOW) and a fixed-size fingerprint codec test (got
3326 vs 333 bytes) failed before the change. Added a TTL prune
characterization test (passes before and after). Gates: architecture,
types app/test, lint, adapter-inventory, test:unit, test:component pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:54:29 +09:00
DongHyeonkaandClaude Opus 5.5 b691e38cc6 refactor(presentation): split theme.css into ordered files (Q-6.8-13d)
theme.css (1435 lines) is now an import-order entry point: tailwind, the
three token files, then styles/theme/{base,shell,primitives,templates,
pages,responsive}.css holding the original rules verbatim and in the same
order (components-layer chunks each wrap their part in
`@layer components`). check-design-system now reads every CSS file under
styles/ so the undefined-token check still covers the moved rules; the
design-system doc names the new layout.

Verified: `corepack pnpm build` before and after produce the same CSS
asset, dist/assets/index-6KRF2bCu.css, byte-identical (cmp and sha256
bdaa8521...). A probe undefined token in theme/pages.css fails
check:design-system. Lane gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:44:38 +09:00
DongHyeonkaandClaude Opus 5.5 1b9e2c5ec6 fix(http): recover a V2 401 outside the retry budget and correct the rollback claim (Q-6.3-11)
The V2 client only attempted 401 session recovery while the physical
attempt count was under maxRetryAttempts + 1. With MAX_RETRY_ATTEMPTS=0,
or when a 503 retry had already used the budget, a recoverable 401 went
straight to onUnauthenticated() and logged the user out. Recovery is
already bounded to one replay by recoveryUsed and by the deadline, so
the budget check is removed.

The comments in runtime-adapters.ts and adapters/http/index.ts said V2
works as a rollback path for V3 once its four slots are injected. That
is wrong: V2 validates the {success,data,meta} envelope and V3 the bare
DTO, so the same backend fails every V2 response with
ENVELOPE_MISMATCH. The comments and the client.ts ledger row in
docs/reviews/adapters/01-network-and-state.md now say a rollback also
needs a V2-envelope server. No docs/architecture page made the claim.
V2 code is kept.

Verified: two new auth-recovery cases (retries disabled; 503 then 401)
failed RED with ok:false and now recover. All lane gates pass except
the known removal-fixture test; verify:documentation passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:41:45 +09:00
DongHyeonkaandClaude Opus 5.5 4093ee8fc2 refactor(cache-storage): split the cache and download codecs out of their adapters (Q-6.2-11)
public-response-cache-adapter.ts (1986 lines) and download-delivery-adapter.ts
(1491 lines) mixed the facade with codecs and validators. Moved verbatim:
- cache-storage/public-cache-codec.ts: manifest normalization and canonical
  digest input, marker/active-pointer validation, bounded control JSON,
  owned cache names, CacheValidationFailure -> Result mapping.
- cache-storage/public-cache-response-validation.ts: response admission
  (status, directives, Content-Type, Vary, bounded body, digest).
- browser-files/download-input-validation.ts: request snapshot, input/limit
  checks, presigned and browser-managed capability validation, handoff target.
The adapters drop to 1164 and 1157 lines.

Two non-verbatim edits: validateDownloadInput takes a structural
DownloadInputValidationOptions instead of DownloadDeliveryAdapterOptions (no
import cycle), and readBodyBounded races reads on the kernel
createAbortableOperation instead of its own abort listener. Moving it out of
a primitive-importing file would otherwise have raised the hand-rolled abort
ratchet to 20/19; the abort outcome (ABORTED, reader cancelled) is unchanged.

Verified: characterization tests added first and passing before the move
(cache manifest/response/control-JSON failure codes, lookup abort during a
pending body read; download input validation codes); a line diff confirms the
moved code is verbatim apart from the two edits above. Inventory 139/139,
lane gates, check:browser-file-storage-boundaries pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:39:59 +09:00
DongHyeonkaandClaude Opus 5.5 63ce5f6486 fix(cross-context): report an inactive host and hash the release epoch (Q-6.2-9)
createBrowserCrossContextInvalidationFromHost returned undefined without any
diagnostic when the cache epoch was invalid or secure random was missing, and
bootstrap built the epoch as `release.${releaseId}`, so any release ID with
`+`, `/`, `@` or over the length limit silently turned cross-tab
invalidation off.

- The host factory now reports OPEN/FAILED/NONE with the new reasons
  INVALID_CACHE_EPOCH or SECURE_RANDOM_UNAVAILABLE before returning
  undefined (the zero-topic build still probes nothing and reports nothing).
- New crossContextCacheEpochForRelease() derives `release.<fnv1a-64 hex>`
  from the release ID; bootstrap uses it (one call-site change in
  src/bootstrap/runtime-adapters.ts).
- The observation reason union gains two members (additive); the ops runbook
  lists them.

Verified: two new unit tests failed before (no observation; missing epoch
helper) and pass now. Lane gates, reference-feature and V3 integration tests,
and check:diagnostics pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:39:59 +09:00
DongHyeonkaandClaude Opus 5.5 ec71b0b0a2 refactor(web-push): merge codec primitives into one module and inject the page document (Q-6.6-12)
web-push/codec-primitives.ts now owns OPAQUE_ID/validOpaqueId, isRecord,
hasExactKeys, exactRecord, validAuthority, base64UrlDecode and (to share the
alphabet) base64UrlEncode. push-codec,
push-registration-gateway, push-association-fence-store,
push-subscription-adapter and service-worker-runtime import them instead of
carrying their own copies (the fence store's control/association key checks
now use exactRecord/hasExactKeys with the same key lists). The duplicate-key
JSON scan in push-codec.ts is untouched (realtime lane, T76).

Where the copies differed, the stricter validated behavior is kept:
- validAuthority: the fence store's null guard. The gateway's copy threw a
  TypeError for a null authority, so register()/reconcile() rejected instead
  of returning INVALID_INPUT; they now return INVALID_INPUT (the only change a
  caller can observe; characterization test was RED before the merge).
  Non-record values (arrays) are also refused.
- base64UrlDecode: the gateway's decoder, which refuses a lone trailing
  character (length % 4 == 1). The window adapter's copy accepted it when the
  spare bits were zero; its only caller pre-checks an 87-char VAPID key, so
  that difference was not reachable. `>>` vs `>>>` gave identical bytes.
- OPAQUE_ID, isRecord/hasExactKeys/exactRecord were already identical.

Page controller: PageControllerDependencies gains optional `document`; the
6-hour update check reads it (falling back to the global document), and
bootstrap/register-service-worker.ts now passes host.document through.

New adapter file: INVENTORY.md row 126 + renumber, total 137/137; detail row in
docs/reviews/adapters/05-service-worker-and-web-push.md.

Verified: characterization tests pinned the caller-visible behavior of every
copy before the merge (spare-bit keys, VAPID key, null authority in fence
store and gateway, array/extra-key backend answers, opaque ids); all pass
after, plus direct base64UrlDecode tests and an encode round-trip against
Node's base64url for lengths 0..66. Document injection test was RED
(update() ran while the injected document was hidden), green after. Gates:
check:architecture, types app/test/service-worker, lint, test:unit (only
pre-existing removal-fixture failure), test:component,
check:realtime-boundaries, check:adapter-inventory.
Realtime reference bundle (check:optional-recipes:source, already over budget
at b953142): 40139 -> 40097 gzip bytes after T89+T90.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:37:56 +09:00
DongHyeonkaandClaude Opus 5.5 9e70ae2d6c fix(web-push): open the app root when a notification click is rejected (Q-6.6-11)
D-14. A click whose data or authority was refused (EXPIRED, association or
release mismatch, unreadable fence, unknown route) closed the notification and
opened nothing, so the user's tap was silently dropped. The click adapter now
opens `<origin>/` with no handoff message in that case; the refusal is still
the returned result and the terminal observation (FAILED + reason) carries the
root window's native-effect certainty. NATIVE_FAILURE (browser refused the
target window), ABORTED and a deadline-aborted signal are not retried.
The bounded openWindow step (certainty phases + late-effect observation) is
now one helper, openWindowBounded, used by both the route open and the root
open; observeLateEffect moved to the adapter scope. No behavior change for
the route path. Net effect on the realtime reference bundle stays negative
together with T90 (see T90).

The silent push drop stays by design and is now documented with its costs
(Chrome's "updated in the background" notice, WebKit revoking subscriptions
after repeated silent pushes) in
docs/architecture/realtime-events-web-push-and-bounded-polling.md 8.4/8.5.

Verified: RED first (expired and release-mismatch clicks: openWindow never
called), then green; a guard test pins that a null target window is not
retried with the root. Gates: check:architecture, types app/test/service-worker,
lint, test:unit (only pre-existing removal-fixture failure), test:component,
check:realtime-boundaries, check:adapter-inventory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:37:56 +09:00
DongHyeonkaandClaude Opus 5.5 7e610d1d05 refactor(browser-transfer): split validation and dependency snapshots out of the upload runtime (Q-6.1-10)
resumable-upload-runtime.ts carried the upload flow, retry/deadline, the
server response decoders and eight dependency snapshot wrappers in one
2.3k-line file. Moved without changing behavior:
- runtime-dependencies.ts: the dependency types, snapshotDependencies and
  its per-collaborator wrappers, safeNow/safeRandom and the default sleep.
- upload-response-validation.ts: validateSession, validateStatus,
  validatePartCapability, the receipt check and the small shared helpers
  (exactKeys, sameFingerprint, snapshotReceipts).
The runtime re-exports ResumableUploadRuntimeDependencies, so the public
surface is unchanged. The default sleep now waits on the kernel
createAbortableOperation instead of its own timer/listener pair, so the
moved file does not add a hand-rolled abort offender (ratchet stays 20/21).
INVENTORY and the detail review list the two files.

Verified: new characterization suite resumable-upload-runtime-contract
(invalid collaborators throw at composition, methods captured at
composition, frozen observer copies, throwing clock, default sleep retry
and abort, session/capability/status/receipt rejections) written and green
before the move, still green after + existing runtime suites + all gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:33:05 +09:00
DongHyeonkaandClaude Opus 5.5 9e2c98272f fix(browser-transfer): share one presigned HTTP helper module (Q-6.1-9)
The presigned executor and the capability provider each carried a copy of
createAbortScope, readWithSignal, transferFailure, isAbortSignal,
byteBucket, body/reader cancel, Content-Length parsing and statusFailure.
They now import them from presigned/http-common.ts.

Behavior changes:
- statusFailure is one table. The provider used NONE for 401/403 and RETRY
  for 429/5xx; it now answers REISSUE_CAPABILITY like the executor. Retry
  decisions (retryable) are unchanged. Chosen because capabilities are
  single-use and the architecture doc (3.2) and BT-PRE-04 already say a
  refusal is recovered by a new capability.
- The download check used Number(Content-Length), which let "5e0", "0x5",
  "+5" and "5.0" through; it now uses the strict decimal parser the upload
  path and the provider already had.
- The executor's compensateLateResponse had no caller and is deleted.
- The resumable runtime's invokeProviderAttempt now bounds each attempt with
  the kernel createAbortableOperation instead of its own listener/timer
  race; outcomes (ABORTED on caller abort, retryable UNAVAILABLE on the
  deadline) are unchanged.

INVENTORY and the browser-transfer detail review list the new file. The
hand-rolled abort ratchet drops to 20/21; the ceiling constant is left for
the integration step so parallel lanes do not conflict on it.

Verified: RED tests "rejects a download Content-Length that is not a plain
decimal" (5e0 was accepted) and "maps capability endpoint statuses with the
executor's recovery table" (401 was NONE); existing presigned and runtime
suites cover the moved code + all gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:32:56 +09:00
DongHyeonkaandClaude Opus 5.5 818cbd3839 fix(browser-transfer): allow a PRIMARY_REQUIRED probe only with an exact-size fit (Q-6.1-7)
The probe accepts a decode only when it matches the primary candidate's
pixel size exactly. fit inside/outside keep the source ratio, so for any
asset whose ratio differs the preset could only fail with
INTEGRITY_FAILED, and PRIVATE_SIGNED forces the probe. Per D-12 the
registry now rejects PRIMARY_REQUIRED unless fit is cover, contain or
fill; ratio-preserving fits stay allowed on presets without the probe.
README and the architecture doc state the rule.

Verified: RED test "allows a PRIMARY_REQUIRED probe only with an
exact-size fit" (inside/outside were accepted) + all gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:32:37 +09:00
DongHyeonkaandClaude Opus 5.5 879ceda3bb fix(browser-transfer): let abort drop an unreadable checkpoint row (Q-6.1-6)
A corrupt row, or one a newer build wrote with an unknown schemaVersion,
failed both upload and abort with CORRUPT_DATA until the whole partition
was deleted. The checkpoint store port gains an optional
removeUnreadable(): in one transaction it deletes the row only if it does
not parse as a checkpoint (a readable row is CONFLICT, an absent row is a
success). Explicit abort calls it on a CORRUPT_DATA read and reports
ORPHANED; the server session is left to expire because the row names no
session. upload() still fails closed on such a row. The port change is
additive (optional method); the architecture doc notes the exception.

Verified: RED tests "removes an unreadable checkpoint row on abort and
reports ORPHANED" (was CORRUPT_DATA) and "removes only an unreadable row
without a revision" (method missing) + all gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:32:37 +09:00
DongHyeonkaandClaude Opus 5.5 510cd80a5c fix(storage): keep a put's own failure code when compensation fails (Q-6.5-9)
When a put failed before commit and the compensating ABORT_PUT or the
journal rollback did not complete, the coordinator returned a generic
CONFLICT / OBJECT_RECONCILE (or the rollback's own code). A user cancel or
a full disk reached the caller as a bare conflict.

compensatePreparedPut now takes the put's failure and returns it. If the
compensation completes, the failure is returned as before. If it does not,
the journal row is still left for reconciliation, and the failure keeps its
code, operation and retryable flag; only recovery becomes RECONCILE. The
architecture doc's compensation rule says the same.

Verified: new tests in tests/unit/opfs-byte-store.test.ts were RED (5
cases: failed cleanup, unknown cleanup effect, caller cancel, failed
rollback, FILES_READY failure) and are GREEN; the successful-compensation
case pins the unchanged path. All gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:30:26 +09:00
DongHyeonkaandClaude Opus 5.5 f8587e8b6f docs(storage): state that revision and generation restart after delete (Q-6.5-8)
Decision D-13 keeps the storage schema as is: IndexedDB `remove` deletes
the row without a tombstone and an OPFS delete removes the logical object
row, so a recreated key starts again at revision 1 / generation 1.

The IndexedDB write receipt's `revision` and the durable object
descriptor's `generation` now say so in the port comments, and the storage
architecture doc says it in the IndexedDB record section and the OPFS
journal rules: callers must not treat `(key, revision)` or
`(objectId, generation)` as unique across the key's lifetime, and should
compare a value they own (or the integrity root digest) when it matters.

Documentation only. verify:documentation and all gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:30:26 +09:00
DongHyeonkaandClaude Opus 5.5 16abd920a7 refactor(storage): keep IndexedDB stored-row rules in one module (Q-6.5-7)
The runtime and maintenance each carried their own Stored* row types,
isStored* validators, record size formula, countBucket and failureOf, and
the dataset binding check had a third, hand-written budget validator. A
field added to one copy would make the other judge a healthy row corrupt.

indexeddb-records.ts now holds the row types, the validators, the budget
key and measureRecordBytes (payload + 512-byte envelope + UTF-16 key). Each
call site keeps its own failure code for a bad measurement (runtime
INVALID_INPUT, maintenance MIGRATION_FAILED), and only the binding check
still bounds a stored budget by hardBudgetBytes. The one validator
difference (maintenance's retention check did not re-validate the key it
compared against) is unobservable: it always passes a validated record key.

Verified: characterization tests added first in
tests/unit/indexeddb-maintenance.test.ts pin the size formula in both
writers, the per-site failure codes for NaN/negative/oversized sizes, and
the hardBudgetBytes bound at open (runtime and maintenance fail with
POLICY_REJECTED one byte over, open at the limit). They passed before and
after the refactor. INVENTORY.md (137/137) and the storage detail table
list the new file. All gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:30:26 +09:00
DongHyeonkaandClaude Opus 5.5 2fb07c857a docs: register adapter files missing from the inventory ledger
6f6c48e added src/adapters/http/platform-error-mapping.ts and
src/adapters/telemetry/feature-telemetry.ts without ledger rows, so
check:adapter-inventory failed on the base branch. Add both rows, renumber,
update the total to 136/136 and add the matching detail-review rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:29:53 +09:00
DongHyeonkaandClaude Opus 5.5 e74d835d6a fix(storage): verify stored OPFS objects by their own chunk size (R-5.5)
Prepared objects were validated in three places with different rules. The
worker required integrity.chunkSizeBytes, chunk sizes, chunk count and
object size to match the current runtime policy; the journal checked the
object against itself; the page only checked the shape. Changing
chunkSizeBytes (allowed by opfs-policy) made every existing object fail:
open returned INTEGRITY_FAILED, FILES_READY reconcile failed CORRUPT_DATA
(and, had cleanup succeeded, would have rolled back a valid object), and
COMMITTED reconcile failed INVALID_INPUT at FINALIZE_PUT.

The journal's policy-free rules move to opfs-prepared-object.ts, the one
definition of isPreparedObject (and of the physical schema check). The
worker's VERIFY_OBJECT, READ_CHUNK, FINALIZE_PUT and FILES_READY receipt
paths and the page's FINISH_PUT parse use it, so a stored object is
checked against its own manifest. The current policy still governs new
writes only: validateObjectWriteInput, BEGIN_PUT's chunk size check and
APPEND_CHUNK's size and count limits are unchanged. stableJson keeps its
two copies; they differ in how a non-finite number fails and unifying
them would change error mapping.

Verified: new test "R-5.5 stored objects are checked against their own
chunk size" writes an object with 64 KiB chunks, then reconciles and opens
it through a 128 KiB runtime. Before the fix reconcile failed CORRUPT_DATA
and open failed INTEGRITY_FAILED; now reconcile commits without rollback,
the bytes read back, and a new put uses 128 KiB chunks. A new journal test
pins that a 4 MiB-chunk object round-trips and an inconsistent one is
still rejected (passes before and after). Inventory and the storage
detail review list the new file.
Gates: check:architecture, check:types:app/test/web-worker, lint,
test:component pass; test:unit passes except removal-fixture.test.ts
(needs gitignored release artifacts absent from a fresh worktree);
check:adapter-inventory accepts the new row but still reports two rows
already missing at f0d3953 (http/platform-error-mapping.ts,
telemetry/feature-telemetry.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:27:48 +09:00
DongHyeonkaandClaude Opus 5.5 a0176e9ff2 fix(cache-storage): accept browser-managed Vary and require content-type in policy (R-2.5)
The default policy has allowedVaryHeaderNames: [], so any Vary header was
POLICY_REJECTED. nginx `gzip_vary` and most CDNs send
`Vary: Accept-Encoding` on JS and CSS, so the default policy could not
stage real assets. Accept-Encoding is a forbidden request header, so a
policy could not allowlist it as a request header either.

validateVary now skips `accept-encoding`. No script-built Request carries
that header, so the stored and lookup requests both lack it and Cache.match
still matches exactly. Every other Vary name keeps the existing checks.

A policy whose allowedResponseHeaderNames lacked `content-type` passed
assertPublicCachePolicy, but activation re-validates the stored
Content-Type, so every activation failed as INTEGRITY_FAILED. The policy
check now rejects it. The ops runbook lists both rules.

Verified: "stages, activates and looks up a Vary: Accept-Encoding response
with the default policy" (stage returned ok:false) and "rejects a policy
that strips Content-Type from stored responses" (no throw) 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>
2026-09-24 12:15:58 +09:00
DongHyeonkaandClaude Opus 5.5 a80b153163 fix(cross-context): keep broadcast receive after publish failure, report degraded open (R-2.3)
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>
2026-09-24 12:15:58 +09:00
DongHyeonkaandClaude Opus 5.5 b5e3690caa docs: add full src review (2026-09-24)
Record the whole-src review findings by area with severity, location,
failure scenario, fix direction and test coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 11:43:46 +09:00
donghyeon-ka 6f6c48ebb7 refactor: 도메인이 100개 1000개씩 늘어나도 유지보수 쉬운 구조로 변경 2026-09-24 00:42:21 +09:00