You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
arch: replace hardcoded STATE_DIRS/STATE_FILES in externalize.ts with discoverable manifest #863
Current state: externalize.ts contains hardcoded lists of state directories and files. When new state artifacts are added to the project later, they will be silently orphaned during state externalization.
Root cause: No discoverable mechanism for state managers to register their artifacts. Any changes to state structure require manual updates to externalize.ts.
Issues
Silent data loss risk: New state artifacts added after deployment won't be included in externalization
No transactional safety: If externalize fails mid-copy, state ends up split between old and new locations
Operator blind spot: No audit trail or validation that all state was migrated
Proposed solution
Discoverable manifest: State managers register artifacts in a discoverable way (e.g., package manifest, registry file, or module exports)
Copy-verify-delete pattern: Atomic externalization with verification before cleanup
Rollback mechanism: Transactional guarantee or clear recovery steps if externalize fails mid-operation
Success criteria
No state artifacts are orphaned when new artifacts are added
Externalize operation is atomic or has clear rollback
Operators have visibility into state migration success/failure
externalize.ts hardcodes STATE_DIRS and STATE_FILES arrays that must be manually updated whenever new state artifacts are added. This creates silent data loss risk during externalization. This PRD replaces the hardcoded lists with a discoverable manifest that state managers register into, plus atomic copy-verify-delete operations.
Problem Statement
New state artifacts added after deployment are silently orphaned during externalization
No mechanism for state managers to register their artifacts
If externalization fails mid-copy, state ends up split between old and new locations
No audit trail or validation that all state was migrated successfully
Activity
diberry commentedon Apr 6, 2026
Summary
externalize.tshardcodesSTATE_DIRSandSTATE_FILESarrays that must be manually updated whenever new state artifacts are added. This creates silent data loss risk during externalization. This PRD replaces the hardcoded lists with a discoverable manifest that state managers register into, plus atomic copy-verify-delete operations.Problem Statement
Proposed Approach
Phase 1 — State Artifact Registry (P0)
StateArtifactinterface:{ path: string, type: 'dir' | 'file', owner: string, critical: boolean }getArtifacts(): StateArtifact[]functionexternalize.tsdiscovers artifacts by calling each manager'sgetArtifacts()instead of reading hardcoded arrays.squad/contents — fail if any unregistered artifacts existPhase 2 — Atomic Externalization (P1)
--forceflag to skip verification for emergency recoveryPhase 3 — Operator Visibility (P2)
squad doctorreports registered vs actual state artifactsAcceptance Criteria
STATE_DIRSandSTATE_FILEShardcoded arrays removed fromexternalize.tsgetArtifacts()interfacesquad doctorreports state artifact registration completenessArchitecture Notes
getArtifacts()should be part of theStorageProviderinterfacefix(sdk): replace hardcoded state dirs with discoverable manifest
fix(sdk): replace hardcoded state dirs with discoverable manifest
fix(cli): replace hardcoded state lists with dynamic directory scan
fix(cli): replace hardcoded state lists with dynamic directory scan
fix(cli): replace hardcoded state lists with dynamic directory scan
diberry commentedon Apr 10, 2026
🔒 On hold — high-touch architecture work (PR #908 exists but blocked on SDK republish).
fix(cli): replace hardcoded state lists with dynamic directory scan (g…
fix(cli): replace hardcoded state lists with dynamic directory scan (#…