docs(mcp): decide stateless profile context - #378
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis change documents a stateless profile-context decision, adds an AES-256-GCM prototype for authenticated profile handles, and adds contract and behavior tests for binding, isolation, expiry, revocation, redaction, and rollout requirements. ChangesStateless profile context
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AuthenticatedRequest
participant StatelessProfileContextPrototype
participant ProfileContextRevocations
AuthenticatedRequest->>StatelessProfileContextPrototype: mint profile handle
StatelessProfileContextPrototype-->>AuthenticatedRequest: encrypted handle
AuthenticatedRequest->>StatelessProfileContextPrototype: resolve handle with authenticated context
StatelessProfileContextPrototype->>ProfileContextRevocations: check revocation
ProfileContextRevocations-->>StatelessProfileContextPrototype: status
StatelessProfileContextPrototype-->>AuthenticatedRequest: resolved profile and audit correlation
Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/plans/2026-08-11-stateless-profile-context-decision.md`:
- Around line 15-23: Define an authenticated key-epoch field or envelope header
for the selected handle format, and specify how instances select keys from the
keyring during rotation. Document the active and previously valid epochs,
overlap period, and validation rules so unexpired handles remain resolvable
while new handles use the current epoch.
In `@tests/prototypes/stateless-profile-context.ts`:
- Around line 150-170: Update resolvePayload and revoke to normalize all
unexpected failures to the fixed PROFILE_CONTEXT_INVALID error. Wrap
authentication validation, payload opening and validation, and
revocations.isRevoked/revocations.revoke calls so empty or non-string inputs and
backend exceptions cannot escape unchanged; preserve only the explicit
PROFILE_CONTEXT_EXPIRED and PROFILE_CONTEXT_REVOKED errors.
In `@tests/stateless-profile-context-prototype.test.ts`:
- Around line 58-83: Add issuer and audience mismatch rejection cases alongside
the existing identity and deployment checks in the “binds every resolution…”
test, using modified authenticated contexts and expecting
PROFILE_CONTEXT_INVALID. Add a cross-chat revoke attempt for a handle owned by
another chat, assert that revoke is rejected, then resolve that handle
successfully to verify the shared revocation state was unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a5691fff-04dd-4e36-a094-6f3771e469df
📒 Files selected for processing (4)
docs/plans/2026-08-11-stateless-profile-context-decision.mdtests/prototypes/stateless-profile-context.tstests/stateless-profile-context-docs-contract.test.tstests/stateless-profile-context-prototype.test.ts
Resolves #364
Parent: #362
Follow-ups: #376, #377
Outcome
Records the fail-closed design for modern stateless profile routing and adds a non-shipping executable prototype.
The prototype stays under tests and is excluded by the npm files allowlist.
Validation
External contract
Summary by CodeRabbit
New Features
Security
Tests