epiphany/crates/epiphany-ops/src
Levi Neuwirth 9596d1e824 Push 5 / P2: fuzz the ops decode surface, and find the guard's blind spot
The operation layer has exactly two byte-decode surfaces: MaterializedState and
OperationKindTag. Operation payloads have no decoder -- OperationKind is
encode-only -- so nothing here can yet accept a duplicate TransposeInterval
target. When such a decoder lands it inherits the wire table's seq-strictly-
increasing rule: reject a duplicate, never normalize it away.

No defect in the decoder. It already carries the Phase-1 hardening: a whole-state
re-encode-and-compare guard, and with_capacity(n.min(1024)) at every count site,
so the unbounded-allocation and soft-DoS classes P1 fixed in core do not apply.
2M adversarial inputs across four seeds, ~2s each, clean.

The finding is about the ARCHITECTURE, and it qualifies P1's recorded design
note that the guard "is complete-by-construction, it cannot miss a lenient
codec". It is complete only for fields the decoder NORMALIZES. The BTreeMaps
re-sort and de-duplicate, so a non-canonical encoding of them cannot survive a
round trip. But the guard is BLIND to order-preserving Vec fields: a reordered
anomalies or pending list re-encodes to exactly the bytes it came from, so the
guard sees identity and accepts. Only the per-site windows(2) checks reject
them, and the same holds for a conflict record's caused_by / affected_objects,
which ConflictRecord::encode_canonical writes verbatim.

Measured, not reasoned: removing both per-site Vec order checks leaves a 40K
injectivity sweep GREEN. An injectivity fuzzer structurally cannot see this
class -- it asserts bytes->value->bytes identity, which is exactly what a
missing order check preserves. Those checks were locked by nothing. They are now.

(effects is a Vec with no order check, correctly: its canonical order is
reduction order, which a decoder cannot recompute. Two orderings are two
different states, so injectivity is not at stake.)

Delivered: fuzz::run_decode_fuzz over both surfaces, returning a
DecodeFuzzCoverage the smoke tests assert on -- a decode fuzzer that never
reaches a decoder's accept path proves only the absence of a panic, and mine
initially accepted nothing worth speaking of. Plus one deterministic test per
layer: an out-of-order objects map (guard only), an out-of-order anomaly list
and a reordered pending list (per-site only). Each mutation-verified against the
exact check it locks, and the fuzzer confirmed blind to the per-site pair.

Corpus depth is now a property rather than luck. A fixed list of envelope-set
sizes reduces to states with no conflicts, anomalies, pending, or spellings --
the very branches holding every canonical-order check. Measured: 6 of 12 seeds
failed to produce all four. build_decode_corpus draws until covered and asserts.

Gate: fmt clean, clippy 0, 30 targets / 1007 passed / 0 failed, docs 0 under
-D warnings, conformance 8/8, zero golden churn.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 18:43:21 -04:00
..
anomaly.rs Phase 2 (Agent K) M1: value-typed operation payloads + Operation Catalog scaffold 2026-06-24 11:52:02 -04:00
causal.rs Pass 11: ratify provisional byte choices into normative spec text 2026-06-21 22:30:06 -04:00
conflict.rs Pass 11: consolidated byte-layout appendix + pin ObjectKind/ResolutionAction discriminants 2026-06-22 13:16:20 -04:00
decode.rs Pass 12 G-pass: code tranche (K3/K9/C4/H7) + review fixes 2026-07-07 11:21:22 -04:00
effect.rs TransposeInterval: the faithful transpose, and the frozen one it replaces 2026-07-09 15:46:43 -04:00
encode.rs A B C D F 2026-06-19 12:42:31 -04:00
envelope.rs Schema major 1 Phase D2: CreateRegion op-block major + cross-major read-only 2026-07-06 12:09:30 -04:00
fuzz.rs Push 5 / P2: fuzz the ops decode surface, and find the guard's blind spot 2026-07-09 18:43:21 -04:00
lib.rs TransposeInterval: the faithful transpose, and the frozen one it replaces 2026-07-09 15:46:43 -04:00
migrate.rs TransposeInterval: the faithful transpose, and the frozen one it replaces 2026-07-09 15:46:43 -04:00
opset.rs Phase 2 (Agent K) M1: value-typed operation payloads + Operation Catalog scaffold 2026-06-24 11:52:02 -04:00
payload.rs TransposeInterval: the faithful transpose, and the frozen one it replaces 2026-07-09 15:46:43 -04:00
reduce.rs The pitch/spelling undo unit is broader than the transpose, on purpose 2026-07-09 18:15:43 -04:00
slot.rs A B C D F 2026-06-19 12:42:31 -04:00
stamp.rs A B C D F 2026-06-19 12:42:31 -04:00
support.rs Pass 11 follow-up: golden-lock the ratified discriminant tables; fix three spec-text inaccuracies 2026-06-22 09:22:55 -04:00
undo.rs A B C D F 2026-06-19 12:42:31 -04:00
v0.rs TransposeInterval: the faithful transpose, and the frozen one it replaces 2026-07-09 15:46:43 -04:00
validate.rs Schema major 2 Phase D: the repeat-authoring pair (code tranche) 2026-07-07 20:06:18 -04:00
valuegen.rs Schema major 2 Phase D: the repeat-authoring pair (code tranche) 2026-07-07 20:06:18 -04:00