Record whether CORA reached the enclosure permit substrate - #643
Merged
Conversation
The permit-status projection advances only on a change, so a stale value has meant "no transition since" and "not observed since" the same way: a silent gap in coverage reads as nothing happened. This adds a permit probe trail, entries_enclosure_permit_probes, one append-only row per observation the monitor's EnclosureObserver surfaces, separate from the EnclosurePermitObserved record of what the interlock said. reach_tier (RELAYED/UNREACHED) records whether CORA reached the configured channel this tick; a status-bearing push or disconnect still drives the permit transition as before, while a new periodic poll writes probe-only rows (no status claim, never a transition) so a quiet, unchanging PV doesn't read as a coverage gap. A stronger tier for a confirmed direct round trip is deliberately not shipped: no producer here can prove one yet (2-BM reads through a caching gateway), and an unearned strong claim is worse than none. The probe write can never suppress the real permit transition, and no row is written at all while a process boots in degraded schema mode, since the event store is read-only there and a dense trail would misrepresent a window CORA could not actually record. Went through three review rounds (design, re-cut, and a pass against the built code) that caught a startup-race regression, a route that could have let a stale poll read flip a live permit status, and a test double gap that silently turned a cancellation test into an infinite loop. Also adds a fitness test closing the same missing-GRANT class of bug already latent on five older entries_ tables (tracked separately; not fixed here). Item 3 of the 2-BM coverage-window commissioning ladder. The polling cadence defaults off (enclosure_permit_probe_tick_seconds=None) pending staff confirmation, since it would read the PSS gateway on a timer. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
xmap
force-pushed
the
feat-enclosure-permit-probe-trail
branch
from
August 10, 2026 16:36
6cfaa21 to
8df3903
Compare
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Summary
entries_enclosure_permit_probes, one append-only row per observation, separate from theEnclosurePermitObservedrecord of what the interlock said.reach_tier(RELAYED/UNREACHED) records whether CORA reached the configured channel;status_claimeddistinguishes a real status-bearing observation from a probe-only re-affirmation.enclosure_permit_probe_tick_seconds=None) writes probe-only rows so a quiet, unchanging PV doesn't read as a coverage gap, without ever driving a permit transition on its own.tests/architecture/test_entries_table_grants.py, closing the same missing-GRANT class of bug already latent on five olderentries_*tables (tracked as a separate follow-up, not fixed here — those need their own production migration).Went through three review rounds before landing: an initial design lock, a re-cut after adversarial + baseline + migration-safety review found 9 blockers (including a route that would have let a stale poll read flip a live permit status, and a startup-race regression against a fix that shipped the same day), and a final pass against the built code that caught a test-double gap silently turning a cancellation test into an infinite loop.
Test plan
uv run pyrightcleanuv run ruff check/ruff format --checkcleanuv run tach checkclean (caught and fixed a real module-boundary violation)pytest -n 4(the earlier hang only reproduced under the full-suite run)atlas migrate validate(real CLI) exit 0test_enclosure_permit_monitor.pynot run locally (no Docker in the dev sandbox); will run in CI🤖 Generated with Claude Code