fix(sdlc): unify coord event-log path resolution onto coord_base_dir()#3838
Conversation
The dispatch-launch coord write and the retro-grant watcher each hardcoded the dead root-owned /var/lib/hapax/coord defaults instead of the user-writable SSOT (coord_base_dir() -> ~/.cache/hapax/coord). uid 1000 cannot mkdir /var/lib/hapax, so the dispatch-launch append() and the fail-open spool both PermissionError'd and CoordDispatchError HARD-BLOCKED the launch coord write (the live ledger held only origin=cli stage transitions, zero dispatch.launch events); coord-retro-grant-watch also read a different grants dir than coord-grant-mint wrote. - dispatch: coord_event_log_from_env() defaults derive from coord_base_dir(); per-surface HAPAX_COORD_* overrides still win (test isolation). - retro-grant-watch: resolve grants+key via default_grant_dir()/default_grant_key() (reader/writer parity with coord-grant-mint). - docs: reconcile the design doc 4.3/4.4/anchors to ~/.cache/hapax/coord with a supersession note (do not leave both paths live). - tests: scripts-no-/var/lib lint, unset-resolves-to-cache-base, reader/writer parity. Task: reform-coord-eventlog-path-unify-20260601 AuthorityCase: CASE-CROSS-RUNTIME-COMMS-001 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR migrates coord event-log, grant file, and spool persistence from root-owned ChangesCoord Storage Path Migration
🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Collapses coord event-log path resolution onto the canonical
shared.coord_event_logresolvers in the dispatch launcher and the retro-grant watcher, killing the dead root-owned/var/lib/hapax/coorddefaults that uid 1000 could nevermkdir.Root cause (final audit, cluster 3 — split-brain SSOT, dispatch HARD-BLOCK):
coord_event_log_from_env()(hapax-methodology-dispatch) andcoord-retro-grant-watchhardcoded/var/lib/hapax/coord/*defaults instead of calling the resolverscoord_event_log.pyandcoord-grant-mintalready use.append()PermissionError'd on/var/libmkdir, the fail-open spool ALSO PermissionError'd, andCoordDispatchErrorpropagated → the launch coord write HARD-BLOCKED. The live ledger holds onlyorigin=clistage transitions, zerodispatch.launch.Changes
hapax-methodology-dispatch:coord_event_log_from_env()defaults derive fromcoord_base_dir()(→~/.cache/hapax/coord). Per-surfaceHAPAX_COORD_*overrides still win (test isolation relies on them).coord-retro-grant-watch: resolves grants dir + key viadefault_grant_dir()/default_grant_key()— exact reader/writer parity withcoord-grant-mint. Dead constants removed; docstring reconciled.~/.cache/hapax/coordwith a supersession note (no dual live paths).test_coord_path_unification.py(scripts-no-/var/liblint + unset-resolves-to-cache-base);test_coord_retro_grant_watch.pyend-to-end reader/writer parity.Verification
pytestcoord path-unify + retro + grant-mint → 13 passed;test_hapax_methodology_dispatch.py→ 36 passed (no regression).ruff check/ruff format --check/pyrightclean on changed files.~/.cache/hapax/coordprovisioned + writable; baseline 10sdlc.stage_transition, 0 dispatch/launch.Acceptance criteria
grep -rn '/var/lib/hapax/coord' scripts/returns nothing (lint test enforces).coord_event_log_from_env()unset →coord_base_dir()(~/.cache/hapax/coord).~/.cache/hapax/coord; workspace CLAUDE.md cites no coord path. Vault source copy of the master design is outside this task's mutation scope — flagged for the operator.Post-deploy (runtime realization, not a PR deliverable): the AC "a live dispatch-launch writes a coord event to
~/.cache/hapax/coord/ledger.db" realizes once this lands on origin/main and the dispatch path is deployed. The code fix + mechanism are proven here (dispatch suite asserts events land in the resolved ledger; resolver test proves the default base; live tree confirmed writable with 0 dispatch.launch today).Task:
reform-coord-eventlog-path-unify-20260601· AuthorityCase: CASE-CROSS-RUNTIME-COMMS-001🤖 Generated with Claude Code