Skip to content

[codex] Add audit debugging platform PRD#114

Open
erskingardner wants to merge 6 commits into
masterfrom
codex/audit-debugging-prd
Open

[codex] Add audit debugging platform PRD#114
erskingardner wants to merge 6 commits into
masterfrom
codex/audit-debugging-prd

Conversation

@erskingardner

@erskingardner erskingardner commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

Adds a draft PRD for evolving Goggles from a raw audit-log browser into a forensic debugging platform for Marmot audit logs.

The PRD covers:

  • transport message flow views across engines
  • convergence state-machine and branch-selection views
  • MLS/group state evolution views
  • derived data model and API requirements
  • Dark Matter and client audit-log data gaps
  • explicit audit data modes for obfuscated logging versus opt-in full data auditing
  • rollout plan, open questions, and risks

Validation

  • just check

Open in Stage

Summary by CodeRabbit

  • Documentation
    • Added a draft PRD for the Goggles Audit Debugging Platform, defining an “audit debugging workstation” workflow with evidence-backed investigation questions, evidence-linked derived views, and a group-first workspace structure.
    • Documented audit data modes (default obfuscated vs opt-in full), including mode boundaries, artifact stamping, and access/authorization expectations to reduce sensitive-data exposure risk.
    • Added an “audit log event v2” JSON Schema with strict top-level validation and additional obfuscated-mode constraints for sensitive fields.

@stage-review

stage-review Bot commented Jun 24, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Define audit debugging platform requirements
2 Specify audit-log event v2 JSON schema
Open in Stage

Chapters generated by Stage for commit 765fdbc on Jun 25, 2026 2:21pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

A PRD is added for the Goggles audit debugging platform, and a new v2 JSON Schema defines forensic audit log events with shared context, evidence, event unions, and audit-data-mode validation rules.

Changes

Audit debugging platform design and schema

Layer / File(s) Summary
PRD scope and audit modes
docs/audit-debugging-platform-prd.md
The PRD header, product summary, background, goals, non-goals, user roles, and audit data-mode rules are defined together, including the obfuscated versus full-data boundaries and mode-boundary requirements.
PRD investigation views and workspace
docs/audit-debugging-platform-prd.md
The transport, convergence, and MLS/group-state investigation views are defined, along with the group-first workspace layout, derived forensic object model, and evidence-reference requirements for deep links.
PRD API, rollout, and risks
docs/audit-debugging-platform-prd.md
The PRD adds audit data gaps, API requirements, functional priorities, rollout phases, review decisions, open questions, and risks for the debugging platform.
Schema contract and shared types
docs/schemas/audit-log-event.v2.schema.json
The schema defines the root metadata, required top-level fields, shared numeric and JSON value primitives, context shapes, and evidence-related transport and message structures.
Schema event union and obfuscated validation
docs/schemas/audit-log-event.v2.schema.json
The schema enumerates the discriminated audit event kinds and applies the audit-data-mode conditional rule that restricts sensitive source fields and event payload shapes in obfuscated mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding an audit debugging platform PRD.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/audit-debugging-prd

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 markdownlint-cli2 (0.22.1)
docs/audit-debugging-platform-prd.md

markdownlint-cli2 v0.22.1 (markdownlint v0.40.0)
Error: Unable to use configuration file '/coderabbit-0.markdownlint-cli2.jsonc'; ENOENT: no such file or directory, open '/coderabbit-0.markdownlint-cli2.jsonc'
at throwForConfigurationFile (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:48:9)
at readOptionsOrConfig (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:169:5)
at async main (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:927:21)
at async file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2-bin.mjs:14:22 {
[cause]: Error: ENOENT: no such file or directory, open '/coderabbit-0.markdownlint-cli2.jsonc'
at async open (node:internal/fs/promises:640:25)
at async Object.readFile (node:internal/fs/promises:1287:14)
at async readOptionsOrConfig (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:141:17)
at async main (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:927:21)
at async file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2-bin.mjs:14:22 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/coderabbit-0.markdownlint-cli2.jsonc'
}
}


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/audit-debugging-platform-prd.md`:
- Around line 129-135: Make the full data auditing rollout dependent on an
explicit retention/deletion/access-control policy before it can be enabled.
Update the PRD section around the full data auditing requirements and the open
question near the retention/deletion item so that the policy is a prerequisite
deliverable, not an unresolved follow-up. Use the existing “full data auditing,”
“mode-change audit rows,” and “retention/deletion/access-control” sections to
keep the requirement and rollout gating aligned.
- Around line 338-350: The read-endpoint requirements are too generic and only
mention authentication, so update the PRD section around the listed GET routes
to explicitly define object-level authorization and tenant scoping for each
cross-entity resource. In the endpoints list and the related “Require
authentication” requirements, add per-object access checks for
group/account/engine membership, anti-enumeration behavior for unauthorized or
unknown resources, and least-privilege defaults for baseline responses so the
rules are clear for every read path.
- Around line 259-262: The EvidenceRef shape is exposing raw event JSON on every
derived object, which should be removed from the ubiquitous reference type.
Update the PRD sections around EvidenceRef so it is pointer-only, keeping only
the identifying fields such as file_id, line, and hash, and move raw JSON access
to a separate privileged evidence retrieval flow. Make the same adjustment
wherever EvidenceRef is described, including the later duplicate mention, so all
derived objects still carry evidence references without embedding payload data.
🪄 Autofix (Beta)

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: CHILL

Plan: Pro

Run ID: 2de3bd98-b9ad-4a99-bb3b-a58ec95f78e1

📥 Commits

Reviewing files that changed from the base of the PR and between 3abf2cc and 4cdb397.

📒 Files selected for processing (1)
  • docs/audit-debugging-platform-prd.md

Comment thread docs/audit-debugging-platform-prd.md
Comment thread docs/audit-debugging-platform-prd.md Outdated
Comment thread docs/audit-debugging-platform-prd.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (3)
docs/audit-debugging-platform-prd.md (3)

270-272: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Remove raw payload embedding from EvidenceRef.

EvidenceRef still includes raw JSON, which overexposes sensitive data on every derived object. Keep it pointer-only and require privileged evidence fetch for payload content.

🤖 Prompt for 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.

In `@docs/audit-debugging-platform-prd.md` around lines 270 - 272, Remove raw
payload fields from EvidenceRef and keep it pointer-only: update the EvidenceRef
definition and any derived-object construction so it retains only identifying
reference data like raw file id, line number, line hash, and raw kind type,
while excluding raw JSON. Then adjust any code or docs that assume payload
embedding in EvidenceRef to use privileged evidence fetch for content access,
using the EvidenceRef and derived object references to locate the affected
definitions.

372-387: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Authentication-only requirement is insufficient for these read endpoints.

Add explicit object-level authorization and tenant/account/group/engine scoping requirements (plus anti-enumeration behavior) for all listed read routes.

🤖 Prompt for 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.

In `@docs/audit-debugging-platform-prd.md` around lines 372 - 387, The read-route
guidance under the API contract is missing object-level authorization and scope
enforcement, so update the requirements around the documented endpoints to
explicitly call out tenant/account/group/engine scoping, per-object
authorization checks, and anti-enumeration behavior. Use the existing stable API
section and the listed read-route requirements to add that every access path
must verify the caller’s scope before returning data, not just authenticate, and
ensure the response behavior does not reveal resource existence across
unauthorized tenants or accounts.

490-505: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Make full-data retention/deletion/access-control policy a rollout gate, not an open follow-up.

The PRD still allows retaining full-data audit files while deferring deletion/retention policy details. This should be a prerequisite before enabling/continuing full-data auditing.

🤖 Prompt for 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.

In `@docs/audit-debugging-platform-prd.md` around lines 490 - 505, The full-data
retention/deletion/access-control policy is still deferred in the PRD, but it
needs to be defined as a rollout gate before full-data auditing can proceed.
Update the “During the internal-testing phase” guidance and the “Remaining Open
Questions” section in audit-debugging-platform-prd.md so the retention period,
deletion mechanism, and access-control requirements are explicit and required,
rather than left as a later follow-up.
🤖 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.

Duplicate comments:
In `@docs/audit-debugging-platform-prd.md`:
- Around line 270-272: Remove raw payload fields from EvidenceRef and keep it
pointer-only: update the EvidenceRef definition and any derived-object
construction so it retains only identifying reference data like raw file id,
line number, line hash, and raw kind type, while excluding raw JSON. Then adjust
any code or docs that assume payload embedding in EvidenceRef to use privileged
evidence fetch for content access, using the EvidenceRef and derived object
references to locate the affected definitions.
- Around line 372-387: The read-route guidance under the API contract is missing
object-level authorization and scope enforcement, so update the requirements
around the documented endpoints to explicitly call out
tenant/account/group/engine scoping, per-object authorization checks, and
anti-enumeration behavior. Use the existing stable API section and the listed
read-route requirements to add that every access path must verify the caller’s
scope before returning data, not just authenticate, and ensure the response
behavior does not reveal resource existence across unauthorized tenants or
accounts.
- Around line 490-505: The full-data retention/deletion/access-control policy is
still deferred in the PRD, but it needs to be defined as a rollout gate before
full-data auditing can proceed. Update the “During the internal-testing phase”
guidance and the “Remaining Open Questions” section in
audit-debugging-platform-prd.md so the retention period, deletion mechanism, and
access-control requirements are explicit and required, rather than left as a
later follow-up.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdbd70ac-c926-4b6a-a1a9-bb7c0a76faf3

📥 Commits

Reviewing files that changed from the base of the PR and between 4cdb397 and c31a43c.

📒 Files selected for processing (1)
  • docs/audit-debugging-platform-prd.md

@erskingardner erskingardner marked this pull request as ready for review June 24, 2026 14:40
Comment on lines +350 to +351
"msg_id": {
"$ref": "#/$defs/hexString"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should msg_id be the MLS content id (SHA-256 of the MLS bytes)? It’s undocumented and typed as any-length hex, not digestHex.

Comment on lines +477 to +478
"member_removed",
"member_left",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just something to note, member_left vs member_removed reads as a voluntary-vs-admin split, but the engine only distinguishes them on the normal path, a departure resolved through convergence is always recorded as member_removed with no actor, even a voluntary self-leave.
We'll need to distinguish member_removed with an actor (admin removal) from member_removed with actor = None

Comment on lines +290 to +292
"welcome_event_id": {
"$ref": "#/$defs/hexString"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

welcome_event_id is hexString while its siblings (nostr_event_id, gift_wrap_event_id) are digestHex, is this intentional? Which welcome id is it: the outer kind-1059, the inner kind-444 rumor, the KeyPackage e-tag (the one that links back to the adding commit) or something else?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/audit-debugging-platform-prd.md (1)

410-429: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Make the data-mode signal per object, not just per response.

A response-level classification is too coarse for the mixed-mode comparisons this PRD explicitly allows. Clients need per-derived-object mode metadata so they can tell which rows may contain plaintext versus digests.

Suggested PRD tweak
- Support filters for audit data mode and a response-level classification that tells clients whether decrypted content may be present.
+ Support filters for audit data mode.
+ Each returned derived object must carry its own audit-data-mode classification
+ (obfuscated_sensitive_data vs full_data); response-level metadata may only be a
+ coarse summary.
🤖 Prompt for 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.

In `@docs/audit-debugging-platform-prd.md` around lines 410 - 429, The audit
data-mode signal is currently described only at the response level, but it needs
to be tracked per derived object so mixed-mode results can be interpreted
correctly. Update the PRD text around the audit data mode and response-level
classification requirements to specify object-level mode metadata on each
derived object/row, indicating whether that object may contain plaintext or only
digests. Keep the existing least-privilege and evidence-ref guidance, but make
the mode classification explicit per object rather than only per response.
🤖 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/audit-debugging-platform-prd.md`:
- Around line 140-146: The PRD’s retention/deletion policy in the
audit-debugging platform spec needs to explicitly require that purge/delete
operations themselves create an immutable audit record. Update the policy text
around the full-data auditing requirements to state that when the documented
audit-data purge command is run, the deletion action must be written to a
separate durable audit trail that is retained even after the underlying forensic
evidence is removed; keep this aligned with the existing retention and
access-control language in the same section.

---

Outside diff comments:
In `@docs/audit-debugging-platform-prd.md`:
- Around line 410-429: The audit data-mode signal is currently described only at
the response level, but it needs to be tracked per derived object so mixed-mode
results can be interpreted correctly. Update the PRD text around the audit data
mode and response-level classification requirements to specify object-level mode
metadata on each derived object/row, indicating whether that object may contain
plaintext or only digests. Keep the existing least-privilege and evidence-ref
guidance, but make the mode classification explicit per object rather than only
per response.
🪄 Autofix (Beta)

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: CHILL

Plan: Pro

Run ID: 21824229-56ac-4646-9318-91b8a961d272

📥 Commits

Reviewing files that changed from the base of the PR and between 60e9792 and 765fdbc.

📒 Files selected for processing (1)
  • docs/audit-debugging-platform-prd.md

Comment on lines +140 to +146
Full data auditing must not be enabled unless the deployment has an explicit
retention, deletion, and access-control policy in place. For the current
internal-testing deployment, that policy is: retain uploaded audit evidence until
an authenticated operator runs the documented audit-data purge command, allow
read access only to authenticated internal Goggles users, and allow uploads to be
paused during cutovers or incidents. Broader deployments must define stricter
object-level access rules before full-data capture is enabled.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Require purge/deletion actions to be auditable.

The retention policy allows an operator to delete forensic evidence, but the PRD never requires an immutable audit row for the deletion itself. In a forensic system, the delete action needs to survive the purge.

Suggested PRD tweak
- retain uploaded audit evidence until an authenticated operator runs the documented audit-data purge command
+ retain uploaded audit evidence until an authenticated operator runs the documented audit-data purge command,
+ and emit immutable audit rows for each purge request/result, retained independently
+ from the deleted evidence.

Also applies to: 545-549

🧰 Tools
🪛 LanguageTool

[grammar] ~144-~144: Ensure spelling is correct
Context: ...d access only to authenticated internal Goggles users, and allow uploads to be paused d...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for 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.

In `@docs/audit-debugging-platform-prd.md` around lines 140 - 146, The PRD’s
retention/deletion policy in the audit-debugging platform spec needs to
explicitly require that purge/delete operations themselves create an immutable
audit record. Update the policy text around the full-data auditing requirements
to state that when the documented audit-data purge command is run, the deletion
action must be written to a separate durable audit trail that is retained even
after the underlying forensic evidence is removed; keep this aligned with the
existing retention and access-control language in the same section.

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.

2 participants