Skip to content

refactor(cookie): widen CookieJar to L13 shape — queue path-aware + make sameSite/raw (task 2.12) - #54

Open
agissept wants to merge 2 commits into
migration/2.15-pagination-gettersfrom
migration/2.12-cookie-jar-widen
Open

agissept wants to merge 2 commits into
migration/2.15-pagination-gettersfrom
migration/2.12-cookie-jar-widen

Conversation

@agissept

@agissept agissept commented Sep 15, 2026

Copy link
Copy Markdown
Member

Task 2.12 (cookie jar widen) [fork]

Konvergensi surface CookieJar ke L13 — additive & behavior-preserving. Dua bagian:

Part 1 — queue path-aware

  • queue() nested [name][path]; queued()/hasQueued()/unqueue() + $path opsional (null = last-for-name, semantik L13). getQueuedCookies() flatten → Cookie[] (Arr::flatten).
  • Tambah expire() + flushQueuedCookies().
  • Konsumen (Cookie\Queue decorator, QueueingFactory) foreach nilai → aman.

Part 2 — make()/forever() raw + sameSite

  • Tambah param L13 raw + sameSite; route secure/sameSite via getPathAndDomain + jar-default baru.
  • Behavior-preserving: jar-default SameSite = 'lax' (default efektif Symfony/L4.2 sekarang), bukan null ala L13 → caller 7-arg lama tak berubah; app bisa set per-cookie sameSite/raw.

Verifikasi

phpunit tests/Cookie7 hijau (42 assertions) (path-aware, expire/flush, sameSite/raw). AuthGuardTest + SessionStoreTest hijau. Lint bersih.

⏭️ Ditunda (flip/swap-coupled)

setDefaultPathAndDomain secure/sameSite (null-out risk untuk caller 2-arg), CookieValuePrefix (v2 HMAC), middleware EncryptCookies/AddQueuedCookiesToResponse/StartSession/AuthenticateSession (rewrite decorator Guard/Queue, kernel-flip-coupled). Session Contracts decouple sudah di task 3.4 (#40).

Urutan

Stacked di atas #53 (stack: #45#46#48#52#53←**#54**). Blocker (1.1, 2.9) ✅.

🤖 Generated with Claude Code

agissept and others added 2 commits September 15, 2026 17:29
… 2.12, part 1)

Converge the CookieJar queue surface to L13 (additive / callability widen):

- Path-aware queued storage: queue() now nests as [name][path]; queued(),
  hasQueued(), unqueue() take an optional $path (null = last-for-name, L13
  semantics). getQueuedCookies() flattens to a Cookie[] list (Arr::flatten)
  -- the Queue decorator + QueueingFactory consumers foreach over values, so
  they are unaffected.
- Add expire($name, $path, $domain) and flushQueuedCookies() (L13 methods).

Tests: switch the queued/unqueue asserts from array-key to hasQueued()
(getQueuedCookies is now a flat list) + add path-aware and expire/flush
coverage. tests/Cookie green (6), Auth/Session cookie tests green.

Deferred (flip/swap-coupled, task 2.12 remainder): make()/forever() raw +
sameSite params (security-relevant Symfony default), jar-default secure/
sameSite on setDefaultPathAndDomain, CookieValuePrefix (v2 HMAC), and the
EncryptCookies/AddQueuedCookiesToResponse/StartSession/AuthenticateSession
middleware (Guard/Queue decorator rewrite, kernel-flip-coupled). Session
Contracts decouple already landed (task 3.4, #40).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…12, part 2)

Add the L13 raw + sameSite params to make()/forever() and route secure/
sameSite through getPathAndDomain via new jar defaults. Additive and
behavior-preserving: the jar SameSite default is 'lax' (the effective
Symfony/L4.2 default today) rather than L13's null, so existing 7-arg callers
are unchanged; apps can now set per-cookie sameSite/raw.

setDefaultPathAndDomain kept at ($path, $domain) here -- widening its
secure/sameSite would null-out SameSite for current 2-arg callers, so it
ships with the config-driven EncryptCookies middleware (deferred).

Tests: +testSameSiteAndRawWidening (default 'lax' + overrides). tests/Cookie
green (7), Auth/Session cookie tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agissept agissept changed the title refactor(cookie): widen CookieJar queue to L13 path-aware shape (task 2.12, part 1) refactor(cookie): widen CookieJar to L13 shape — queue path-aware + make sameSite/raw (task 2.12) Sep 15, 2026
@agissept agissept self-assigned this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant