Skip to content

Add direct bounded apply mode for worktree metadata reconciliation #343

@chubes4

Description

@chubes4

Problem

After deploying DMC v0.33.0, bounded reconcile-metadata --dry-run --limit/--offset works, but applying each page still requires writing a JSON plan file and passing --apply-plan=<file> back through WP-CLI.

That is fragile in Studio because absolute host paths may not be readable from the WordPress CLI context.

Observed on 2026-05-11:

  • reconcile-metadata --dry-run --limit=50 --offset=0 --format=json completed and reported page evidence.
  • Applying an absolute path failed:
    • Metadata reconciliation plan is not readable: /var/folders/.../plan-0.json
    • Metadata reconciliation plan is not readable: /Users/chubes/Studio/.../plan-0.json
  • A site-relative plan path under wp-content/uploads/datamachine-files/... worked, proving the reconciliation apply logic is fine but the operator path is too awkward.

Desired outcome

Support direct bounded apply without an intermediate plan file.

Example shape:

studio wp datamachine-code workspace worktree reconcile-metadata --apply --limit=50 --offset=0 --format=json

The command should generate the same bounded page internally, then immediately apply that current page with the existing revalidation/safety checks.

Acceptance criteria

  • --apply --limit=N --offset=M applies only that page.
  • Dry-run-first remains the default when --apply is omitted.
  • Direct bounded apply includes the same pagination, summary, and evidence output as dry-run/apply-plan flows.
  • Direct bounded apply still revalidates handle/path/repo/branch and refuses unsafe cleanup_eligible states.
  • Existing --apply-plan remains available as a low-level reviewed-plan escape hatch.

Related

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (GPT-5.5)
  • Used for: Drafting issue from post-release deployment and cleanup attempt evidence reviewed by Chris.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions