check-safety/docs/adr/0001-location-independent-workspace-discovery.md
2026-08-09 10:16:13 +08:00

37 lines
2.0 KiB
Markdown

# Location-independent workspace discovery
Decided 2026-08-09. The safety runner located the CMS and orchestrator through
hard-coded `$HOME/src/blockninja` paths and compared repositories as raw
absolute strings. The shared workspace can also be mounted at paths such as
`/srv/agent-work/blockninja`. Even when both paths address the same files, the
string mismatch caused an explicit orchestrator scan to be classified as CMS;
the CMS protobuf namespace filter then removed every orchestrator RPC.
## Decision
- Discover the consolidated workspace by walking upward from the current
directory, executable directory, and compiled source location.
- Recognize a workspace only when the independent `cms`, `orchestrator`, and
`check-safety` Go modules are present.
- Retain `$HOME/src/blockninja` only as the final compatibility fallback for an
installed binary launched outside the workspace.
- Compare existing paths with filesystem identity and resolved symlinks before
falling back to cleaned absolute strings.
- Cover non-home workspaces and aliased paths with regression tests.
- Reconcile the registry assertion, golden snapshots, and check catalog with
the already-shipped 34th schema-purity check so the runner's own suite is a
reliable validation gate again.
- Remove the obsolete core-SDK version helper left behind when check 2c moved
to the published plugin SDK, restoring strict unused-code linting.
## Consequences
- `check-safety ../orchestrator` selects the `orchestrator.*` RPC namespace from
any consolidated workspace location.
- Default CMS scans and `--orchestrator` resolve siblings from the active
checkout instead of silently crossing into another checkout.
- Symlink, bind-mount, and alternate mount-path aliases are treated as the same
repository when the operating system reports the same underlying directory.
Keywords: check-safety, workspace discovery, /srv/agent-work, $HOME/src/blockninja, orchestrator, CMS, RPC namespace, samePath, symlink, bind mount