Skip to content

Normalize maintenance error classification, redaction, and recovery hints #4856

Description

@Widthdom

Summary

Maintenance commands disagree on missing/corrupt/locked DB failures: vacuum --json emits human stderr, backfill uses a basename, optimize/integrity expose absolute paths, and SQLite error 26 (“file is not a database”) recommends retrying a writer lock.

Audit IDs: O-02, O-03, O-26. Reproduced on v1.40.3.

Existing issue relationship

Residual/follow-up to closed #1526 and #4338, which established error/status/maintenance diagnostics.

Expected behavior

All maintenance commands share a versioned DB error classifier, support-safe redaction, and condition-specific recovery guidance.

PR scope

Keep this to missing/not-a-database/corrupt/locked classification across maintenance commands.

Implementation guide for Codex 5.6 sol xhigh

  • Classify using SQLite result/extended codes and validated file state, not message substring alone.
  • Route vacuum, backfill, optimize, and integrity through one error DTO/writer.
  • Apply the shared redaction policy while preserving an explicit diagnostic mode.
  • Recommend create/rebuild/import/integrity actions for missing/corrupt data and retry/owner diagnostics only for real locks.
  • Test JSON/human, relative/absolute paths, invalid header, corruption, locks, and platform differences.
  • Run full tests and add a bilingual changelog fragment referencing Error messages lack stable machine-readable error codes #1526/Audit SQLite maintenance, migration, WAL, and prune boundaries #4338.

Acceptance criteria

  • JSON mode always returns valid structured errors.
  • Equivalent failures have equivalent codes/categories/redaction.
  • Corruption never receives lock-retry guidance.
  • Sensitive absolute paths are not leaked by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codebugSomething isn't workingsecurity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions