feat: inject a neutral per-project workspace layout#1244
Open
joshuajbouw wants to merge 13 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a validated, typed WorkspaceLayout to support a neutral per-project runtime state directory (defaulting exactly to .astrid) and threads that selection through daemon boot, kernel, capsule lifecycle/discovery, hooks, gateway trust checks, WIT GC, and readiness metadata—while preserving existing public entry points via default-layout wrappers.
Changes:
- Add
astrid_core::dirs::WorkspaceLayout(with validation) plus a stable workspace-selection fingerprint used for daemon/CLI coherency. - Propagate workspace layout (and explicit workspace roots where needed) across kernel boot, discovery/install/remove/update paths, hooks discovery, gateway trusted source verification, and WIT GC.
- Publish atomic readiness metadata bound to
{workspace_root, layout}and reject CLI connections to daemons serving a different selection; document behavior inCHANGELOG.md.
Reviewed changes
Copilot reviewed 50 out of 51 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/astrid-kernel/src/socket.rs | Writes atomic readiness metadata including workspace selection fingerprint. |
| crates/astrid-kernel/src/lib.rs | Stores and threads WorkspaceLayout through kernel boot and discovery/config wiring with default wrappers. |
| crates/astrid-kernel/src/kernel_router/mod.rs | Uses injected workspace layout for capsule discovery in router inventory. |
| crates/astrid-kernel/src/kernel_router/install.rs | Installs capsules with explicit workspace root/layout in blocking install paths. |
| crates/astrid-hooks/src/discovery.rs | Discovers/saves workspace hooks under the selected state directory (with layout-aware helpers). |
| crates/astrid-gateway/src/routes/sessions.rs | Routes session endpoints using workspace context to scope trusted capsule source verification. |
| crates/astrid-gateway/src/routes/models.rs | Threads workspace context through registry round-trips for trusted source verification. |
| crates/astrid-gateway/src/routes/mod.rs | Adds WorkspaceContext extension and builds routers with explicit workspace inputs. |
| crates/astrid-gateway/src/routes/capsule_sources.rs | Computes trusted capsule source IDs using explicit workspace root/layout (no implicit .astrid). |
| crates/astrid-gateway/src/lib.rs | Runs/builds gateway with explicit workspace root/layout and preserves defaults. |
| crates/astrid-daemon/src/lib.rs | Reads layout selection, loads config with layout, boots kernel with layout, spawns gateway with explicit workspace inputs, writes readiness metadata. |
| crates/astrid-core/src/dirs.rs | Defines WorkspaceLayout, validation rules, layout-aware workspace paths, and workspace selection fingerprinting. |
| crates/astrid-core/src/dirs_tests.rs | Adds regressions for layout validation, fingerprint identity, detection, and accessors. |
| crates/astrid-config/src/show.rs | Exposes config path reporting with explicit workspace layout. |
| crates/astrid-config/src/merge/types.rs | Updates workspace layer labeling to match selectable workspace state directory. |
| crates/astrid-config/src/loader.rs | Loads workspace config using injected layout (and tests to ensure no dual-scan). |
| crates/astrid-config/src/lib.rs | Adds public config loaders accepting an explicit WorkspaceLayout. |
| crates/astrid-config/src/defaults.toml | Updates documentation comment to reflect selectable workspace config. |
| crates/astrid-config/Cargo.toml | Adds astrid-core dependency for WorkspaceLayout. |
| crates/astrid-cli/src/workspace_layout.rs | Adds process-wide WorkspaceLayout storage (OnceLock) for CLI-wide access. |
| crates/astrid-cli/src/socket_client.rs | Adds connect_for_workspace helper ensuring daemon workspace selection coherency. |
| crates/astrid-cli/src/main.rs | Initializes workspace layout once from CLI parsing. |
| crates/astrid-cli/src/commands/wit.rs | Scopes WIT GC mark collection to selected workspace root/layout (no dual-scan). |
| crates/astrid-cli/src/commands/mcp/watch.rs | Connects MCP watch uplink via workspace-aware daemon validation. |
| crates/astrid-cli/src/commands/mcp/session_guard.rs | Connects MCP guard uplink via workspace-aware daemon validation. |
| crates/astrid-cli/src/commands/mcp/mod.rs | Connects MCP serve uplink via workspace-aware daemon validation. |
| crates/astrid-cli/src/commands/init.rs | Creates workspace dir using injected layout rather than hard-coded .astrid. |
| crates/astrid-cli/src/commands/headless.rs | Connects headless/snapshot flows using workspace-aware daemon validation. |
| crates/astrid-cli/src/commands/daemon.rs | Propagates workspace layout to spawned daemons and validates readiness metadata matches selection. |
| crates/astrid-cli/src/commands/config.rs | Loads/prints config using injected workspace layout. |
| crates/astrid-cli/src/commands/capsule/remove.rs | Resolves removal targets using injected workspace layout. |
| crates/astrid-cli/src/commands/capsule/meta.rs | Re-exports layout-aware capsule meta scanning helpers. |
| crates/astrid-cli/src/commands/capsule/live_load.rs | Avoids live reload/unload against mismatched daemon workspace selection. |
| crates/astrid-cli/src/commands/capsule/list.rs | Lists installed capsules using layout-aware scan. |
| crates/astrid-cli/src/commands/capsule/install.rs | Installs/unpacks and resolves targets using injected workspace layout. |
| crates/astrid-cli/src/commands/capsule/install_update.rs | Updates capsules without mixing user/workspace scopes and uses layout-aware scanning/target resolution. |
| crates/astrid-cli/src/commands/capsule/deps.rs | Builds dependency view from layout-aware installed capsule scan. |
| crates/astrid-cli/src/commands/capsule_verb.rs | Connects to daemon for capsule verb registry/execution via workspace-aware validation. |
| crates/astrid-cli/src/cli.rs | Adds global --workspace-state-dir / ASTRID_WORKSPACE_STATE_DIR typed option and tests. |
| crates/astrid-cli/src/bootstrap.rs | Loads config and connects to daemon using injected workspace layout for interactive flows. |
| crates/astrid-capsule/src/discovery.rs | Discovers manifests in an explicit workspace root/layout (no implicit .astrid). |
| crates/astrid-capsule-install/src/wit.rs | Updates docs to reflect workspace installs under selected project state dir. |
| crates/astrid-capsule-install/src/paths.rs | Resolves install targets using explicit workspace root/layout; adds tests. |
| crates/astrid-capsule-install/src/meta.rs | Scans installed capsules using explicit workspace root/layout; adds tests. |
| crates/astrid-capsule-install/src/manifest_check.rs | Checks imports/exports using explicit workspace root/layout (no implicit scan). |
| crates/astrid-capsule-install/src/local.rs | Installs from local path using explicit workspace root/layout and layout-aware checks/paths. |
| crates/astrid-capsule-install/src/lib.rs | Re-exports new layout-aware install/discovery APIs. |
| crates/astrid-capsule-install/src/contracts.rs | Updates comments to reflect “no project state” reads on daemon fail-closed path. |
| crates/astrid-capsule-install/src/archive.rs | Unpacks/installs using explicit workspace root/layout and layout-aware local install. |
| CHANGELOG.md | Documents new workspace layout selection and coherency behavior under [Unreleased]. |
| Cargo.lock | Records astrid-config’s new dependency on astrid-core. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b802249 to
225b2da
Compare
2 tasks
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.
Linked Issue
Closes #1243
Summary
Introduces one validated neutral project workspace layout while preserving
.astridas standalone Astrid's exact default and leaving globalAstridHomebehavior unchanged.Changes
WorkspaceLayoutinput and a global CLI--workspace-state-dir/ASTRID_WORKSPACE_STATE_DIRselection0700ps,top, andwhopathsVerification
cargo fmt --all -- --checkgit diff --checkcargo metadata --locked --no-deps --format-version 1KernelClient::connect,SocketClient::connect, andAdminClient::connectonly behind the centralized workspace connector or the explicit stop/recovery bypassmain, including an isolated hello-world diagnosticChecklist
[Unreleased]