Skip to content

Integrate confirmed missing inventory-row pruning into safe workspace cleanup #996

Description

@chubes4

Problem

DMC has a safe workspace inventory prune-missing primitive, but workspace cleanup safe does not invoke it. A full safe cleanup can therefore complete successfully while leaving confirmed-absent inventory rows and a persistently noisy hygiene report.

Reproduction

After applying:

studio wp datamachine-code workspace cleanup safe --format=json

workspace hygiene still reported 60 missing inventory paths. The dedicated preview then classified 53 rows for deletion and protected seven present paths:

studio wp datamachine-code workspace inventory prune-missing --dry-run --format=json

Observed summary:

{
  "deleted": 53,
  "skipped": 7,
  "total": 60
}

The pruning primitive was introduced by #869, but operators still need to know and run a separate cleanup surface.

Impact

  • safe_workspace_cleanup does not converge workspace hygiene.
  • inventory_missing_paths remains noisy after successful cleanup.
  • Dead historical primaries look like unresolved workspace problems.
  • Operators need undocumented sequencing between cleanup and inventory maintenance.

Expected contract

Safe workspace cleanup should include a bounded missing-inventory reconciliation stage using the existing fresh path and safety checks. Dry-run should report planned row pruning; apply should prune only rows that still pass revalidation.

Acceptance criteria

  • workspace cleanup safe --dry-run reports confirmed missing-row candidates and skips.
  • Apply rechecks path absence immediately before pruning.
  • Rows with protected PR/unpushed evidence retain the existing force boundary.
  • Present paths, primaries recreated during cleanup, and ambiguous remote-owned rows are preserved.
  • Cleanup evidence reports pruned row count separately from removed worktrees and artifacts.
  • A successful safe cleanup converges inventory_missing_paths when no blockers remain.

Related

AI assistance

  • AI assistance: Yes
  • Model: OpenAI openai/gpt-5.6-sol
  • Tool: OpenCode
  • Used for: live cleanup and prune previews, contract-gap analysis, duplicate search, and issue drafting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions