Surface detached split-root state checkouts - #80
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Spacetop’s split-root workflow support by classifying storage backend separately from the runtime Git checkout disposition (attached / detached / wrong-branch / missing / probe-failed). It then surfaces those topology diagnostics in the TUI and ensures sync/reload paths re-probe topology so Spacetop can remain read-only while still truthfully inspecting whatever snapshot is available.
Changes:
- Add typed models for workflow storage (
WorkflowStorage) and split-root checkout disposition (StateCheckoutDisposition), plus a read-only topology probe (state_checkout.rs). - Update parsing/indexing/sources to load entities+archives from the typed storage location, and surface topology diagnostics in the UI footer/help and sync outcomes.
- Add regression tests covering reload behavior, watcher relevance, UI stable strings, and verified-fast-forward sync boundaries.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates user-facing docs to describe split-root backends, dispositions, and verified sync behavior. |
| docs/development-policy.md | Documents new topology classification responsibilities and verified-attached sync boundary. |
| AGENTS.md | Updates repo contract/code map to include split-root topology classification and verified state sync rules. |
| crates/spacetop-core/src/domain/mod.rs | Introduces WorkflowStorage and StateCheckoutDisposition into the typed domain model. |
| crates/spacetop-core/src/state_checkout.rs | Adds read-only storage classification + Git topology probing with containment checks. |
| crates/spacetop-core/src/parser/readme.rs | Parses state-branch: and classifies storage/topology during README parsing. |
| crates/spacetop-core/src/parser/snapshot.rs | Reuses split_root_entity_dir for entity-dir resolution (fail-closed behavior). |
| crates/spacetop-core/src/parser.rs | Removes direct export of the old resolve_entity_dir helper. |
| crates/spacetop-core/src/index.rs | Exposes storage via the workflow index for app/UI consumption. |
| crates/spacetop-core/src/sources.rs | Loads archives via the typed storage entity directory. |
| crates/spacetop-core/src/watcher.rs | Treats split-root state directory events as watcher-relevant. |
| crates/spacetop-core/src/lib.rs | Exposes the new state_checkout module publicly. |
| crates/spacetop-core/tests/state_checkout_fixtures.rs | Adds real-git fixture tests for attached/detached/wrong/missing and external symlink behavior. |
| crates/spacetop/src/app/overview.rs | Adds SyncStatus::SucceededWithState/Partial and app-layer topology diagnostics. |
| crates/spacetop/src/app.rs | Exposes workflow_storage() so sync orchestration can consult current typed storage. |
| crates/spacetop/src/lib.rs | Re-probes topology across sync and gates state sync to verified-attached split-root checkouts (plus new tests). |
| crates/spacetop/src/ui/footer.rs | Renders topology diagnostics and adds new sync pill variants/color mapping. |
| crates/spacetop/src/ui/help.rs | Updates help text to clarify “verified” fast-forward sync behavior. |
| crates/spacetop/src/ui/tests.rs | Adds helper to build App with explicit storage for UI diagnostic tests. |
| crates/spacetop/src/ui/tests/task_list.rs | Adds tests pinning stable footer diagnostics and new sync pill strings/colors; updates fixtures for storage. |
| crates/spacetop/tests/state_topology_reload.rs | Adds integration test that reload re-probes topology while keeping archive scope readable. |
| crates/spacetop/src/ui/tests/preview.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/ui/tests/paths.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/ui/tests/overview.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/ui/tests/chrome.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/ui/graph/tests.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/ui/definition.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/app/tests.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/app/mouse.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
| crates/spacetop/src/app/keys.rs | Updates test fixtures for new WorkflowDefinition.storage field. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| impl StateTopologyDiagnostic { | ||
| pub fn label(&self) -> String { | ||
| match self { | ||
| Self::Detached => "State detached; snapshot may be stale".to_string(), | ||
| Self::WrongBranch { |
There was a problem hiding this comment.
Fixed in 04b6b0d. I replaced the allocating label() -> String path with Display, so footer rendering writes the diagnostic directly into the final formatted string. The existing Ratatui topology-diagnostic test passes.
| if rel.is_absolute() | ||
| || rel | ||
| .components() | ||
| .any(|component| component == Component::ParentDir) | ||
| { | ||
| return None; | ||
| } |
There was a problem hiding this comment.
Fixed in 04b6b0d. split_root_entity_dir now requires at least one normal path component, so ., ./, and ././ remain single-root even when state-branch: is set. A focused regression proves these forms trigger no Git probe; full tests and lint pass.
Make detached and other split-root checkout states visible so Spacetop can inspect available snapshots without overclaiming sync freshness.
What changed
Evidence
Review guidance
Focus on
state_checkout.rspath containment andlib.rssync re-probe boundaries.076
Closes spacedock-dev/spacedock#677