Field / Recorded value
Field Recorded value
Requirement MIT-QUEUE-01: enforce the selected capacity and overflow policy.
Capture publish-4, after offering (4, b'E004').
Required slow outcome Clear its prior three messages; do not enqueue 4; mark it inactive with reason overflow.
Baseline observation Slow remains active with [1,2,3,4]: four messages and 16 logical payload bytes.
Corrected observation Slow is inactive with an empty queue; receipt records three messages and 12 logical payload bytes cleared.
Healthy observation Message 4 is queued and its following drain delivers it.
Decision state The corrected frame matches. Authorized residual-risk acceptance remains NOT ASSESSED.

This is a local consumer-state transition, not an observed socket close. Inspect the literal oracle, baseline output and corrected output.

01 / Define the hazard and the decision

What does connecting a hazard to code establish?

A useful hazard record describes an exposure condition, the behavior that could produce an adverse consequence, and the system boundary in which that consequence matters. The mitigation requirement states the behavior intended to control that path. Implementation evidence then asks whether the identified code realizes that behavior under the conditions actually examined.

NASA's software guidance provides a concrete method reference: NPR 7150.2D §3.12.1 connects requirements, system hazards, design, code and verification through classification-dependent trace relationships; §4.5.12 calls for testing requirements traced to a hazardous event, cause or mitigation. These provisions have NASA and agreement-dependent applicability. The worksheet here is an engineering adaptation, not a prescribed NASA artifact or certification claim. Traceability · Testing.

Keep applicability, evidence and risk decisions separate

Record or disposition / Meaning / What must remain visible
Record or disposition Meaning What must remain visible
Accept an applicable obligation This duty belongs in scope and needs mitigation evidence. Requirement, owner and evidence still needed.
Suppress a candidate The duty does not apply within a justified boundary. Concrete architectural rationale and conditions that invalidate it.
Defer mitigation Applicable work remains unfinished. Tracking reference, owner, exposure constraints and decision needed to proceed.
Record a technical pass The stated observations meet the selected criterion on an identified basis. Untested conditions and evidence currency.
Accept residual risk An authorized decision permits specified remaining risk under stated conditions. Authority, policy, rationale, evidence, constraints and review trigger.

NPR 8000.4C separately addresses delegated acceptance authority, mitigation effectiveness and the records for accepting or closing risk. That distinction informs this workflow; it does not assign authority to the person who runs a test. Accountabilities, §2.3 · Dispositions and acceptance, §§3.4.2 and 3.5.

Review the shared-connection candidates

For a proposed connection shared across browser tabs, candidate review could look like this. The candidate table and slow-consumer extension remain unexecuted plans. These dispositions depend on confirming the stated architecture; the local queue campaign later in this guide does not execute that system.

Candidate / Planning disposition and assumption / Work or revisit trigger
Candidate Planning disposition and assumption Work or revisit trigger
concurrent_invariant_preserved Accept applicability if tabs share mutable connection state. Define the invariant and obtain evidence for relevant interleavings.
compound_operation_atomic Accept applicability if connect-and-subscribe can partially fail. Examine the intermediate failure and required cleanup.
redos_resistant Suppress only if relevant untrusted-string processing is absent. Revisit when parsing, regular expressions or input exposure change.
cache_version_coherent Suppress only if no cached projection exists. Revisit if a cache or replicated projection is introduced.
back_pressure_bounded Accept applicability for queued producer/consumer paths. Specify capacity and one chosen overflow policy; observe progress, loss and recovery.

The last class ships under domain/ipc and includes queued in-memory paths. Concurrency, atomicity and cache decisions remain separate scope.

02 / Start with a complete record

Free hazard-to-mitigation evidence worksheet

Copy both records as plain text. They work without Proof, signup or JavaScript. Use one record per hazard and repeat the candidate or observation block where needed. Preserve unknowns as UNKNOWN, unassigned people as UNASSIGNED, and work without observations as UNPERFORMED. Use NOT APPLICABLE only with a rationale.

Blank record

HAZARD-TO-MITIGATION EVIDENCE RECORD

A. HAZARD, BOUNDARY AND AUTHORITY
Record ID / revision / record owner:
Hazard ID:
Exposure condition and relevant operating mode:
Causal software behavior:
Potential consequence / affected people, service or assets:
Observed consequence versus anticipated consequence:
System/component boundary, interfaces and exclusions:
Authoritative intent source / requirement revision:
Intended-behavior approving authority / approval reference or UNKNOWN:
Risk criteria / policy / applicable basis and interpretation owner:
Severity or likelihood assessment and its basis, or NOT ASSESSED:

B. CANDIDATE REVIEW (repeat for each candidate)
Catalog / class ID / class version / effective project catalog version:
Source identity and exact applicability conditions:
Disposition: ACCEPT APPLICABILITY / SUPPRESS NONAPPLICABILITY / DEFER:
Rationale and supporting architecture evidence:
Assumptions / scope / reviewer / decision reference:
If suppressed: concrete nonapplicability and revisit trigger:
If deferred: required work / tracking reference / owner / due trigger:
If owned elsewhere: requirement owner and explicit delegation reference:
Permission to continue with exposure / authority / constraints or UNPERFORMED:
Other related obligations and their separate status:

C. MITIGATION REQUIREMENT AND POLICY
Mitigation requirement ID / revision / exact required behavior:
Requirement owner / implementation owner:
Named producers / consumers / topology / process and thread boundaries:
Queue count / capacity / units / per-queue versus aggregate budget:
Payload domain / size or byte definition / precondition enforcement owner:
Chosen overflow policy and precise trigger/capture point:
Response, enqueue, discard, blocking or disconnect effects:
Affected consumer isolation and required successful behavior/progress:
Loss semantics / loss detection or notice, if required:
Recovery/rejoin: old state, new generation, replay/resubscription promises:
Policy approval / approving authority / reference or UNKNOWN:

D. IMPLEMENTATION, HARNESS AND INDEPENDENT ORACLE
Baseline and correction: repository/source revision or content hashes:
Source paths / actual functions / build or executable identity:
Fixture / harness / wrapper / oracle identities and revisions:
Actual call path into implementation; adapters, mocks and exclusions:
Runtime / OS / architecture / dependencies / configuration / flags:
Oracle's independent intent basis / authoring timing / reviewer:
Exact expected response types, state, event order and success criteria:
Initial state / payloads / schedule / rate if controlled / duration rule:
Capture labels and points relative to calls, returns and effects:
Observation mechanism / profiling / logs / instrumentation limitations:

E. EXECUTION AND CORRECTION (repeat observation block as needed)
Evidence class: PLAN / PRIMARY CAPTURE / SEPARATE REPLAY / ANALYSIS:
Prerequisites / working directory / exact command:
Run ID / start and end with timezone / measured duration and meaning:
Counting units: inputs, method calls, cases, snapshots and comparisons:
Capture label / actual arguments:
Independent literal expected response and state:
Observed response and state / raw artifact identity:
Result: NOT RUN / FAILED / PARTIAL / SUPPORTED / BLOCKED:
Failure witness and discrepancy reference:
Implemented correction / changed source identity:
Same-witness replay command / observation / regression result:
Sensitivity control / expected distinction / observed result:
Per-queue occupancy and logical queued-payload byte observations:
Aggregate current-queue observations, separately labeled:
Actual allocator/heap/process/RSS/network memory evidence, or UNPERFORMED:
Exit codes / wrapper interpretation / stdout / stderr / integrity records:

F. REMAINING RISK AND SEPARATE DECISIONS
Bounded technical conclusion / evidence reviewed / reviewer:
Loss, service consequences and unresolved assumptions:
Unperformed transport, concurrency, scheduler, load and resource conditions:
Related obligations / broader failure-class checks / evidence still needed:
Risk owner / acceptance policy / authorized decision-maker:
Residual-risk decision / scope / rationale / evidence reference or UNPERFORMED:
Decision constraints / expiry or review interval / revisit triggers:
Implementation responsibility / completion record:
Evidence-review responsibility / review record:
Intended-behavior approval responsibility / decision:
Change acceptance responsibility / decision / reference:
Merge responsibility / actual status / reference:
Deployment responsibility / actual status / reference:

G. REGRESSION, FRESHNESS AND NEXT ACTION
Reusable regression IDs / command / environment / retained failure:
Evidence stale when intent, code, oracle, harness, configuration or scope changes:
Catalog/suppression assumptions and risk decisions to revisit:
Required rerun or justified reuse / owner / decision reference:
Next action / assigned person or UNASSIGNED / due trigger / evidence required:

Filled record: a stalled local consumer

This record uses the authored contract and the observed evidence handoff. It supplies no approved customer requirement or risk acceptance.

HAZARD-TO-MITIGATION EVIDENCE RECORD: HZ-QUEUE-01 / MIT-QUEUE-01
Evidence origin: https://reqproof.com
Asset paths below are relative to that origin.
Project record owner: UNASSIGNED. Project record revision: UNKNOWN.

A. HAZARD, BOUNDARY AND AUTHORITY
Record state: filled fictional teaching evidence record.
Exposure: slow does not drain while the producer continues publishing.
Cause: Baseline.publish appends to active queues without enforcing capacity.
Consequence: retained payload exceeds the declared queue budget;
  resource exhaustion is a potential consequence. No OOM or crash observed.
Boundary: one local process, one thread, one deterministic producer,
  exactly two separate deque-backed consumers named healthy and slow.
Producer identity: the scheduled calls in run.py:main.
Authoritative basis for this fixture: authored CONTRACT.md, MIT-QUEUE-01.
Customer/product intent approval: NOT ESTABLISHED; approver UNASSIGNED.
Actual risk criteria, severity, likelihood and safety classification:
  NOT ASSESSED. No score or certification basis assigned.

B. CANDIDATE REVIEW
Class: back_pressure_bounded; category domain; domain ipc; active.
Class catalog_version: 1. Effective project catalog pin: UNKNOWN.
Catalog source: pkg/catalog/data/domain/ipc/back_pressure_bounded.yaml
Catalog source SHA256:
  63536aa3cfb0552ddcde829f00be1cc0265488407dce56faae0f7ef4665ab741
Disposition: ACCEPT_APPLICABILITY_IN_TEACHING_SCOPE.
Rationale: queued consumers can lag the producer; this is not a
  synchronous request/response path with no queue.
Disposition authority: teaching author only; no project approval.
Meaning: mitigation/evidence work required, not residual-risk acceptance.
Suppression/delegation/authorized deferral: none recorded for this fixture.
Revisit: topology, queue use, payload domain, capacity or catalog changes.
Other scope: concurrency, connect/subscribe atomicity and cache duties
  from the shared-WebSocket plan remain separately unresolved here.

C. EXACT MITIGATION POLICY
Requirement: MIT-QUEUE-01, CONTRACT.md identified by SHA256 below.
Owners: actual requirement and implementation owners UNASSIGNED.
Capacity: 3 messages PER QUEUE; exactly 4 supplied payload bytes each;
  12 logical queued payload bytes PER QUEUE.
Payload length is a caller precondition; no size/type validator exercised.
Overflow: before appending a fourth item to a full queue, clear its
  three queued items/12 logical bytes, set only that consumer inactive
  with close_reason='overflow', and do not enqueue the triggering offer.
Return: status='disconnected-overflow', enqueued=false,
  cleared_messages=3, cleared_payload_bytes=12.
Subsequent offers to that inactive session: status='inactive',
  enqueued=false, cleared_messages=0, cleared_payload_bytes=0.
Successful behavior: healthy continues to enqueue/drain messages 1..7.
Loss: slow loses queued 1..3; offer 4 is not enqueued; offers 5/6 skip it.
Rejoin: explicit join replaces the old session, clears its queue,
  increments generation 1 to 2, and starts active/empty.
Old close reason is preserved if set; otherwise it becomes 'replaced'.
New slow receives future message 7 only. No replay, automatic reconnect,
  resubscription, gap notice or recovery of messages 1..6 is promised.
Disconnect is local inactive state, not a network/socket close.
Permission to adopt this loss policy in a real product: UNPERFORMED.

D. IDENTIFIED IMPLEMENTATION AND ORACLE
Kit base: /assets/hazard-analysis-to-code/research-rerun/
implementation.py SHA256:
  a046d12e5f227e2160e2b27f72067be0eee4dc1349b7f733e70b08a1e2b01d92
run.py SHA256:
  78e1ef18b3424ea6f1503823f3498f0a84d2e702b5ad31d1570f9f2ce18acc3f
reproduce.py SHA256:
  d64e91abdfd8fedefaa610686b30cc2bc78b7aa244ab3ee69d89350f373117fd
expected.json SHA256:
  573dda6f4afdbe512de8c90f7d5ddb821e9f4e28df4a9ac9b63355eb193bf015
CONTRACT.md SHA256:
  ea66f110eab62ee34c8ff811b8e29d0c4bb8f5a5a4eac9bee984a138bd1d3d19
hazard-record.json SHA256:
  1aea198dc1ce301f2e2a00c1baf603011b902149cd5dc7bafb3b57fea156215b
Build: directly imported Python source; no separate binary or repository
  commit supplied. Baseline, correction and control are in the same file.
Functions: QueueCore.__init__ line 12; join line 16; drain line 30;
  Baseline.publish line 38; Corrected.publish line 52;
  RejectAllControl.publish line 74, all in implementation.py.
Call path: reproduce.py -> child run.py --variant <variant> -> direct
  implementation import -> core constructor, join, publish and drain.
Oracle: expected.json, authored before execution; literal typed receipts,
  full queues, payload hex, counts/bytes, generations, active/reason,
  delivery histories and retired slow state. No implementation-derived
  expected policy. Exact types/keys/values are compared recursively.
Instrumentation: restricted sys.setprofile entry/return capture for six
  named eligible methods across variants; four kinds called per variant.
  Records source/function text hashes, path, qualname, line, arguments
  and returns. This is not all-function or branch coverage.
Observer: immediate in-memory deque snapshots. It retains one old slow
  reference for inspection; the core has no retired-session registry.
Runtime code-object hashes vary within retained captures. Preserve them
  as capture-specific; no cause inferred or immutable digest claimed.

E. ACTUAL CAMPAIGN, SCHEDULE AND OBSERVATIONS
Evidence class: one retained primary campaign, three fresh variants.
Runtime: CPython 3.14.7 (main, Aug 5 2026, 10:29:49),
  Clang 21.0.0 (clang-2100.1.1.101).
Platform: macOS-26.5-arm64-arm-64bit-Mach-O.
Primary retained interval, UTC:
  2026-10-28T22:43:06.103109+00:00 to
  2026-10-28T22:43:06.345069+00:00.
Primary working directory:
  /Users/buger/.codex/worktrees/verification-plan-guide/reqforge
Primary wrapper command, one line:
  python3 -B docs/research/remaining-library-refinement-2026-10-28/09-hazard-analysis-to-code/research/fixture/reproduce.py --output docs/research/remaining-library-refinement-2026-10-28/09-hazard-analysis-to-code/research/captured/primary
Exact child argv/cwd/times/exits: captured/primary/commands.json.
Primary wrapper argv/provenance: PROVENANCE.json.

Inputs: IDs 1..7 with byte payloads E001,E002,E003,E004,E005,E006,E007.
Hex: 45303031,45303032,45303033,45303034,45303035,45303036,45303037.
Same schedule for each variant:
  Construct capacity=3; join healthy and slow, both generation 1.
  Capture ready after both joins.
  For n=1..6: publish n; capture publish-n; drain healthy;
    append returned messages to observed history; capture healthy-drain-n.
  Do not drain slow during that burst.
  Retain old slow for observation; join slow; capture slow-rejoin.
  Publish 7; capture publish-7; drain healthy; capture healthy-drain-7;
    drain new slow; capture slow-drain-7.
No paced rate, concurrent scheduler or duration/load sweep selected.
Instrumented schedule executionElapsedNs:
  baseline 25594541; corrected 20849709; reject-all 15237584.
These include profiling/snapshot work and are not throughput evidence.

DECISIVE CAPTURE: publish-4, after publish(4,b'E004') returns,
  before the next healthy drain. Prior slow queue is [1,2,3].
Independent literal expected receipt, also corrected observed receipt:
  {"message":4,"outcomes":{"healthy":{"status":"queued","enqueued":true,"cleared_messages":0,"cleared_payload_bytes":0},"slow":{"status":"disconnected-overflow","enqueued":false,"cleared_messages":3,"cleared_payload_bytes":12}}}
Independent expected consumer state, also corrected observed state:
  healthy={"generation":1,"active":true,"close_reason":null,"queue":[{"id":4,"payload_hex":"45303034"}],"queued_messages":1,"queued_payload_bytes":4}
  slow={"generation":1,"active":false,"close_reason":"overflow","queue":[],"queued_messages":0,"queued_payload_bytes":0}
  delivered={"healthy":[{"id":1,"payload_hex":"45303031"},{"id":2,"payload_hex":"45303032"},{"id":3,"payload_hex":"45303033"}],"slow":[]}
  retired_slow=null
Baseline observed receipt:
  {"message":4,"outcomes":{"healthy":{"status":"queued","enqueued":true,"cleared_messages":0,"cleared_payload_bytes":0},"slow":{"status":"queued","enqueued":true,"cleared_messages":0,"cleared_payload_bytes":0}}}
Baseline observed slow state:
  {"generation":1,"active":true,"close_reason":null,"queue":[{"id":1,"payload_hex":"45303031"},{"id":2,"payload_hex":"45303032"},{"id":3,"payload_hex":"45303033"},{"id":4,"payload_hex":"45303034"}],"queued_messages":4,"queued_payload_bytes":16}
Baseline healthy, delivered and retired_slow at this point equal the
  literal expected values above. Failure: slow exceeds capacity and
  returns queued instead of applying the required overflow effects.

CORRECTION AND RECOVERY
Implemented change: Corrected.publish checks len(queue) before append,
  clears/disconnects only the overflowing consumer, then continues.
Same-schedule correction result: all 17 literal frames match.
At publish-5 and publish-6: corrected slow is inactive/empty; healthy
  queues each offered item and its following drain returns that item.
At slow-rejoin, expected and corrected receipt:
  {"consumer":"slow","generation":2,"replaced_generation":1,"cleared_messages":0,"cleared_payload_bytes":0}
Baseline rejoin clears 6 messages/24 logical bytes. Old baseline slow
  ends inactive with reason 'replaced'; corrected old slow stays inactive
  with reason 'overflow'. Both old queues are then empty.
At publish-7: healthy generation 1 and new slow generation 2 each queue
  only message 7; both are active with close_reason=null.
At healthy-drain-7: healthy queue empty; new slow still holds 7.
At slow-drain-7: both current queues empty; healthy delivered IDs
  [1,2,3,4,5,6,7], new slow [7], with their original payload hex values.
Full expected frames: expected.json.
Full actual frames/returns: captured/primary/{baseline,corrected,reject-all}.stdout.json.

RESULTS AND SENSITIVITY
Variant       Literal frames   Strong gate   Resource-only gate   Child exit
baseline      7/17             FAIL          FAIL                 1
corrected     17/17            PASS          PASS                 0
reject-all    1/17             FAIL          PASS                 1
The resource-only gate uses the SAME captured states, no extra experiment.
Reject-all never enqueues or delivers; its empty queues meet only the
  weaker bound. This is a seeded sensitivity control, not a product defect.
Per variant: 7 publish + 8 drain + 3 join + 1 core constructor =
  19 selected method entries; 17 full snapshots.
Total: 21 publish + 24 drain + 9 join + 3 constructors = 57 entries;
  51 snapshots. Constructor/join/drain calls are not messages.
Slow peak: baseline 6 messages/24 logical bytes; corrected 3/12;
  control 0/0. Healthy peak: baseline/corrected 1/4; control 0/0.
Combined current-queue logical payload peaks: baseline 28 bytes,
  corrected 16 bytes, control 0. These are not per-queue budgets.
Allocator/heap/RSS/network memory evidence: UNPERFORMED.
Excluded from logical byte counts: objects, logs, observer/delivery
  histories, sessions, allocator overhead and transport buffers.
Wrapper exit: 0 means expected failure/correction/control contrast.
All child stderr and wrapper stderr: empty. Source/input hashes unchanged.

PORTABLE REPLAY
Prerequisites: extracted kit, CPython 3.12+, standard library only;
  no Proof, solver, network service, credentials or account.
Working directory: extracted kit directory. Use a new output directory.
Exact command: python3 -B reproduce.py --output replay-output
Keep assertions enabled; do not use -O.
Expected child exits: 1/0/1; wrapper 0. Inspect replay-output/summary.json
  and all child stdout/stderr. Retain the replay as separate evidence.
Compare typed states, arguments/returns and source/function text identities;
  do not require new time/platform/path/runtime-code hashes to match.
Kit: /assets/hazard-analysis-to-code/hazard-analysis-to-code-evidence-kit.zip
ZIP: 22 members, 34278 bytes; SHA256:
  baf5083b59a382e097c490509a0f7000a6284bb789cd425af1b6e2a19050fde2
Integrity/supporting records: MANIFEST.json, SHA256SUMS,
  PROVENANCE.json, EXECUTION-REVIEW.json, captured/primary/summary.json.

F. HISTORY, REMAINING RISK AND RESPONSIBILITIES
hazard-record.json remains the unchanged pre-run record, with NOT RUN.
EVIDENCE-HANDOFF.json separately links completed selected observations.
Technical conclusion: correction meets the literal contract for this
  schedule; baseline and control fail it. Wider mitigation sufficiency
  and failure-class closure are NOT ESTABLISHED.
Remaining work: real intent approval; input-enforcement ownership;
  other capacities, payload sizes, consumer counts and load ranges;
  concurrency, scheduling, transport, whole-process resource behavior;
  actual disconnect/reconnect/loss recovery and related obligations.
Actual implementation owner: UNASSIGNED; teaching correction executed.
Project evidence reviewer: UNASSIGNED; project review UNPERFORMED.
Intended-behavior approver: UNASSIGNED; approval UNPERFORMED.
Residual-risk authority and acceptance policy: UNASSIGNED / UNKNOWN.
Residual-risk decision/reference/constraints/review interval: NOT ASSESSED.
Change acceptance owner: UNASSIGNED; authorized decision UNPERFORMED.
Merge owner: UNASSIGNED; merge UNPERFORMED in this evidence.
Deployment owner: UNASSIGNED; deployment UNPERFORMED in this evidence.
Release decision: NOT ASSESSED.

G. REGRESSION, FRESHNESS AND ACCOUNTABLE NEXT ACTIONS
Reusable check: retain literal oracle and failure/control variants;
  replay the command above and preserve all outcomes with new provenance.
Reassess evidence after changes to intent/loss policy, implementation,
  harness, oracle, runtime, capacity, payloads, topology or target boundary.
Revisit catalog disposition when its applicability or architecture changes.
Intent owner UNASSIGNED: approve or replace loss/future-only policy
  before project adoption; retain the decision reference.
System/implementation owner UNASSIGNED: establish the real topology,
  input assumptions and applicable wider checks before mitigation review.
Evidence reviewer UNASSIGNED: review assertions, raw records and target
  relevance before relying on this fixture for a project claim.
Risk authority UNASSIGNED: establish criteria, assess residuals and record
  an authorized decision before any claim of accepted risk or release.

The NOT RUN value belongs to the preserved pre-run record. The separate handoff adds the observations without rewriting that history. Neither record contains authorized residual-risk acceptance.

03 / Follow a failure into the implementation

A queue limit needs an overflow policy and useful delivery

The new teaching contract uses one producer and two consumers, healthy and slow, in one local process and thread. It is separate from the shared-WebSocket plan. The baseline defect is deliberately seeded: its publish method appends to every active deque without enforcing the declared capacity. The primary campaign executes that implementation, an actual correction and a deliberately inadequate reject-all control.

Fix the expectation before running the code

The independently authored literal oracle specifies complete receipts and states for 17 capture points. It checks payload identities, queue contents, counts and logical bytes, consumer state, delivered histories and the replaced session. The harness compares JSON types as well as values, so false cannot stand in for integer zero.

The schedule is exact: join both consumers, publish messages 1 through 6, and drain healthy immediately after each publication. Slow does not drain. Then explicitly rejoin slow, publish message 7, drain healthy and drain new slow. Each payload is four bytes, E001 through E007; the payload-size assumption is not a tested validator.

Capture point / Independent expectation, also observed in the correction / Baseline observation
Capture point Independent expectation, also observed in the correction Baseline observation
healthy-drain-3 Healthy empty; slow holds [1,2,3], three messages/12 logical bytes. Same.
publish-4 Slow cleared and inactive; 4 not enqueued there. Healthy holds [4]. Slow stays active with [1,2,3,4], four messages/16 logical bytes.
healthy-drain-4 Healthy has delivered [1,2,3,4]; both current queues empty. Healthy progresses, but slow retains its four items.
publish-5, publish-6 Slow reports inactive; healthy queues each offer for its next drain. Slow retains five then six items, reaching 24 logical bytes.
slow-rejoin New slow is generation 2, active and empty; old slow remains cleared with reason overflow. Rejoin clears six messages/24 bytes; old reason becomes replaced.
publish-7 and following drains Healthy receives 7; new slow receives only 7. Final current queues are empty. Same final deliveries, but earlier policy violations and the retired-state difference remain.

These are summaries of full frames, not substitute assertions. Inspect the failed output, compare the correction, or download the runnable evidence kit.

The implemented correction acts before enqueue

The actual changed block in Corrected.publish checks the current queue before appending:

if len(consumer.queue) >= self.capacity:
    count = len(consumer.queue)
    size = sum(len(item[1]) for item in consumer.queue)
    consumer.queue.clear()
    consumer.active = False
    consumer.close_reason = 'overflow'
    outcomes[name] = {'status': 'disconnected-overflow', 'enqueued': False,
                      'cleared_messages': count, 'cleared_payload_bytes': size}
    continue

The complete method also skips inactive consumers and enqueues for active consumers with space. continue advances to the next consumer. Clearing the old backlog and refusing the triggering offer are observable parts of this policy; silently dropping an oldest item would be a different policy.

The harness directly imports these methods and records selected real entries and returns. Its source-file and qualified-name filter, actual arguments, returned receipts and immediate deque observations connect the contract to implementation execution. They do not establish coverage of every function or branch.

Challenge the criterion with a control

Variant / Full literal frames matched / Selected contract / Resource-only gate on the same states / Slow queue peak / Child exit
Variant Full literal frames matched Selected contract Resource-only gate on the same states Slow queue peak Child exit
Baseline 7/17 Fail Fail 6 messages / 24 logical bytes 1
Corrected 17/17 Pass Pass 3 messages / 12 logical bytes 0
Reject-all control 1/17 Fail Pass 0 messages / 0 bytes 1

The control never enqueues or delivers. It satisfies the weaker resource bound while failing required progress. That is a limitation of the weaker criterion, not a false pass of the complete contract. Both assessments use the same observed states; there is no additional resource experiment. Recorded summary.

The corrected run's combined current-queue payload peaks at 16 logical bytes while each queue stays within its own twelve-byte budget. The baseline combined peak is 28; the control's is zero. These sums count queued payload references per queue. Object headers, session objects, logs, delivered histories, allocator overhead, process/RSS and network buffers are outside that measurement. No exhaustion or crash was observed.

Reproduce the retained contrast

Use the 22-member kit, its checksum and README. From the extracted directory, with CPython 3.12 or later and a new output directory, run:

python3 -B reproduce.py --output replay-output

Only the standard library is required. No Proof, solver, network service or account is needed. Keep assertions enabled; do not add -O. The wrapper refuses an existing output directory and expects child exits 1/0/1. Wrapper exit 0 means that this failure/correction/control contrast reproduced. Inspect replay-output/summary.json and the three full stdout records, rather than treating that exit as product acceptance.

The original capture used CPython 3.14.7 on macOS 26.5 arm64. Its commands, provenance and execution review retain exact times and identities. All child stderr files are empty. The measured schedule durations include profiling and snapshots; they are not a throughput comparison. Keep any replay under its own runtime and timestamp.

The supported conclusion is repair of the reproduced policy violation and agreement with the other selected literal frames. Transport behavior, interleavings, broader load/resource conditions and the acceptability of losing messages remain separate work.

Follow the hazard through six decisions

Download the complete video transcript.

Read the complete video transcript

Start with one exposure: a consumer stops draining while publication continues. Record the possible consequence, the system boundary, and who can approve the mitigation policy. In this fictional teaching case, the queue obligation applies. That means mitigation work is required; it does not mean anyone has accepted the remaining risk.

The recorded implementation runs locally, in one process and one thread, with one producer and two consumers. Each queue permits three messages with four payload bytes each. The twelve-byte budget counts queued payload only. It says nothing about total process memory, network buffers, or every possible load.

During the selected burst, the healthy consumer drains after each publication while the slow consumer does not. At the fourth offer, the baseline keeps four messages in the slow queue and violates the policy. The expected response and full state were fixed in a literal table before execution.

The implemented correction checks capacity before appending. It clears the slow consumer's three queued messages, makes that consumer inactive, and does not enqueue the fourth. Healthy delivery continues. Later offers skip the inactive consumer. This is an observed local state change; no WebSocket or network connection was exercised.

An explicit rejoin creates a new slow session, advancing its generation from one to two. It receives only the future seventh message. The corrected variant matches all seventeen recorded snapshots. The reject-all control keeps queues empty but delivers nothing, showing why a resource-only check cannot establish the required behavior.

Keep the original planning record unchanged and attach the observations in a separate evidence handoff. The selected correction passes, while broader transport, concurrency, and resource conditions remain unperformed. A real project still needs approved intent, named owners, and an authorized residual-risk decision. Test success does not accept a Change, merge it, or deploy it.

Read the text walkthrough

1. Scope the hazard

Start with one exposure: a consumer stops draining while publication continues. Record the possible consequence, the system boundary, and who can approve the mitigation policy. In this fictional teaching case, the queue obligation applies. That means mitigation work is required; it does not mean anyone has accepted the remaining risk.

2. Set the boundary

The recorded implementation runs locally, in one process and one thread, with one producer and two consumers. Each queue permits three messages with four payload bytes each. The twelve-byte budget counts queued payload only. It says nothing about total process memory, network buffers, or every possible load.

3. Read the failure

During the selected burst, the healthy consumer drains after each publication while the slow consumer does not. At the fourth offer, the baseline keeps four messages in the slow queue and violates the policy. The expected response and full state were fixed in a literal table before execution.

4. Inspect the correction

The implemented correction checks capacity before appending. It clears the slow consumer's three queued messages, makes that consumer inactive, and does not enqueue the fourth. Healthy delivery continues. Later offers skip the inactive consumer. This is an observed local state change; no WebSocket or network connection was exercised.

5. Check recovery and useful work

An explicit rejoin creates a new slow session, advancing its generation from one to two. It receives only the future seventh message. The corrected variant matches all seventeen recorded snapshots. The reject-all control keeps queues empty but delivers nothing, showing why a resource-only check cannot establish the required behavior.

6. Keep the decision open

Keep the original planning record unchanged and attach the observations in a separate evidence handoff. The selected correction passes, while broader transport, concurrency, and resource conditions remain unperformed. A real project still needs approved intent, named owners, and an authorized residual-risk decision. Test success does not accept a Change, merge it, or deploy it.

04 / Make the chain repeatable

How to carry one hazard into a reviewable decision

1. Establish the exposure and decision boundary

Name the operating condition, causal behavior and potential consequence. Separate an observed failure from a plausible consequence. Identify the component, interfaces, source revision and decision being requested. A statement such as “slow consumers might exhaust resources” still needs the particular queues, producers, consumers and resources in scope.

2. Find the authoritative behavior and responsible owners

Locate the requirement, operational constraint or other agreed intent. Resolve who may approve a behavior change and who may accept residual risk. If loss, blocking, disconnect or recovery behavior is unsettled, record that decision before treating a test oracle as approved. Useful technical investigation can continue with explicitly provisional intent.

3. Review candidate applicability

Read each candidate's actual prerequisites and retain its identity/version. Record why it applies or why the architecture excludes it. A working implementation does not make a duty inapplicable. Delegate ownership explicitly when another requirement owns the control; track unfinished work as debt with an owner and revisit trigger.

4. Write one precise mitigation policy

State capacity units, affected scope, trigger timing, response and state effects. Include required successful behavior and what recovery means. For a queue, decide what happens to already queued items, the triggering offer, later offers and the next session. Only require other overflow alternatives if the actual product supports them.

5. Design the observation before the execution

Choose inputs and an independent expected result that distinguish the intended behavior from a plausible faulty implementation. State exact capture points and what the observer can see. A resource claim needs its actual resource measurement; a transport claim needs the relevant transport boundary. Record the harness, environment, instrumentation and known differences from the target.

6. Execute, retain the failure and replay the correction

Confirm the command reaches the intended implementation. Preserve raw arguments, returns, effects, exits and source identities. After correction, replay the witness and the other selected checks; challenge a weak oracle with a control where useful. Keep a new run's metadata separate from archived evidence. NASA's testing provisions provide a related precedent for controlled test artifacts and recorded evaluation. NPR 7150.2D §§4.5.2–4.5.5.

7. Assess remaining risk and obtain the appropriate decision

State exactly what the evidence supports, what the mitigation sacrifices and which conditions remain unexamined. Obtain the applicable decision under the project's actual risk criteria and authority. Record constraints and the next review trigger. Keep that decision separate from evidence review, Change acceptance, merge and deployment.

8. Retain regression checks and freshness triggers

Keep the failure, oracle and successful replay available to the next engineer. Reassess when intent, code, payload domain, topology, capacity, environment or the checking method changes. Renew affected observations or document why reuse remains justified. A suppression must also reopen when its architectural premise disappears.

05 / Check the handoff

Hazard-to-code review checklist

Before relying on technical evidence

  • The exposure, causal path and consequence have an explicit boundary.
  • Intent authority, candidate version and applicability rationale are recorded.
  • The policy states units, overflow effects, useful progress and recovery.
  • The oracle is justified independently and observes the relevant effects.
  • The command reaches identified implementation code; raw results are retained.
  • Counts, durations, measured resources and unperformed conditions are labeled.

Before recording acceptance

  • Remaining loss and service consequences have been assessed by the responsible owners.
  • Related obligations and broader failure-class work retain their own statuses.
  • The reviewed evidence matches the intended candidate or has a justified reuse decision.
  • The authorized risk decision names criteria, scope, rationale and review conditions.
  • Change acceptance, merge and deployment each have their own responsible actor and record.

06 / Catch misleading shortcuts

Mistakes that break the hazard-to-evidence chain

Mistake / Why it misleads / Repair
Mistake Why it misleads Repair
Suppress a duty because the fix already exists Satisfaction is being substituted for nonapplicability. Keep the applicable duty and link its mitigation evidence.
Hide unfinished work behind a review stamp A completed review can still identify unevidenced mitigation. Retain the required work, owner and tracking record.
Replace “three messages” with “bounded memory” Payload lengths, object costs, histories and other allocations are different quantities. State the measured units and plan any broader resource evidence separately.
Treat disconnect as harmless cleanup The policy may discard queued work or interrupt a legitimate consumer. Specify the lost work and have the intent owner assess that behavior.
Observe only the final empty queues Rejoin can erase the backlog that exposed an earlier violation. Capture before cleanup and retain the event history and receipts.
Import a catalog's example load as the recorded workload Recommended scenarios are being promoted into observations. Retain the actual schedule and mark additional load work as planned.
Treat a recorded search for similar defects as complete class mitigation A relationship or field's presence does not establish the quality or extent of the search. Review the searched scope, method, findings and remaining gaps.

07 / Keep the project record connected

Use Proof to maintain the obligation and evidence links

Begin with resolved requirements, the actual architecture and the project's effective catalog version. In a configured Proof project, these inspection commands locate the relevant shipped class:

proof catalog list --domain ipc
proof catalog show back_pressure_bounded

These are source-supported workflow instructions, not commands executed in the queue campaign. Read the full applicability and evidence guidance. The class is active at catalog_version: 1; it includes queued in-memory paths and excludes pure synchronous request/response without a queue. It calls for explicit capacity and a documented overflow policy. Its example capacity and suggested load are not this fixture's settings.

Use proof req edit to attach applicable obligations with --add-obligation, record genuine nonapplicability with --suppress-obligation, track unfinished required work with --defer-obligation, or identify another owning requirement with --delegate-obligation. Retain rationale and the required tracking/ownership fields. Hazard-review metadata and stamps record review context; they do not supply mitigation observations or risk authority. If no class captures a distinct duty, proof catalog new can author a project class; first establish that the shipped catalog does not already cover it.

The current checks answer narrower questions:

Check / What its current implementation examines / What a satisfactory result does not establish
Check What its current implementation examines What a satisfactory result does not establish
obligation_baseline At SPEC stage, declared/profile-filtered baseline dispositions, including valid delegation relationships. Successful mitigation or complete hazard identification.
hazard_review_current At SPEC stage, review metadata, age, catalog version and category coverage. Semantic adequacy of the safety or risk argument.
code_signal_obligations_reviewed At VERIFY stage, code-signal ownership, disposition and tracked debt. All hazards discovered or the queue schedule executed.
obligation_evidence_complete At VERIFY stage, configured combinations of requirement, obligation class and evidence type, with applicable provenance. Correct assertions, acceptable remaining risk or release authorization.

The evidence check combines configured project rules, the nominal evidence floor for implementable requirements, permitted exemptions and extra evidence declared by each requirement. The queue class has recommended-evidence notes, not its own required-evidence field. A recommended scenario is not automatically executed. Deferrals remain tracked debt evaluated under the configured KnownIssue policy; a workflow debt disposition does not by itself supply an authorized residual-risk decision. Implementation basis.

The Agents and MCP workflow can bring requirements, hazards, dependencies and retained evidence into an agent's context. Execution and changes still use the repository, CI and permissions. Record the actual approval policy and actor instead of assuming that a green status means a person approved the work. No Proof audit, authorized Change acceptance, merge or deployment is part of this teaching campaign.

For a bounded written predicate within the mitigation, Spec Lab can help review its interpretation and plan cases. Its written planning does not execute repository or network tests, establish this queue's stateful behavior, or accept risk.

08 / Choose evidence for the claim

Which method or workflow should you use?

Choose the method that can observe the claim, then choose a place to maintain the record. The recommendations below use the method and implementation sources; they are not a comparative tool benchmark.

Your immediate question / Useful choice / Evidence still required
Your immediate question Useful choice Evidence still required
Is this hazard applicable, and what behavior is authorized? Architecture and intent review using a controlled record; use a catalog as a candidate aid. Rationale, assumptions, owner and actual approval basis.
Does this implementation produce the specified local state? Direct implementation tests with an independently justified literal oracle, as in the kit. Actual calls, effects, sensitivity and identified source/runtime.
Does the deployed boundary preserve progress and resources? Planned target integration, fault and load checks suited to that boundary. Real transport, scheduler, workload and resource observations; absent from this fixture.
Can later changes find the obligations and retained evidence? Versioned documents/repository records, CI, or a connected requirements workflow such as Proof. Maintained links, credible assertions, freshness review and enforced project policy.
Is the remaining risk acceptable? The governing risk-decision process. Authorized decision, criteria, evidence, constraints and review interval.

Check the data structure's policy before selecting it

Python documents that appending to a full bounded deque discards items from the opposite end. Thus deque(maxlen=3) alone would implement a different policy from this contract's clear-and-deactivate behavior. That is a documentation-based design comparison, not a fourth executed variant. Official deque documentation.

09 / Inspect the basis and reproduce the result

Primary sources and reproducibility

Method and authority

Primary source / Support used here / Applicability and read boundary
Primary source Support used here Applicability and read boundary
NASA NPR 7150.2D, Preface and §3.12.1, SWE-052 Applicability and classification-dependent links between requirements, hazards, design, code and verification. Targeted provisions; no project classification, tailoring or complete compliance mapping performed.
NASA NPR 7150.2D, §§4.5.2–4.5.5 and 4.5.12 Test artifacts, controlled items, evaluated results and testing hazard-related requirements. Does not prescribe this queue policy or establish that a particular test ran.
NASA NPR 8000.4C, §2.3 and §§3.4.2, 3.5 Separate authority, mitigation, risk acceptance and closure records. NASA context and stated applicability; no authority conferred on this fixture's author.
Python 3.14 collections documentation Bounded-deque append behavior and clearing. Documentation semantics; the retained executed runtime is separately identified as CPython 3.14.7.

The NASA reads are targeted method and authority references, not a full-directive, FMEA/STPA or safety-standard assessment. They are not universal commercial mandates. The contract and worksheet are original engineering choices; neither establishes certification.

Implementation and evidence

Artifact / What to inspect
Artifact What to inspect
CONTRACT.md and expected.json The authored policy and before-execution literal expectations.
implementation.py, run.py and reproduce.py Actual implementation, observation/comparison path and portable wrapper.
Primary summary and commands Counts, gate results, exact child invocations, timestamps and exits.
Baseline, corrected and control Every selected method entry/return and full observed frame, including failures.
Pre-run hazard record and evidence handoff The unchanged planning history and separate completed evidence record, with decisions still open.
PROVENANCE.json, EXECUTION-REVIEW.json, MANIFEST.json and SHA256SUMS Original runtime/basis, bounded conclusions and file identities.

The portable ZIP contains the exact source and captured texts; the outer checksum identifies the archive. The reproduction instructions preserve the primary capture. A digest identifies bytes; a link or matching digest alone does not establish execution, assertion quality or acceptance.

Proof capability basis

The workflow statements use the current inspected catalog and implementation: pkg/catalog/data/domain/ipc/back_pressure_bounded.yaml; cmd/proof/catalog.go; cmd/proof/req.go; pkg/roles/builtin/hazard-analysis.md; pkg/lint/hazard_review_current.go; and pkg/workflow/workflow_obligation_baseline.go, workflow_code_signal_obligations.go, workflow_obligation_evidence.go and obligation_evidence_matrix.go. The class identity and source digest are retained in the filled record.

pkg/problemreports/class_mitigation.go supports advisory witness/signal relationships and a presence-based sibling-sweep reminder. Those checks do not establish semantic class mitigation. Catalog framework references remain unassessed pointers, not demonstrated normative coverage. These are source-inspected capabilities, separate from the Python campaign.

The public agent workflow describes project context and repository actions. The editable audit/correctness intake is supported by website/demo.html and website/assets/engagement-intake.js; website/assets/spec-lab/hazard-plan.mjs explicitly distinguishes planned checks from execution evidence.

10 / Apply the record to a different decision

Two additional hazard-review examples

These are illustrative planning situations. Neither was executed in the queue campaign.

1. A suppression expires when buffering appears

A synchronous component has no producer/consumer queue. Under that architecture, the queued-path candidate may be inapplicable. Record the source boundary and the no-queue assumption.

A later change adds an asynchronous retry buffer. That change invalidates the old rationale. Reopen applicability, identify the buffer's owner and specify its capacity and overflow behavior before reusing the suppression. The earlier record can remain correct for its old architecture while being unusable for the new one. This follows the shipped class's explicit applicability boundary.

2. A bounded queue can implement the wrong mitigation

Suppose an approved requirement forbids losing acknowledged work. A proposed overflow policy discards queued items and lets the producer continue. Even a successful bound check would not demonstrate that requirement.

Resolve where acknowledgment occurs and what preserves the promised work. Select an authorized policy, then plan observations across overflow, failure and recovery at that boundary. A risk decision cannot quietly rewrite the loss promise; any permitted requirement change needs its own authority and trace. The teaching policy must not be imported merely because its selected test passes.

11 / Resolve the remaining questions

Hazard-to-code questions, answered

Must I test every possible overflow policy?

No. Establish the policy your requirement actually permits and obtain evidence for it. If a product exposes several configurable policies, each supported configuration needs its relevant obligations. A catalog's alternatives are choices to resolve, not a demand to implement every option.

What changes when publishers can run concurrently?

The capacity check and subsequent state changes become a compound operation whose ordering needs its own argument and evidence. Python's documented safety for individual deque appends and pops does not establish atomicity of this larger sequence. Define synchronization and relevant interleavings for the actual implementation; the single-threaded campaign supplies none. Deque documentation.

Does an input precondition require a validator inside the queue?

Not automatically. Record the admissible domain and which component is responsible for enforcing it. An external contract might require rejection or recovery, but the teaching fixture does not establish such a duty. Here, four-byte payloads are supplied by the caller; arbitrary payload handling and validation remain unperformed.

Can I reuse the evidence when a runtime hash changes?

First identify which hash changed. The retained marshaled code-object hashes vary within the same function/run, so they are capture-specific. Compare the stable source and function-text identities, actual arguments/returns and typed states. Review runtime and environment changes separately; matching selected results does not establish a broad runtime matrix.

Can one repaired witness close the hazard?

It can support repair of that witness. Closing the hazard requires the declared mitigation scope, remaining consequences and applicable evidence to be assessed under the responsible authority. Wider selected checks can strengthen the technical case; neither their count nor a passing command supplies the authorized risk decision.