Repository navigation
Add the telemetry hook recording facade - #356
Open
gmemuriuki wants to merge 3 commits into
Open
gmemuriuki wants to merge 3 commits into
gmemuriuki wants to merge 3 commits into
Conversation
Keep the production empty constructor private to the validated snapshot loader and expose an explicit test-only constructor. Project load failures into a bounded, content-free Copy reason so state can retain fail-closed degradation without carrying I/O errors.
Let private state mint one opaque change containing its state, metric decision, optional event request, and maintenance token. Keep binding and per-operation assembly inside the state layer. Teach locked storage to consume that unit, skip metric preparation when no aggregate snapshot was requested, and report the bounded reason. Cover both publication shapes and same-day maintenance throttling.
Run hook recordings through one locked orchestration spine that loads and observes private state, stages the accepted day's aggregate work, and persists before best-effort publication and maintenance. Return bounded outcomes for contention and each fail-closed boundary. Keep serializer errors out of retained diagnostics while preserving content-free detail for debugging.
gmemuriuki
added this pull request to stack #331
October 17, 2026 06:35
This branch has not been deployed
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.
What does this PR do?
This PR adds the inactive recording facade for hook-invocation telemetry. It does not connect the facade to production hook dispatch yet.
The state layer now produces one opaque RecordingChange containing the observed private state, optional aggregate snapshot, optional event request, and scheduled maintenance token. Storage alone can unwrap that change, which prevents callers from persisting a bare state or manufacturing an empty metric snapshot after an unsafe load.
LockedStorage owns the recording spine: load state, accept the timestamp, schedule maintenance, load the accepted day's snapshot, stage, persist, publish, then maintain. Snapshot failures remain fail-closed for aggregates without replacing surviving rows, while bounded outcomes distinguish contention, lifecycle rejection, state failure, snapshot unavailability, staging failure, and persisted publication results.
Tests cover accepted-day snapshot selection, future high-water rejection, lock contention, malformed state and metric snapshots, persistence and publication failures, maintenance deferral, and the outer facade path.
Disclosure questions
AI disclosure.
Questions for reviewers.
Does the opaque change boundary keep lifecycle, persistence, publication, and maintenance correctly ordered while preserving existing snapshots on unsafe input?