Requirement · active · spec/exacly/observation.yaml
REQ-023 Publish state conditionally and atomically
Cooperating local observers cannot overwrite a state change made since their observation began or expose a partially written document.
Why it exists
How it is realized
REQ-023Publish state conditionally and atomically Requirement main: verification passed- implements ←
APP-002Refresh Application- depends_on →
INF-001GitHub Actions Infrastructure - depends_on →
INF-002GitHub repository Infrastructure - reads →
INFO-001Model config Information- stores ←
INF-002GitHub repository Infrastructure (above)
- stores ←
- writes →
INFO-002Model state Information- stores ←
INF-002GitHub repository Infrastructure (above)
- stores ←
- depends_on →
- implements ←
main config 94cbae926e86
| Assessment | Reason | Evidence | At |
|---|---|---|---|
| verification passed tests | All 84 selected test cases passed | 2026-11-22T17:48:12Z |
Findings
None.
Config
- owner
- exacly-maintainers
- lifecycle
- active
- last_reviewed_at
- 2026-10-28
- statement
- Publish an observed state only when the destination still matches the captured state or its captured absence, under a shared local POSIX lock, and replace the complete document atomically.
- acceptance_criteria
- Refresh and manual-QA observation capture the earlier state before computing their observations and use the same publication protocol.
- Publication checks the captured exact file content and namespace, context, lineage and serial under a stable parent-directory lock; concurrent creation, deletion or content changes conflict without overwriting the destination.
- Existing state advances by exactly one serial with the same namespace, context and lineage; initial state starts at serial one.
- A conflict requires a new snapshot and observation; the writer never automatically retries a previously computed state against newer content.
- The lock wait accepts a finite nonnegative timeout, defaults to 30 seconds, and allows an immediate attempt at zero; timeout leaves the state unchanged.
- Publication synchronizes a hidden temporary file, atomically replaces the destination and synchronizes its directory before reporting success; failure before replacement preserves the earlier state bytes or absence.
- Failure after replacement reports that publication may already have happened and durability is uncertain, leaving the complete new document in place rather than attempting rollback.
- Process termination before or after replacement leaves a complete earlier or newer state; a leftover hidden staging file does not block a later write or become a model document.
- Captured and candidate documents must satisfy the 0.2 state schema; the writer refuses duplicate keys, nonfinite JSON values and symbolic-link, hard-linked or nonregular destinations, and a changed destination is never treated as a valid successor merely because its serial matches.
- Existing destination permission bits are preserved and new state files use mode 0600; required parent-directory creation is synchronized and replacing the captured parent directory conflicts.
- Guarantees apply to cooperating writers on supported local POSIX filesystems, without claiming coordination with arbitrary file editors, network filesystems, or an execution ledger transaction.
- verification_method
- State-writer, CLI interleaving, bounded-lock and process termination tests in CI.
- observe
- tests
- cases
- python/tests/test_state_writer.py::*
- python/tests/test_state_writer_faults.py::*
- python/tests/test_state_writer_cli.py::*