feat(audit): visibility-aware kb.audit queries#247
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
6e306cc to
dc81ced
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cf2514f2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0cf2514 to
30d694c
Compare
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@plind-junior please review |
What changed
kb.audit/vouch auditnow accept optional viewer context (project,agent, or nestedviewer_scopeon JSONL).audit.read_events()can filter events whoseobject_idsreference scoped claims, sources, or claim proposals outside that context; events with noobject_idsare always included. Filtering is wired through MCP, JSONL, CLI, and the web audit timeline. Capabilities advertiseskb.auditunder scoped methods; spec and CHANGELOG updated.Why
gbrain-style multi-project KBs need audit timelines that respect the same visibility model as retrieval — a reviewer in project A should not see project B's audit events. Issue #232. This builds on VEP-0005 (
ArtifactScope/ViewerContext) by enforcing scope on the audit read path instead of leaving filtering to callers.What might break
Breaking (API):
kb.auditno longer returns a bare[AuditEvent]array. It now returns{ "viewer": { "project", "agent" }, "events": [...] }on MCP and JSONL. CLI--jsonoutput matches that envelope.Non-breaking (on-disk): No changes to
.vouch/layout, audit log format, or proposal/claim files. Existingaudit.log.jsonlentries are untouched. Callers that useaudit.read_events(kb_dir)withoutviewer/store(metrics, stats, provenance) still see the full log.VEP
Extends VEP-0005 (richer scopes / retrieval filtering). No new on-disk schema; audit read filtering only. Tracked in #232.
Tests
make checkpasses locally (lint + mypy + pytest) — note: one pre-existing failure intest_import_apply_rejects_absolute_pathunrelated to this branchtests/test_audit_scoping.py, updates totest_audit.py,test_scoping.py)CHANGELOG.mdupdated under## [Unreleased]