WL-0MMNCOIYF18YPLFB: add structured audit writes and doctor JSON migration apply#973
Merged
SorraTheOrc merged 4 commits intomainfrom Mar 21, 2026
Merged
Conversation
91499e6 to
94c30df
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds structured audit write support across CLI/API/DB/JSONL and fixes wl doctor upgrade --confirm --json to actually apply migrations and report results.
Changes:
- Introduces structured audit writes via
--audit-text(with--auditkept as a legacy alias) and persistsworkitems.auditas{ time, author, text }. - Adds/updates migration and doctor-upgrade behavior to support the new
auditDB column and JSON-mode apply/metadata output. - Updates formatting/types/tests to carry audit through DB/JSONL/API/read paths.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/audit.test.ts | Removes legacy audit utility + migration tests that relied on the old audit/status model. |
| tests/normalize-sqlite-bindings.test.ts | Adds audit object to SQLite binding round-trip coverage. |
| tests/migrations.test.ts | Adds focused migration tests for adding the audit column. |
| tests/database.test.ts | Adds DB-level tests for creating/updating structured audit. |
| tests/cli/issue-status.test.ts | Verifies show --json includes audit after update --audit-text. |
| tests/cli/issue-management.test.ts | Adds help/CLI wiring tests for --audit-text and config gating behavior. |
| tests/cli/initialization-check.test.ts | Ensures update with --audit-text fails when repo is not initialized. |
| tests/cli/doctor-upgrade.test.ts | Adds CLI tests ensuring JSON dry-run previews and JSON confirm applies migrations. |
| tests/cli/cli-helpers.ts | Extends seeded work item shape to include audit in CLI tests. |
| tests/audit.test.ts | Adds new unit tests for buildAuditEntry under the simplified audit model. |
| src/types.ts | Replaces AuditEntry/status model with WorkItemAudit and adds auditWriteEnabled config. |
| src/tui/types.ts | Extends TUI work item type to include structured audit. |
| src/persistent-store.ts | Bumps schema version and includes audit column and persistence bindings. |
| src/migrations/index.ts | Renames/adds audit migration id and adjusts pending/apply + schemaVersion update logic. |
| src/jsonl.ts | Normalizes audit null/undefined during JSONL import. |
| src/database.ts | Ensures audit is carried through update input merging logic. |
| src/audit.ts | Simplifies audit entry building to { time, author, text } with author resolution. |
| src/commands/create.ts | Adds --audit-text option, legacy alias, and config gating for audit writes. |
| src/commands/update.ts | Adds --audit-text option, legacy alias, and config gating for audit writes. |
| src/commands/helpers.ts | Updates human formatting to display audit without the removed status field. |
| src/commands/doctor.ts | Makes JSON-mode doctor upgrade --confirm actually apply migrations and return applied/backups. |
| src/api.ts | Normalizes string audit input to structured audit and adds config gating for audit writes. |
| docs/migrations.md | Documents audit migration behavior and overwrite-only semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
All CI checks are passingThis PR is ready for review. Posted automatically by AMPA PR Monitor. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--audit-textwrite path forcreate/updatethat storesauditas{ time, author, text }with generated metadata and overwrite semanticsauditcolumn and show formatting updateswl doctor upgrade --confirm --jsonso JSON mode actually applies migrations and returnsapplied/backupsValidation
npm run test -- tests/cli/issue-management.test.ts tests/cli/issue-status.test.ts tests/cli/initialization-check.test.ts tests/audit.test.ts tests/database.test.ts tests/normalize-sqlite-bindings.test.tsnpm run test -- tests/cli/doctor-upgrade.test.ts tests/migrations.test.tsnpm test(fails on existing unrelatedtests/cli/github-push-batching.test.tstimeout/database-open issue)Review Focus
--audit-textin create/update pathsworkitems.auditWork Items