-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Audit Read Path in Show Outputs (WL-0MMNCOJ0V0IFM2SN)
Headline
Add a clear, machine-parseable audit object to wl show --json and render a safe, human-friendly audit summary in both single-item and children/list human outputs.
Problem statement
Add a reliable read-path for the new structured audit field so operators and automation can discover audit metadata in both JSON and human wl show outputs. Currently the project is standardizing on a structured audit field (time, author, text) but the show/read surfaces are incomplete.
Users
- Operators and maintainers who use
wl showto inspect work items (examples: record of migrations, manual fixes, handoffs). - Automation and CI scripts that parse
wl show --jsonto detect or record recent audits.
Example user stories
- As a maintainer, I want
wl show WL-...to display a short, readable audit summary so I can quickly confirm recent manual actions. - As an automation author, I want
wl show <id> --jsonto includeauditso scripts can rely on structured metadata for reporting and gating.
Success criteria
wl show <id> --jsonincludes anauditobject when present; when absent, noauditkey is emitted or it is null/omitted per existing JSON conventions.- Human
wl show <id>(single-item view) renders a readable audit summary following the repository's redaction/safety rules (see WL-0MMNCOIYS15A1YSI). - Human children/list outputs include the same concise audit summary (one-line) alongside item metadata so audit presence is visible without opening every item.
- Items without audit do not show noisy empty placeholders in any human view.
- Tests: unit and integration tests cover JSON inclusion/omission, human single-item and list rendering, snapshot tests for human output, and an integration roundtrip with the write-path (WL-0MMNCOIYF18YPLFB).
Constraints
- Follow the repository's Redaction and Safety Rules for Audit Text (WL-0MMNCOIYS15A1YSI); do not display sensitive content in human output.
- Maintain backward compatibility: add
auditas an additive field in JSON and keep existing output contracts unchanged except for additive audit metadata. - Rendering changes should be conservative and reversible; prefer reuse of existing display helpers in
src/commands/helpers.tsand CLI formatting conventions. - This read-path depends on the Data Model & Migration work (WL-0MMNCNT1M16ESD04) and the CLI write-path (WL-0MMNCOIYF18YPLFB); coordinate with those items rather than attempting data-model changes here.
Existing state
- Work item: Audit Read Path in Show Outputs (WL-0MMNCOJ0V0IFM2SN) already exists and is staged
idea. Its description listssrc/commands/show.ts,src/commands/helpers.ts, andsrc/types.tsas relevant locations. - Related work: a write-path intake exists (
Audit Write Path via CLI UpdateWL-0MMNCOIYF18YPLFB), a parent item to replace comment-based audits (WL-0MLDJ34RQ1ODWRY0), data-model/migration work (WL-0MMNCNT1M16ESD04), and a redaction/safety item (WL-0MMNCOIYS15A1YSI). - Code locations with audit mentions include
src/github-sync.tsand persistent store code; tests referencing FieldChange/audit-like records exist undertests/.
Desired change
- Update
src/commands/show.tsand related display helpers to:- Include
auditinwl show --jsonoutput when present. - Render a concise, one-line human summary of
auditin both single-item and child/list human outputs, following redaction rules and truncation policy from WL-0MMNCOIYS15A1YSI. - Ensure items without audit do not render noisy placeholders.
- Include
- Add tests: unit tests for JSON inclusion/omission, snapshot tests for human output (single-item and list), and an integration test validating roundtrip with the CLI write-path (WL-0MMNCOIYF18YPLFB).
Related work
- Audit Write Path via CLI Update (WL-0MMNCOIYF18YPLFB) — write-path that sets
audit.time,audit.author, andaudit.textviawl update --audit-text. This read-path should be compatible with that write behavior. - Replace comment-based audits with structured audit field (WL-0MLDJ34RQ1ODWRY0) — parent/umbrella work to consolidate audit-related changes.
- Audit Data Model and Migration (WL-0MMNCNT1M16ESD04) — ensures DB and store support structured
auditfield; read-path depends on migration being available. - Redaction and Safety Rules for Audit Text (WL-0MMNCOIYS15A1YSI) — defines what must be redacted or truncated from human output; read implementation must use these rules.
- src/commands/show.ts — primary code to update.
- src/commands/helpers.ts — reuse formatting helpers where possible.
- src/types.ts — ensure
audittype is present and exported for formatters.
Notes / Implementation guidance
- Keep JSON output additive and stable: include
auditonly when present to avoid breaking JSON consumers. - For human outputs, render a one-line summary in lists and under metadata for single-item displays. The one-line should include
time,authorand a truncated/redactedtextexcerpt per WL-0MMNCOIYS15A1YSI. - Coordinate with the authors of WL-0MMNCOIYF18YPLFB and WL-0MMNCNT1M16ESD04 for migration order and integration tests.
- Tests should include both presence and absence cases and validate no noisy placeholders appear.
Risks & assumptions
- Risk: Scope creep — additional formatting requests or feature asks may expand scope. Mitigation: record new feature requests or refactors as separate work items linked to this one; do not expand scope in this change.
- Risk: Sensitive content leakage —
audit.textmay contain secrets or PII. Mitigation: apply the Redaction and Safety Rules (WL-0MMNCOIYS15A1YSI) and truncate human output; full text remains in JSON only for authorized automation. - Risk: Migration ordering — reading audit requires the data model/migration (WL-0MMNCNT1M16ESD04) to be applied. Mitigation: add an explicit integration test that is skipped or mocked if migration is not present and coordinate release ordering with the migration work item.
- Assumption: The
auditfield is a single latest-entry object (time, author, text) as defined by related work (WL-0MMNCOIYF18YPLFB); we are not implementing an audit history array in this item.
Final summary
Add a safe, human-friendly read path for the structured audit field: include audit in wl show --json and render a redacted, truncated one-line audit summary in both single-item and list/children human outputs so operators and automation can reliably discover recent audits.
Acceptance mapping (how success criteria map to deliverables)
- Code:
src/commands/show.ts,src/commands/helpers.ts,src/types.ts— implements JSON and human rendering. - Tests: unit + snapshot + integration roundtrip with write-path.
- Docs: small note in CLI docs describing
auditread behavior and how human output is redacted/truncated (reference WL-0MMNCOIYS15A1YSI).
Next action
Please review the draft above and either approve it or request changes (specify edits or clarifications). Do you approve this intake brief as-is, or would you like changes?