Skip to content

feat: Cave oversight dashboard endpoints — routing + audit (#18)#63

Merged
BunsDev merged 2 commits into
mainfrom
feat/issue-18-cave-dashboard
Jul 7, 2026
Merged

feat: Cave oversight dashboard endpoints — routing + audit (#18)#63
BunsDev merged 2 commits into
mainfrom
feat/issue-18-cave-dashboard

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 7, 2026

Copy link
Copy Markdown
Member

Closes #18. The coven-github data behind Cave's four oversight views. Two of the four already had endpoints from earlier work; this adds the two that were missing.

The four dashboard views

View Endpoint Status
Task history GET /api/github/tasks existed (#3)
Usage GET /api/github/usage existed (#15)
Familiar routing GET /api/github/routing this PR
Audit events GET /api/github/audit this PR

What's new

  • GET /api/github/routing[?installation_id=N]Config::routing_view resolves an installation's effective familiars, trigger lanes, and per-repo overrides (open routing / listed allow-list / fail-closed), mirroring Add installation-scoped familiar routing and repository policy #7's scope_for at the installation level. A tenant sees its own installation; the service token names one via the query string.
  • GET /api/github/auditStore::audit_events assembles a tenant-scoped, newest-first task-lifecycle stream from three durable sources: ignored deliveries (acceptance rejections), task attempts (execution / retries / timeout / failure), and opened PRs (publication) — exactly the audit events Build Cave oversight dashboard for task history, routing, usage, and audit #18 asks for.

Both endpoints use the same tenant boundary as the rest of the API (token mode fails closed, tenant tokens are installation-scoped, every read audited), and the Cave UI (coven-cave repo) consumes them. README's capabilities table gains a Cave-oversight-dashboard row.

Scope

This is the adapter's data side. The dashboard rendering lives in coven-cave. "Human intervention" audit events (cancel/deepen commands) are already recorded via api_audit; the stream here focuses on task lifecycle.

Local gates: cargo check --all-targets + cargo clippy --all-targets -- -D warnings + cargo test --all (228 passed, 0 failed).

🤖 Generated with Claude Code

BunsDev added 2 commits July 7, 2026 02:39
…dashboard (#18)

Config::routing_view resolves an installation's effective familiars, trigger
lanes, and per-repo overrides (open / listed / fail-closed) as a serializable
view. Store::audit_events assembles a tenant-scoped, newest-first task-lifecycle
stream from ignored deliveries, task attempts (execution/retries/timeout), and
opened PRs — the data behind the dashboard's routing and audit views.

Signed-off-by: Val Alexander <bunsthedev@gmail.com>
Adds the two data endpoints Cave still needed, tenant-scoped and audited like
the rest: GET /api/github/routing (effective familiars + trigger lanes + repo
overrides per installation) and GET /api/github/audit (task-lifecycle stream —
acceptance, execution/retries/timeout, PR creation). With the existing task and
usage endpoints, Cave's four oversight views are all backed. README updated.

Closes #18.

Signed-off-by: Val Alexander <bunsthedev@gmail.com>
Copilot AI review requested due to automatic review settings July 7, 2026 07:44
@BunsDev
BunsDev merged commit e14230d into main Jul 7, 2026
2 checks passed
@BunsDev
BunsDev deleted the feat/issue-18-cave-dashboard branch July 7, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the remaining backend endpoints needed for Cave’s oversight dashboard in coven-github, exposing tenant-scoped routing policy and a task-lifecycle audit stream alongside the existing tasks/usage views.

Changes:

  • Adds GET /api/github/routing and GET /api/github/audit Axum handlers and wires them into the server router.
  • Introduces Config::routing_view (serialized RoutingView) and Store::audit_events (serialized AuditEvent) to provide dashboard-ready data.
  • Updates README capabilities table to include the Cave oversight dashboard feature row.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Documents the Cave oversight dashboard capability and the four endpoints it uses.
crates/webhook/src/routes.rs Adds the new /api/github/audit and /api/github/routing handlers plus tenancy tests.
crates/store/src/lib.rs Adds AuditEvent and Store::audit_events to assemble a lifecycle stream from durable sources.
crates/server/src/main.rs Registers the new routes on the Axum router.
crates/config/src/lib.rs Adds RoutingView and Config::routing_view to expose effective installation routing configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +458 to +463
let view = state.config.routing_view(installation_id);
let _ = state
.store
.record_api_read(&caller, &installation_id.to_string(), action, "ok")
.await;
Json(json!({ "ok": true, "routing": view })).into_response()
Comment on lines +440 to +443
ApiCaller::Tenant(tenant) => (
format!("tenant:{}", tenant.installation_id),
tenant.installation_id,
),
Comment thread crates/store/src/lib.rs
Comment on lines +530 to +536
pub async fn audit_events(&self, scope: Option<ApiScope>, limit: u32) -> Result<Vec<AuditEvent>> {
let conn = self.conn.clone();
tokio::task::spawn_blocking(move || {
let conn = conn.lock().expect("store mutex poisoned");
let inst = scope.as_ref().map(|s| s.installation_id);
let mut events: Vec<AuditEvent> = Vec::new();

Comment on lines +444 to +456
ApiCaller::Service | ApiCaller::Open => {
match params.get("installation_id").and_then(|s| s.parse::<u64>().ok()) {
Some(id) => ("service".to_string(), id),
None => {
return (
StatusCode::BAD_REQUEST,
Json(json!({"ok": false, "error": "installation_id required"})),
)
.into_response()
}
}
}
};
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.

Build Cave oversight dashboard for task history, routing, usage, and audit

2 participants