fix(spawn): dry-run-default + path-based update engine — kill #636 branch-scrambler (TDPLAN-0006 P0+P1)

#636: drone @spawn update would scramble every branch's identity/memory in
one command. On a branch created seconds earlier, --dry-run proposed 30 renames
rotating identity dirs (apps->.trinity->.seedgo->.claude->.archive->.aipass),
README->DASHBOARD, and deep-merged stale template into live .trinity/. Root
cause: the CREATE path regenerated template-registry IDs in filesystem-walk
order (!= the master's hand-crafted IDs), so content-hash + rename-detection
saw a mismatch on a pristine branch. update --all would have destroyed all 13
citizens at once.

P0 — safety by default:
- update + repair are now dry-run by default; --apply required to write.
  Forgotten flag = safe preview-only no-op. --dry-run kept as alias.
- doctor_fix.py repair suggestions emit the matching --apply form
  (+ aipass test_doctor_fix updated to the new contract).

P1 — engine rebuild (update_ops.py v2.0):
- Path-based named-managed-files model replaces whole-tree hash-diff +
  rename-detection. ID divergence is moot — IDs are no longer used.
- .trinity/*, DASHBOARD.local.json, artifacts/birth_certificate.json,
  .seedgo/bypass.json = delivered on CREATE only, NEVER touched on update.
- Old ID engine (change_detection.py, reconcile.py) + orphaned tests deleted.

Verified on fresh sandbox: update --dry-run = 0 renames / 0 updates / 0
additions (create==update invariant); no-flag run = dry-run preview, filesystem
byte-identical; 313 spawn tests green; seedgo 100% (all 36 standards).

Closes #636. P2/P3/P4 (shared lib, seam, .recovery relocate) to follow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
AIOSAI
2026-06-06 22:54:09 -07:00
co-authored by Claude Opus 4.8
parent 1ef1e2e89c
commit ccc8d6a97b
16 changed files with 334 additions and 1189 deletions
+12 -11
View File
@@ -56,12 +56,13 @@ drone @spawn passport @dirname --role "Observer" --purpose "Monitoring"
### Update
Update is **preview-only by default** — `--apply` required to execute changes.
```bash
drone @spawn update @branch_name # Single branch (uses passport class)
drone @spawn update builder --all # All builder-class branches
drone @spawn update birthright --all # All birthright-class branches
drone @spawn update @branch_name --dry-run # Preview changes
drone @spawn update builder --all --dry-run # Preview batch update
drone @spawn update @branch_name # Preview changes (dry-run default)
drone @spawn update @branch_name --apply # Execute changes
drone @spawn update builder --all --apply # All builder-class branches
drone @spawn update @branch_name --dry-run # Explicit preview (same as default)
```
### Delete
@@ -79,12 +80,12 @@ drone @spawn sync-templates # Pull managed fi
drone @spawn regenerate-registry # Regenerate builder template hashes
drone @spawn regenerate-registry --all # All template classes
# Repair
drone @spawn repair <project_path> # Scan project for structural issues
drone @spawn repair <project_path> --dry-run # Preview only
drone @spawn repair --relocate @branch src/pkg/branch # Move branch to new location
drone @spawn repair --relocate @branch path --relocate-artifacts # Move branch + .chroma/ into it
drone @spawn repair <project_path> --clean-pollution # Archive + remove duplicate dirs
# Repair (preview-only by default — --apply required to execute)
drone @spawn repair <project_path> # Preview structural issues (dry-run default)
drone @spawn repair <project_path> --apply # Execute fixes
drone @spawn repair --relocate @branch src/pkg/branch --apply # Move branch to new location
drone @spawn repair --relocate @branch path --relocate-artifacts --apply # Move + .chroma/
drone @spawn repair <project_path> --clean-pollution --apply # Archive + remove duplicate dirs
```
### Introspection