8 Commits
Author SHA1 Message Date
DongHyeonka a145f30b48 fix(web-push): dot segment가 든 registry path를 생성 때 거절한다
문제
registry path는 router base path를 뺀 앱 경로이고, 정상 클릭은
`${appBasePath}${path}`를 URL로 풀어 연다. registry 검사는 `/` 시작,
`//`·`\`·`#` 금지, 같은 origin만 본다. URL parser는 `..`와 `%2e%2e`를
dot segment로 풀기 때문에 scope `/app/`에서 `/../admin`과
`/%2e%2e/admin`이 모두 `https://app.example.test/admin`을 연다(리뷰
실험 ⑤). 검사를 통과한 경로가 앱 밖을 연다.

고른 방법
- safePath가 `new URL(path, base)`의 pathname + search가 입력과 같을 때만
  받는다. `..`·`.`·`%2e%2e`(대소문자 무관)는 parser가 바꾸므로 거절된다.
  query는 그대로 남는다.
- 버린 대안: 클릭 때 target.pathname이 앱 루트 아래인지 보기. 잘못된
  registry가 클릭할 때에야 드러난다. registry는 제품 코드라 생성 시점에
  throw하는 쪽이 이르고 작다(리뷰 5.3 (a)).

위험·한계
- 정규화되지 않은 경로(인코딩 안 된 비ASCII 문자, 빈 query `?`)도
  거절된다. registry를 쓰는 제품 코드는 아직 없다.
- registry가 서버가 내려주는 런타임 데이터가 되면 클릭 때 검사도 함께
  둬야 한다(리뷰 재검토 조건).

검증
- 새 테스트를 옛 코드에 돌림: 5건 실패(RED). 새 코드: web-push 단위
  6파일 76건 통과.
- 바꾼 파일 eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/06-adapters-service-worker-push.md 06-02
2026-11-04 20:24:14 +09:00
DongHyeonka c67edd2557 fix(web-push): 정상 알림 클릭이 router base path 아래 경로를 연다 (06-01)
문제: Web Push 정상 클릭은 registry path를 origin 기준으로 풀었다
(`new URL(path, origin)`). 거절된 클릭은 이미 앱 루트(=
registration.scope = router base path)를 쓴다(06-09). 그래서
VITE_ROUTER_BASE_PATH=/app/ 배포에서 열린 창이 없으면 정상 클릭이
https://host/inbox, 즉 앱 밖을 열었다. registry에 /app/inbox를 넣으면
openWindow는 맞지만 같은 값이 handoff path로 페이지에 가서 router
basename과 겹친다. 어떤 registry 값으로도 두 경로를 함께 맞출 수
없었다.

고른 방법: registry path를 "base path를 뺀 앱 기준 경로"로 정하고,
클릭 어댑터가 앱 루트의 pathname(끝 / 제외)을 앞에 붙여 openWindow
대상을 만든다. handoff path는 registry 값 그대로 둔다. same-origin·
userinfo·hash 검사(safeTarget)는 그대로 거친다. 규칙은
WebPushNotificationDefinition.path 주석, appRootUrl 주석, 설계 8.5절에
적었다. 앱 루트가 origin 루트(기본값)면 결과가 전과 같다.

버린 대안: 리뷰가 적은 `new URL(path.slice(1), appRootUrl)`. 앱 루트가
/로 끝나지 않으면(`https://host/app`) 마지막 segment가 사라지고,
`/a:b` 같은 경로는 `a:b`가 scheme으로 읽혀 거절된다. pathname을 앞에
붙이면 두 경우 모두 의도대로 된다.

위험·한계:
- realtime 레시피 번들(web-push 포함) 40,879 -> 40,897 / 40,900 gzip
  B(+18 B, 여유 3 B). 예산은 그대로다. 다음 realtime·web-push 변경은
  예산 인상과 함께 와야 한다.
- 페이지가 handoff path를 basename 기준으로 쓰는지는 제품 코드 몫이라
  확인하지 않았다(템플릿에는 handoff 소비자가 없다).
- 실제 브라우저·푸시 서비스에서는 실행하지 않았다.

검증:
- RED: 새 테스트 "opens an accepted click's route under the base
  path"가 수정 전 openWindow 인자 `https://app.example.test/inbox`
  (기대 `https://app.example.test/app/inbox`)로 실패(1 failed | 19
  passed).
- GREEN: 같은 테스트가 통과하고, 열린 창에는 handoff path `/inbox`가
  간다. `node scripts/run-vitest.ts run tests/unit/web-push
  tests/unit/sub-path-deployment.test.ts
  tests/unit/service-worker-web-push-remediation.test.ts` -> 8파일
  82건 통과(web-push-worker-runtime 20건 포함).
- `npx tsc` app·test·service-worker -> 오류 0.
- `npx eslint <바꾼 ts 3개> --max-warnings=0` -> 통과.
- `node scripts/check-realtime-boundaries.ts` -> PASS,
  `node scripts/check-optional-recipes.ts` -> PASS(realtime
  40897/40900), `node scripts/verify-documentation-readiness.ts` ->
  PASS_SCOPED.

Refs: docs/reviews/2026-11-01-maturity-review/06-adapters-service-worker-push.md 06-01
2026-11-01 22:49:38 +09:00
DongHyeonkaandClaude Opus 5.5 dd7a44677b fix(web-push): open the registration scope for a refused click (06-09)
The fallback opened `${origin}/`, outside the app under a router base path.
The scope host now passes registration.scope and the click adapter opens it,
refusing any app root outside the origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 01:06:48 +09:00
DongHyeonkaandClaude Opus 5.5 8522cb5256 fix(web-push): accept WebIDL notifications whose data is a prototype getter (06-01)
Real Notification objects expose `data` as a getter on the prototype, so the
own-property check dropped every click. The runtime test now uses a
class-based fake with the WebIDL shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 23:58:19 +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 d7b35cfca3 fix: bound the activation marker in bytes and give a click one observer
The marker read added a whole chunk to a running total and compared the
total afterwards, so a corrupt body could hand activation a 1 MiB chunk
against a 257-byte ceiling. It now reads at most the remaining allowance —
through a BYOB reader where the source offers one, and by refusing an
oversized chunk before copying it otherwise. A declared oversize cancels
the body it refuses instead of leaving the stream open, and the reader
lock is released on every path.

The build generator and the runtime decoder shared only the extension
table, not the path grammar. The generator happily emitted
`/assets/bad@name-abcdefgh.js`, which the decoder then refused — a correct
build failing at install time. Both now use one exported canonical path
predicate and the generator decodes its own output before returning it.

The notification click handler emitted its terminal record from inside
`process` and again from the `waitUntil` wrapper, so an ordinary click was
counted twice. Worse, a late rejection downgraded `MAYBE_APPLIED` to
`NOT_APPLIED` — telling operators the click had definitely not been
applied when nobody knew that — and the late observation ran outside
`waitUntil`, so a worker shutdown lost the evidence. There is one
observation authority per click now, certainty is monotone, only an
explicit null window confirms `NOT_APPLIED`, and the bounded tail is owned
by `waitUntil` without extending the public deadline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 01:26:14 +09:00
DongHyeonkaandClaude Opus 5 fce8e046ea fix: bind Web Push mutations to exact authority
WP-01: a CAS receipt is only evidence when it names the expected key and the
exact next revision. Write and remove now share one validator, so a stale or
arbitrary repository receipt can no longer be packaged as a confirmed control.

WP-05: a pre-aborted command records the operation the caller requested instead
of always reporting an inspection.

WP-06: bounded fan-out is reported honestly. The subscriptionchange client
handoff and the notification cleanup both emit countBucket and truncated, and an
incomplete cleanup returns { complete: false } and is observed as DEGRADED
separately from revoke authority.

WP-07: the user-visible native notification effect is tracked through
NOT_APPLIED, MAYBE_APPLIED and CONFIRMED phases and surfaced as observation
evidence, never as retry authorization.

WP-02, WP-03 and WP-04 stay open: they need the V2 wire protocol with server
request-shape negotiation, which belongs to the versioned-migration task rather
than this correctness pass. The ledger records them as DEFERRED_TO_MIGRATION.

Web Push remains NOT_SELECTED and AVAILABLE_NOT_COMPOSED.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 00:34:09 +09:00
donghyeon-ka 6c52cdb916 feat: 기능 추가 과정중 2026-07-30 15:58:20 +09:00