Skip to content

docs(audit): add JSON output schema reference for runok audit --json#338

Merged
fohte merged 4 commits into
mainfrom
fohte/docs-audit-json-schema
May 4, 2026
Merged

docs(audit): add JSON output schema reference for runok audit --json#338
fohte merged 4 commits into
mainfrom
fohte/docs-audit-json-schema

Conversation

@fohte
Copy link
Copy Markdown
Owner

@fohte fohte commented May 4, 2026

Purpose

  • Let readers parsing runok audit --json with jq look up each field's type, possible values, and omission conditions without opening the runok source.

Approach

  • Add cli/audit-log-schema.md covering every field of one runok audit --json entry.
  • Replace the command_evaluations explanation in cli/audit.md with a link to the new page so the usage and reference pages serve different reader paths.
Design decisions

Where to place the doc

Decision Design Pros Cons
Chosen Carve out a new page cli/audit-log-schema.md Separates the reader paths for usage and JSON type information. Mirrors how configuration/schema.md is positioned alongside the feature pages. One more sidebar item.
Rejected Expand cli/audit.md field-by-field to absorb it Single page covers everything. Mixes the usage reader path with the JSON-parsing reference path. cli/audit.md becomes overloaded.

fohte added 3 commits May 4, 2026 15:30
intent(audit): let users write jq queries against audit logs without
  reading runok source. cli/audit.md only had a partial command_evaluations
  description and no top-level / enum / nested-object reference.
decision(audit): split into a dedicated cli/audit-log-schema.md page
  rather than expanding cli/audit.md, mirroring how configuration/schema.md
  is its own reference page separate from feature pages. cli/audit.md keeps
  the usage-focused content and links out for the field reference.
intent(audit): fix incorrect schema claims in the new audit-log-schema
  page. The first revision documented values that the production writers
  never produce, which would mislead anyone writing jq queries.
learned(audit): runok check does not emit audit log entries
  (CheckAdapter.is_auditable() is false), so endpoint_type is exec or
  hook only.
learned(audit): no-rule-match cases never produce action.type "default"
  in the JSON. From<Action> for SerializableAction maps only
  Allow / Deny / Ask, and rule_engine.default_action returns one of
  those three. SerializableAction::Default exists for the TUI formatter
  and roundtrip tests, not for audit JSON output.
learned(audit): chrono Utc::now().to_rfc3339() emits sub-second precision
  with a +00:00 offset (e.g. 2026-04-29T04:09:48.090565+00:00), not the
  Z form. jq literal-string comparisons need to match this shape.
learned(audit): sandbox_preset is also null when compound branches
  match different presets (SandboxInfo::MergedPolicy path), not only
  when no sandbox was applied.
intent(release-notes): satisfy the CLAUDE.md rule that next.md entries
  must carry a PR link before merge.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.77%. Comparing base (dbea3e7) to head (832e744).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #338      +/-   ##
==========================================
+ Coverage   88.75%   88.77%   +0.01%     
==========================================
  Files          53       53              
  Lines       12317    12317              
==========================================
+ Hits        10932    10934       +2     
+ Misses       1385     1383       -2     
Flag Coverage Δ
Linux 88.56% <ø> (-0.02%) ⬇️
macOS 89.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a dedicated documentation page for the runok audit --json schema, providing a comprehensive field-by-field reference. It refactors the existing audit.md file to link to this new page, removes redundant descriptions, and updates the sidebar ordering for several CLI documentation pages. The release notes are also updated to include the new schema reference. I have no feedback to provide.

intent(audit): keep the reference focused on the current schema.
  Pre-v0.3.0 shape changes and the legacy-read compatibility note are
  release-note material, not reference material — they don't help
  someone parsing today's output with jq.
@fohte fohte merged commit 8c82962 into main May 4, 2026
10 checks passed
@fohte fohte deleted the fohte/docs-audit-json-schema branch May 4, 2026 09:46
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.

1 participant