refactor(core): rfc 0026 green b1 — token store moves to ourios-core - #395
Conversation
The ingest enforcement point (RFC 0026 §3.2) lives in ourios-ingester's listeners, which cannot depend on ourios-server; the store, tenant-set, validation, and constant-time comparison move to ourios_core::auth behind a config-agnostic TokenSpec, with ourios-server keeping the AuthSection mapping and re-exports. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the RFC 0026 token-store implementation by relocating the resolved token store (types + validation + constant-time token comparison) from ourios-server into ourios-core, allowing future enforcement points (notably ourios-ingester) to consume the same logic without depending on the server crate.
Changes:
- Moved
TokenStore/ResolvedToken/TenantSet+ validation +authenticateintoourios_core::auth, introducing a config-agnosticTokenSpecinput. - Simplified
ourios-server::authto mapAuthSection→TokenSpec, call core validation, and re-export the auth types. - Shifted the
subtledependency fromourios-servertoourios-coreand updated the lockfile accordingly.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/ourios-server/src/auth.rs | Becomes a thin mapping layer and re-export surface for core auth types. |
| crates/ourios-server/Cargo.toml | Removes direct subtle dependency (now owned by core). |
| crates/ourios-core/src/lib.rs | Exposes the new auth module publicly. |
| crates/ourios-core/src/auth.rs | New home for token store types, validation, redacted Debug, and constant-time comparison. |
| crates/ourios-core/Cargo.toml | Adds subtle dependency required by the moved implementation. |
| Cargo.lock | Reflects dependency movement (subtle now associated with ourios-core). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rror Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
RFC 0026 green slice (b1) — a preparatory, behavior-preserving move: the token store relocates from
ourios-server::authtoourios_core::auth.Why
Slice (b2) puts the ingest enforcement (RFC0026.2/.3, the §3.2 authn + tenant binding) where the listeners live:
ourios-ingester's gRPC interceptor and HTTP middleware — which is also where the red stubs sit (crates/ourios-ingester/tests/rfc0026_auth.rs). The ingester cannot depend onourios-server, so the shared types move down:TokenStore/ResolvedToken/TenantSet, the validation, and the constant-timeauthenticate(viasubtle, dep moved server→core) now live inourios_core::auth, behind a config-agnosticTokenSpecinput shape.ourios-server::authkeeps theAuthSection → TokenSpecmapping and re-exports the types, so the single validation path (RFC 0020 §3.1) is unchanged — it just lives one crate lower.No behavior change: the five store unit tests moved to core verbatim; the server side keeps a mapping-fidelity test plus all RFC0026.1 arms (schema, mapping, spawned-binary) exactly as merged in #390.
Invariants / hazards
Debugredactions and name-only error surfaces carry their tests with them;TokenSpecgets the same redactingDebugas the schema type it mirrors.Checks run locally
cargo fmt --all --check,cargo clippy -p ourios-core -p ourios-server --all-targets --all-features -- -D warnings,cargo test -p ourios-core -p ourios-server --all-features— all green.🤖 Generated with Claude Code