fix(workspace): land delete_path impl + ability registration missed by #65#66
Merged
Conversation
This was referenced Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #65, which shipped the
wp datamachine-code workspace deleteCLI subcommand but only the subcommand. The ability registration inWorkspaceAbilities.phpand thedelete_path()method inWorkspace.phpwere silently dropped from the original commit.Without this fix,
wp datamachine-code workspace delete <repo> <path>errors withWorkspace delete ability not available.because the CLI callswp_get_ability('datamachine/workspace-delete')which isn't registered.Root cause
The original
git add --rel=A --rel=B --rel=Ccall against the workspace API only staged the first path silently. The CLI returned "Paths staged successfully" butgit diff --cachedconfirmed only one file was staged. The other two files stayed dirty in the worktree, were never committed, and so never made it into the merged squash.I'll file a separate DMC issue for the repeatable-
--relbug; the workaround for now is one--relpergit addcall.What this PR adds
Workspace::delete_path()(~115 LOC) — sits next togit_addand reuses its gate ladder: traversal, sensitive-path, allowlist, primary-mutation. Detects tracked vs untracked viagit ls-files --error-unmatchand dispatches to eithergit rm [-r]or a recursive filesystem unlink.Workspace::remove_directory_recursive()— private helper that walks an untracked directory deepest-first.datamachine/workspace-deleteability registration inWorkspaceAbilities.php— input/output schemas, callback wiring todeletePath, and thedeletePathstatic method.Verification (live on intelligence-chubes4 — same scenarios as #65)
unlink (1 path removed). ✓Dentry ingit status. ✓--recursive→directory_requires_recursiveerror. ✓--recursive→ recursiveunlink (N paths removed). ✓.env) →sensitive_patherror. ✓../escape) →invalid_patherror. ✓invalid_patherror. ✓primary_mutation_not_allowederror. ✓--allow-primary-mutation→ succeeds. ✓not_found(404) error. ✓AI assistance
--relrepeatable-stage bug as the root cause; reconstructing the dropped commit. Chris reviewed the missing-files framing and authorized the fix-up PR.