hyperlane-plugin-session 23.3.1

A high-concurrency sharded session management plugin for the Hyperlane framework with pluggable async SessionStore traits, optional HMAC-SHA256 signed cookies, dirty-tracked zero-write reads, and session-fixation ID regeneration.
Documentation
# AGENTS.md — `hyperlane-plugin-session`

Concise engineering and iteration guidelines for `hyperlane-plugin-session` (`plugin/session/`).
Global rules live in [`../../.agents/skills/hyperlane/SKILL.md`](../../.agents/skills/hyperlane/SKILL.md), [`../README.md`](../README.md), and `~/.agents/skills/rust-standards/SKILL.md`.

## Scope & Module Boundaries

- **Role**: 64-shard bounded `InMemorySessionStore`, pluggable `SessionStore`, HMAC-SHA256 signed cookies, dirty-tracked `SessionHandle`, and `SessionRequestHook`/`SessionResponseHook`.
- **Dependencies**: Internal `hyperlane`; external `lombok-macros`.
- **Layout**: `src/{lib,const,fn,impl,static,struct,trait,type}.rs` (`SESSION_PLUGIN`, seed/seq statics, and `SessionFxHashMap` stay `pub(crate)`); tests in `tests/`.

## Core Iteration Invariants

- **Hook contract & order**: `SessionRequestHook` (`#[hyperlane::request_middleware(-85)]`) and `SessionResponseHook` (`#[hyperlane::response_middleware(-70)]`) MUST remain transparent (`Status::Continue`) when `SESSION_PLUGIN` is unconfigured.
- **Dirty-tracked zero-write reads**: Short-circuit `persist_from_context` via `SessionHandleInner::dirty` (`AtomicBool`) without locking `Mutex<SessionState>` on clean reads — zero store writes and no redundant `Set-Cookie`.
- **Session-fixation & cookie signing defense**: Never adopt unverified, tampered, unknown, or expired client session IDs (always mint a fresh 128-bit hex ID); on `regenerate_id()`, delete `previous_id` before saving the new ID; on `destroy()`, clear with `Max-Age=0`; verify HMAC-SHA256 signatures in constant time and reject invalid RFC 6265 cookie bytes.
- **Bounded 64-shard store & sync fast path**: Maintain 64 cache-line-aligned shards enforcing atomic `max_sessions` with lazy expiration and expired-entry purges; keep `fast_store` unboxed for in-memory sessions.

## Code & Documentation Standards

- Follow `rust-standards`: pure 9-keyword filenames, 3-section `mod.rs`, centralized imports in `src/lib.rs` and `tests/mod.rs`, `pub(crate)` struct fields with `lombok-macros` accessors (no `self.field`), explicit types on all `let`/closure bindings, zero `#[allow]`/`unwrap()`/`expect()`/`panic!()`, `pub` before `pub(crate)` in `const.rs`/`static.rs`, strict `Cargo.toml` dependency order, and comment-free tests in `tests/`.
- Keep all code, comments, docs, and commits pure English. Update `plugin/session/README.md` (and `plugin/README.md` / root `README.md` if hook order or public surface changes) in the same commit.

## Local Verification

```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-session --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-session --all-features
python3 ~/.agents/skills/rust-standards/scripts/staged_file_gate.py .
python3 ~/.agents/skills/rust-standards/scripts/verify_dep_order.py .
```