Add authorized conversation create, list and history (#13) #48
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/rag-rust!48
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/13-authorized-conversations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements issue #13 (C01): authorized conversation create, list and history, built on the identity (#9) and central authorization (#10) work. Follows the plan; the guide is
docs/operations/conversations.md.This does not authorize operational or classified data. OD-08 and OD-12 in the decision register are still proposals. Synthetic data and development wiring only.
What it adds
POST /api/v1/conversations(cookie, exact origin, CSRF token; reads no body),GET /api/v1/conversations?cursor=&limit=(default 20, max 50) andGET /api/v1/conversations/{id}/messages?before=&limit=(default 50, max 100). No totals anywhere;Systemmessages are never returned.permits(Conversation, ReadHistory, ..)for the conversation and for every message with that row's own marking and policy version, plus a source check per message. Revoked messages are omitted: no redaction, no placeholder.no-store.CONVERSATION_CURSOR_KEY_HEX(32 bytes as 64 hex characters, distinct from the delivery and decoy keys, no sample value).listand sequence-pagedmessages_beforein the PostgreSQL repository. Migration0007adds a partial index, drops the redundant old index and creates expression statistics so the planner walks the index.Enforcer::beginreturnsSession<RequestAccess>(itsReadyis not a grant); new craterag-conversations(depends only onrag-domain) holds the use cases;ViewRolemakesSystemunrepresentable in views.Verification (this branch, local PostgreSQL 17)
cargo fmt --all -- --checkandcargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo test --workspace --locked: 101 passed, 0 failed, 100 ignored (the PostgreSQL suites).bash scripts/test-postgres.sh --local: all nine suites pass (admin 4, authz 13, conversations API 10, conversations revocation 6, identity 30, policy 1, foundation 21, recovery 9, revocation 6).bash scripts/coverage.sh rust, gate 80%). Web is unchanged: 22 tests and the build pass.ANALYZE, the repository's own SQL, no scan-type switches or index drops).list, unsealed cursor, dropped owner binding, System mapped to User) were each caught and reverted.Please note
AUDIT(#11)hook comment where an event will be emitted.proposed; the security authority and records owner should look at this change explicitly. Nothing here is approved.DenyAllSources).ANALYZEhaving run; a freshly migrated table before its first autovacuum could still get the slower plan.checked_mulfor the grant lifetime.postgres.rsreadiness test and therecovery_postgresrate-limit test.Refs #13, #11, #10, #9, #2.
🤖 Generated with Claude Code
Add POST/GET /api/v1/conversations and GET /api/v1/conversations/{id}/messages over Enforcer::begin and ConversationService, with strict query parsing, the uniform 404/400/503 outcomes and Cache-Control: no-store everywhere. Create needs the session cookie, exact origin and CSRF token and reads no body field. Implement AccessCheck for RequestAccess and an AES-256-GCM list cursor sealer keyed by the new CONVERSATION_CURSOR_KEY_HEX. main.rs mounts the routes only with identity, with DenyAllSources and a development-only static policy snapshot. Add the real-PostgreSQL boundary suite and register it in the PostgreSQL and coverage runners. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>