leases: wire the Valkey lease store into the runtime with the observability metrics hook #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/valkey-lease-runtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Wires the Valkey lease store into the runtime as the configurable production lease backend, with the observability metrics hook attached. Closes the durable gap documented in doc/observability.org ("VALKEY_* env is read by nothing").
star:initialize-lease-store(source/lease-store-runtime.lisp) is the runtime composition root: called instart-runtimeright after the auth-store initialization point, installs the globalstar:*lease-store*, andstar:shutdown-lease-storecloses it instop-runtime. Idempotent; init.lisp may pre-install a store before start-runtime and it is honored.*lease-store-backend*(STAR_LEASE_STORE_BACKEND, defaultmemory). The default keeps the current production path: no external dependency, no network, and no consumer change (target-dispatch/target-recovery still use inline document lease fields until #32).*valkey-lease-host*(VALKEY_HOST),*valkey-lease-port*(VALKEY_PORT),*valkey-lease-password-file*(VALKEY_PASSWORD_FILE, the store's existing read-password-from-file pattern; the password value is never read from env).star:observability-lease-metrics-hookis attached to the store by default (both backends, same seam). Fix: the hook previously expected a bare outcome code while both stores emit one event plist(:operation :request-id :code :retryable-p)— the stale-writer counter could never fire. It now parses the event plist.call-valkey-requestretries up toreconnect-attempts(2) with bounded backoff inside the caller's deadline and returns retryable:backend-unavailable/:timeout/:outcome-unknownoutcomes instead of signaling. Missing password file withvalkeyselected fails startup loudly (explicit opt-in misconfiguration).Env knobs
STAR_LEASE_STORE_BACKENDmemorystar:*lease-store-backend*VALKEY_HOST127.0.0.1star:*valkey-lease-host*VALKEY_PORT6379star:*valkey-lease-port*VALKEY_PASSWORD_FILEstar:*valkey-lease-password-file*(required forvalkey)Tests
New hermetic FiveAM suite
lease-store-runtime-tests(9 tests, no Valkey binary): default memory selection + idempotency, valkey selection from knobs with hook attachment and zero connection attempts, fail-fast on missing password file / unknown backend, shutdown idempotency, hook dispatch per outcome code, and end-to-end stale-token/conflict/acquisition counter increments through an installed store.Local gates (all recorded via the Prolog verifier at HEAD
5a753c4):nix run .#star-unit-tests— 24 suites, 230 tests, all passednix run .#doc-coverage-test— 851/851 symbols documented, 0 missingnix run .#gen-api-docs— regenerated;git diff --exit-code doc/apiclean (committed)nix flake check— all checks passedprolog-verify check— passedCI state disclosure
The Docstring coverage workflow is pre-existing red on master (issue #10); this PR will therefore also show that CI check red despite passing the same gate locally with 0 missing docstrings (851/851). Everything else is expected green. Merging on local gates when mergeable:true with that disclosure.
Out of scope (unchanged)
Refs #8 (observability slice, closed by PR #9), #10 (pre-existing CI doc-coverage red).