Skip to content

Provide DB-independent primary refresh for standalone worktree recovery #1314

Description

@chubes4

Problem

DMC's standalone worktree provider can detect that authoritative primary freshness evidence is missing or stale, but its only remediation points back to the WordPress runtime:

wp datamachine-code workspace git pull <repo> --allow-primary-refresh

When WordPress cannot bootstrap its database, unrelated Git workspace management is therefore unavailable. The standalone provider fails closed correctly, but there is no owning standalone command capable of performing the safe refresh it requires. Operators are pushed toward raw Git mutation, duplicate checkouts, or temporarily changing the site's database backend.

Reproduction

  1. Use a registered clean authoritative primary that is behind its fetched remote default branch.
  2. Make WordPress database bootstrap unavailable.
  3. Invoke standalone worktree planning through an orchestration client.
  4. Observe typed freshness_refresh_required with a WordPress-only refresh command.
  5. Observe the refresh command cannot run because WP-CLI boots the unavailable database.

Expected contract

DMC provides a database-independent, generic safe-primary-refresh primitive using the same repository registry/freshness policy as the WordPress command. The standalone provider returns that executable recovery action.

Acceptance criteria

  • A standalone command safely refreshes a clean authoritative primary without booting WordPress or its database.
  • It preserves the existing fast-forward, divergence recovery, detached-head, default-branch, and dangerous-primary-mutation safeguards.
  • Freshness evidence produced by standalone refresh is accepted by standalone worktree planning.
  • The provider remediation selects a currently executable command for its runtime context.
  • Typed output records fetched remote evidence, old/new SHA, branch/upstream, recovery worktree if any, and refusal reason.
  • Deterministic coverage proves recovery while WordPress bootstrap is unavailable.

AI assistance

OpenAI GPT-5.6-sol via OpenCode reproduced the WordPress-coupled recovery dead end, inspected DMC's standalone provider and existing freshness trackers, and drafted this generic recovery contract. Chris Huber directed and owns the issue.

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