4bfc246be4
REQ-041: ORCA_HOME is now the single namespace root for all components
(db, certs, init, daemon). store.Open("") and init command both
route through certpaths.Dir()/DBPath() instead of hardcoding ~/.orca.
Backward compatible: empty ORCA_HOME -> ~/.orca.
REQ-042: --system persistent flag on rootCmd sets ORCA_HOME=/root/.orca
via PersistentPreRunE. Errors on conflict with pre-set ORCA_HOME.
Tests: 7 new tests in namespace_test.go (default, ORCA_HOME override,
--system sets root, conflict detection, init --json, flag registered).
Full suite passes (no regressions).
Docs: docs/namespace.md covers default, ORCA_HOME, --system, ORCA_DB,
resolution order, and path layout tables.
---ci---
project: orca
phase: 1
milestone: v0.5
status: verify
---/ci---
3.1 KiB
3.1 KiB
Phase 1 Verification: Namespace Unification (v0.5 P1)
Phase: 1 (namespace unification) Milestone: v0.5 Distribution Requirements covered: REQ-041, REQ-042 Date: 2026-08-03
Structural Layer
gofmt -l .→ clean (no files need formatting).go vet ./...→ clean (no warnings).go build ./...→ succeeds.- New files:
internal/cli/namespace_test.go,docs/namespace.md. - Modified files:
internal/cli/root.go,internal/cli/init.go,internal/store/store.go.
Behavioral Layer
Unit tests (new)
TestNamespaceDefaultsToUserHome✓ — emptyORCA_HOME→~/.orca.TestNamespaceHonorsORCAHOME✓ —ORCA_HOME=/tmp/x→Dir()=/tmp/x,DBPath()=/tmp/x/orca.db.TestInitHonorsORCAHOME✓ —initcreates$ORCA_HOMEdir.TestSystemFlagSetsORCAHOME✓ —--systemsetsORCA_HOME=/root/.orca.TestSystemFlagConflictsWithORCAHOME✓ —--system+ORCA_HOME=/custom→ error.TestInitJSONOutput✓ —init --jsonreturns{"path":"...","status":"initialized"}.TestSystemFlagIsPersistent✓ —--systemregistered as persistent flag onrootCmd.
Unit tests (regression — all pass)
internal/cli/(9.8s) ✓internal/store/✓internal/doctor/✓internal/daemon/✓internal/security/✓internal/engine/✓internal/jobspec/✓internal/transport/✓
Manual e2e
ORCA_HOME=/tmp/orca-test-user ./bin/orca init→ creates/tmp/orca-test-user✓./bin/orca --system init→ creates/root/.orca✓ORCA_HOME=/custom ./bin/orca --system init→ error "conflicts with ORCA_HOME" ✓./bin/orca version --json→{"version":"v0.4.1",...}✓
Security Layer
- No new secret handling. The namespace unification moves path resolution but does not change cert/key file modes (0600/0644 per REQ-033 unchanged).
--systemflag does not escalate privileges — it only changes the namespace root path. Running as non-root with--systemwill fail atos.MkdirAll("/root/.orca")with a permission error (expected).- No new network surface.
Quality Layer
- Backward compatibility: empty
ORCA_HOME+ no--system→~/.orca(identical to pre-v0.5 behavior). All existing tests pass unmodified. - Single source of truth:
certpaths.Dir()is the only namespace root resolver.store.Open("")andinitboth route through it. - No redundant implementations: the
--systemflag maps toORCA_HOMErather than introducing a parallel path mechanism. - Documentation:
docs/namespace.mdcovers default,ORCA_HOME, and--systemwith examples and resolution order.
Must-Haves Checklist
go test ./...passes (including new namespace_test.go).ORCA_HOME=/tmp/x orca initcreates/tmp/x(not~/.orca).orca --system initcreates/root/.orca(when run as root).- Empty
ORCA_HOME+ no--system→~/.orca(backward compat). orca version --jsonworks (needed by install.sh in P2).
Verdict
PASS — all 4 verification layers pass. REQ-041 and REQ-042 are
satisfied. Ready to ship as v0.4.2.