feat(auth): readSubject 필수화로 토큰 갱신 시 서버 상태 캐시 유지 #3
Closed
donghyeon.kang
wants to merge 1 commits from
fix/session-subject-required into main
pull from: fix/session-subject-required
merge into: :main
:main
:fix/r9-structure-locale
:fix/r9-adapter-carryover
:test/shared-build-lock-order
:ci/dependency-cache-same-filesystem
:ci/release-tag-for-a11y-review
:ci/merge-dependency-cache
:fix/test-timeouts-measured
:fix/feature-residue-word-boundary
:fix/provider-wait-stderr
:fix/provider-job-host-requirements
:fix/ungated-vitest-spec
:fix/a11y-evidence-routes
:fix/verify-parts-diagnostics
:claude/w2-fe-ci-perf-dce080
:fix/child-process-test-timeouts
:chore/layout-rules-r2-r5
:claude/fe-b-docs-korean-645f55
:chore/ci-merge-jobs
:chore/layout-3-merge
:claude/fe-c-harness-0ae061
:chore/layout-2-sample-removal
:chore/layout-1-cleanup
:docs/review-guide-pointer
:fix/maturity-review-2026-11-06
:fix/maturity-review-2026-11-05-b
:docs/improvement-manual
:fix/maturity-review-2026-11-05
:fix/session-subject-required
:fix/ui-design-audit-2026-11-01
:fix/maturity-review-2026-09-25
:lane/D
:lane/B
:fix/src-review-round3
:refactor/domain-scalable
:develop
:feature-frontend-optional-adapter-recipes
:feature-frontend-supply-chain-verification
:feature-frontend-test-registry-evidence-hardening
:frontend-test-registry-evidence-hardening
:feature-frontend-diagnostics-telemetry-runtime
:feature-frontend-i18n-message-formatting-contract
:feature-frontend-design-system-platform
:feature-frontend-form-page-platform
:feature-frontend-reference-feature-vertical-slice
:feature-frontend-routing-release-recovery-runtime
:feature-frontend-http-query-contract-execution
:feature-frontend-application-boundary-runtime
:feature-frontend-typescript-tooling-foundation
:feature-frontend-platform-capability-review
:feature-frontend-performance-route-contract
:feature-frontend-starter-experience-quality-contract
:feature-frontend-responsive-theme-contract
:feature-frontend-ui-primitives-gallery-contract
:feature-frontend-app-shell-navigation-contract
:feature-frontend-runtime-composition-contract
:feature-frontend-ci-quality-gates-contract
:feature-web-vitals-performance-budget-contract
:feature-frontend-release-cache-rollback-contract
:feature-accessibility-baseline-contract
:feature-frontend-project-bootstrap-toolchain-contract
:feature-frontend-operational-runbook-contract
:feature-frontend-contract-compatibility-governance
:feature-frontend-contract-registry-governance
:feature-frontend-browser-security-boundary-contract
:feature-frontend-build-bundle-supply-chain-contract
:feature-tailwind-design-token-styling-contract
:feature-sample-feature-slice-contract-fixture
:feature-frontend-render-recovery-boundary-contract
:feature-routing-navigation-guard-contract
:feature-boundary-mapper-viewmodel-contract
:feature-async-ui-state-contract
:feature-frontend-observability-logging-trace-contract
:feature-frontend-storage-registry-contract
:feature-server-state-caching-contract
:feature-frontend-auth-session-integration-contract
:feature-frontend-error-classification-boundary-contract
:feature-runtime-schema-validation-contract
:feature-api-client-response-envelope-contract
:feature-frontend-env-runtime-config-contract
:feature-frontend-architecture-enforcement-lint-contract
:feature-frontend-test-taxonomy-contract
:feature-frontend-clean-architecture-layering-contract
No Reviewers
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
donghyeon.kang (동현 강)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: donghyeon.kang/clean-architecture-frontend-template#3
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
요약
세션 캐시 처리를 "안전하지만 투박한" 방식에서 식별값 기반 방식으로 바꿉니다.
readSubject()가 필수가 됩니다(타입 + 부트 시 owner 검사).SessionGateway.getSubject()도 필수가 됩니다.cache.operation.failed {operation: SCOPE_FENCE, reason: SUBJECT_MISSING}진단을 남깁니다.docs/architecture/starter-experience.md에readSubject규약(OIDCsub, Supabasesession.user.id, Firebaseuser.uid같은 값, 토큰 금지)과 마이그레이션 메모를 추가했습니다.연동 쪽 breaking change
readSubject()를 구현해야 합니다. 없으면 시작할 때 세션이integration-failed가 됩니다.AuthSessionPort/SessionGateway를 직접 구현하는 코드는getSubject()를 추가해야 합니다.검증
🤖 Generated with Claude Code
An external owner without readSubject made every authenticated notification (every token refresh) abort requests and clear the server-state cache. readSubject is now a required owner method and getSubject a required SessionGateway method. - ExternalSessionOwner.readSubject(): required; the host owner check (EXTERNAL_OWNER_METHODS) rejects an owner without it, so the session fails closed as integration-failed like any other missing method. - SessionGateway.getSubject(): required. Anonymous and unavailable adapters return null; demo already returned its fixed user. - Scope runtime: same (state, subject) still skips the fence; a state or subject change still fences. An authenticated session with a null/empty subject still fences (fail closed) and now records cache.operation.failed {operation: SCOPE_FENCE, reason: SUBJECT_MISSING} once per fence. Bootstrap passes diagnostics in. - Docs: starter-experience external owner section and port comments describe what readSubject returns, the fail-closed diagnostic and a migration note. RED before the change (vitest tests/unit/server-state-scope-runtime.test.ts tests/unit/runtime-adapters.test.ts): 4 failed | 31 passed - fails closed when the owner lacks readSubject: expected 'authenticated' to be 'integration-failed' - fences and reports SUBJECT_MISSING ... null / empty subject, and the external owner whose readSubject returns null: expected [] to deeply equal [[{ level: 'warn', ... }]] - type level: an owner literal without readSubject compiled (tsc exit 0). The new @ts-expect-error pin fails check:types:test with TS2578 if readSubject becomes optional again. Pins that stayed green: same-subject token refresh keeps the cache, subject change fences, sign-out fences, owner missing readState is rejected. GREEN: check:architecture, check:types:app, check:types:test, lint, test:unit (2084), test:component (182), test:reference-feature (59), test:integration (151), verify:documentation, check:diagnostics, check:ci all pass. BREAKING: external auth owners must implement readSubject(); code that implements AuthSessionPort/SessionGateway directly must implement getSubject(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Pull request closed