Skip to content

Test Suite 1 — Output routing & envelope shape

mchristegh edited this page Jul 10, 2026 · 1 revision
Harness function suite1() in test-scripts/test-harness.js
Checks 27 (the # column below reconciles)
Kind Synchronous

The foundation suite: proves the four-output exclusivity guarantees and the standard message envelope, since every other suite implicitly relies on both.

Baseline config (applies unless a scenario says otherwise): plain numeric node — mean aggregation, Above-mode, trigger 60 / release 55, quorum and staleness disabled, Emit aggregate on change only checked, heartbeat off, persistence off.

Traceability convention: the Check column is the harness's literal PASS/FAIL string — a failing line in the test output can be searched in this document verbatim. Rows covering a repeated pattern (e.g. the eleven envelope-field checks) show the pattern once with the substitutions listed. This document moves with the harness: a new, renamed, or removed check lands here in the same change.


1.1 First reading and genuine trigger

A single reading of 70 on a fresh node — two events, causal order.

# Check Protects
1 first reading emits sourceadded then triggered Causal event order; one-message-one-event — a first reading is sourceadded, not sourceadded plus reading
2 sourceadded routes to output 4 only Output exclusivity: reading-class events never touch outputs 1–3
3 triggered routes to outputs 1 AND 4 A genuine Trigger fires on output 1 with a duplicate copy on Events
4 output-1 copy is not ignored Outputs 1/2 never carry an ignored message

1.2 Envelope shape and clone integrity

Inspects the output-1 message produced in 1.1.

# Check Protects
5–15 envelope has .<field> — for consensusEvent, consensusState, aggregate, aggregation, quorum, freshCount, sourceCount, sources, disabled, ignored, source The full standard envelope is present on every output message
16 envelope clones triggering msg payload Every output is a clone of its triggering message — original payload preserved
17 envelope clones triggering msg topic …and original topic preserved
18 envelope source is external A live incoming reading is externally sourced
19 per-source breakdown carries value msg.sources exposes each source's latest value

1.3 Query isolation

A query command.

# Check Protects
20 query routes to output 3 only Query never leaks onto the Events output (or any other)
21 query event name The snapshot is labeled consensusEvent: "query"

1.4 Hysteresis release routing

A reading of 40 while latched from 1.1 (below release 55).

# Check Protects
22 released routes to outputs 2 AND 4 A genuine Release fires on output 2 with a duplicate copy on Events
23 release reason is threshold releaseReason distinguishes a threshold release from a quorum-lost release

1.5 Rejected readings (coercion and topic gates)

A payload of "abc" with a valid topic, then a numeric payload with no topic.

# Check Protects
24 unparseable payload is reading ignored:true ignored is a modifier on the attempted event (reading), never a separate event category
25 rejected reading routes to output 4 only Blocked/rejected attempts appear only on Events — and are never silently dropped
26 rejectedValue carries the attempt Downstream consumers can see exactly what was refused
27 missing topic is reading ignored:true The topic gate rejects identity-less readings the same observable way

Clone this wiki locally