Skip to content

WL-0MMNCOIYF18YPLFB: add structured audit writes and doctor JSON migration apply#973

Merged
SorraTheOrc merged 4 commits intomainfrom
feature/WL-0MMNCOIYF18YPLFB-audit-text-write-path
Mar 21, 2026
Merged

WL-0MMNCOIYF18YPLFB: add structured audit writes and doctor JSON migration apply#973
SorraTheOrc merged 4 commits intomainfrom
feature/WL-0MMNCOIYF18YPLFB-audit-text-write-path

Conversation

@SorraTheOrc
Copy link
Member

Summary

  • add a structured --audit-text write path for create/update that stores audit as { time, author, text } with generated metadata and overwrite semantics
  • persist and expose audit data across DB/JSONL/API/read paths, including migration support for the audit column and show formatting updates
  • fix wl doctor upgrade --confirm --json so JSON mode actually applies migrations and returns applied/backups

Validation

  • 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.ts
  • npm run test -- tests/cli/doctor-upgrade.test.ts tests/migrations.test.ts
  • npm test (fails on existing unrelated tests/cli/github-push-batching.test.ts timeout/database-open issue)

Review Focus

  • CLI option wiring and normalization for --audit-text in create/update paths
  • persistence and migration behavior for workitems.audit
  • doctor JSON-mode parity between preview and confirm paths

Work Items

  • Audit Write Path via CLI Update (WL-0MMNCOIYF18YPLFB)
  • Doctor upgrade --json should apply migrations with --confirm (WL-0MMZIV38S1V7XRL3)

@SorraTheOrc SorraTheOrc force-pushed the feature/WL-0MMNCOIYF18YPLFB-audit-text-write-path branch from 91499e6 to 94c30df Compare March 21, 2026 10:17
@SorraTheOrc SorraTheOrc requested a review from Copilot March 21, 2026 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 --audit kept as a legacy alias) and persists workitems.audit as { time, author, text }.
  • Adds/updates migration and doctor-upgrade behavior to support the new audit DB 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.

@SorraTheOrc
Copy link
Member Author

All CI checks are passing

This PR is ready for review.

Posted automatically by AMPA PR Monitor.

SorraTheOrc and others added 2 commits March 21, 2026 08:36
@SorraTheOrc SorraTheOrc merged commit 989a98f into main Mar 21, 2026
4 checks passed
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