Repository navigation
P3-H: SMV standards invariants, deterministic WirePlan and recovery orchestration #139
Description
Purpose
Harden the existing Sampled Values / Process Bus implementation without creating a second protocol authority or restarting the already-completed P2/P3 work.
This issue is a continuation/recovery anchor for #24, #33 and #36 on the current main baseline c7238d3a8ff86b30b397164c5fcbed820562b3e0.
Non-negotiable architecture rules
- One standards authority. Generic Ethernet invariants live in the Ethernet/core layer; SV-profile rules live in the SV profile layer; ESP32-P4 only enforces device capability. Do not copy the same numeric rule into multiple layers unless it is a compile-time dependency boundary.
- SCL/configuration is engineering intent, not realtime work. No XML parsing, string/type resolution, heap allocation, packet rescanning, or logging is introduced into the deterministic TX hot path.
- Standard validity != device deployability. A profile may be standards-valid but unsupported by the current ESP32-P4 target. Reject as unsupported-device-capability rather than calling it invalid IEC.
- Observed wire facts != configured intent != conformance claim. Preserve the existing evidence boundary.
- No vendor branches. Vendor evidence may inform tests/profile capability data, but protocol code remains vendor-neutral.
- No silent fallback. Unsupported/ambiguous profile fields remain explicit and fail closed.
Recovery / multi-thread protocol
When a thread/session loses context, do not restart from old milestones.
Recovery sequence:
- read this issue and linked open/merged PR lineage;
- read
NORTH_STAR.mdanddocs/SMV_INJECTOR_STATUS.md; - inspect current
mainhead and compare against the last accepted PR head; - continue only the first unchecked phase whose dependencies are already merged/accepted;
- never rebuild an existing authority in a new helper/model if an equivalent canonical type already exists;
- each PR records exact base SHA, scope, non-goals, acceptance evidence and next node.
Parallel threads must own separate phases/files where practical. A later PR must rebase/re-evaluate against current main before merge; never force an older implementation over newer accepted progress.
P0 — standards invariant hardening
- Introduce/reuse one canonical Ethernet VLAN validity rule: PCP 0..7, VID 0..4094; VID 4095 is reserved and must be rejected before encoding/deployment.
- Fix SV profile compiler, embedded runtime validator and development control bridge so VID 4095 cannot pass an upstream gate and fail only inside the encoder.
- Align any generic PTP Ethernet builder that still accepts VID 4095 with the same Ethernet invariant without changing the PTP runtime policy that intentionally disallows VID 0.
- Preserve VID 0 for SV priority-tagged traffic.
- Add boundary regression tests: VID 0 valid where allowed, 4094 valid, 4095 rejected.
- No change to current proven 4I+4V wire bytes for valid configurations.
P0.1 — deterministic WirePlan / patch metadata
Follow-up PR after P0:
- encoder-produced patch metadata for each ASDU;
- no byte-pattern search such as
find_fixed_field(); - patch descriptors are offsets/widths produced while encoding, not rediscovered afterward;
- structure must naturally scale to multi-ASDU without a second BER parser.
P1 — timing/profile semantic model
- separate sampling rate, ASDU-per-frame, frame cadence, counter modulus and epoch policy;
- retain current 1-ASDU 4I+4V target as a device capability, not the generic engine definition;
- prepare explicit Generic IEC 61850-9-2 / Legacy 9-2LE / IEC 61869-9 profile-family rules without overclaiming conformance.
P2+ later gates
- configurable IEC 61869-9 datasets/scaling;
- deterministic multi-stream scheduler;
- hardware TX timing evidence correlated with smpCnt;
- process-bus admission planner;
- PRP/HSR adapter layer;
- independent multi-vendor interoperability/conformance evidence.
Acceptance discipline
A code PR is not accepted merely because it compiles. Require:
- focused regression tests for the changed invariant;
- existing C++/security/embedded CI remains green;
- no golden-wire regression for valid reference frames;
- exact-head evidence recorded in the PR;
- physical evidence remains a separate gate when hardware behavior is claimed.
Parent roadmap: #24
Profile foundation: #33
Compiled device profile: #36
Timing evidence: #21
Activity
P0: centralize VLAN invariants across Process Bus paths
P0.1: generate deterministic SV patch layout during encode
masarray commentedon Oct 6, 2026
Recovery checkpoint — 2026-10-07 P1.1 / P1.2 handoff
Accepted lineage:
ea42c6892768fc48f996e4b011d43648b1241542f3a107ec4cc4eca553ee467911c979afd057ce4d67cf57e01e3d53a98c66b10934f73c0eb1381d75Current active node:
hardening/smv-p1-1-profile-family5ded1506ddb58cf8b3f7eb2183abb501d9ab3e24main@67cf57e01e3d53a98c66b10934f73c0eb1381d75P1.1 review hardening added after the originally green head:
SampledValueControl@multicastno longer normalizes silently into deployable multicast=true;Therefore: do not merge #143 based on the previously green head
2cb0f8a.... Exact-head CI for5ded1506...is the only acceptance authority. No failure observed at checkpoint time; workflows are running/queued.Next coordination node:
P1.2 standards boundary recorded in #144:
Freeze/refresh rule:
CI: lock deterministic SV publication boundaries
P3-H P0: centralize Process Bus VLAN invariants (#140)
P3-H P0.1: encoder-produced deterministic SV WirePlan (#141)
P1: separate SV sampling semantics from frame cadence
P1: expose explicit SmpPerPeriod timing context
P1 review: harden SCL sampling-mode compatibility
P3-H P1: separate SV sampling and Ethernet frame cadence (#142)
P1.1: establish explicit SV transport and profile-family authority
P1.1: wire explicit SV family resolution through engineering surfaces
P1.1 review: make SV profile-family resolution per stream
CI: make mixed-stream family regression cardinality-agnostic
1 remaining item
P1.1 review: preserve SV transport provenance in semantic comparison
P3-H P1.1: explicit SV profile-family and transport authority (#143)
P3-H P1.2: IEC 61869-9 variant, dataset and scaling authority (#145)
P1.3: preserve explicit nofASDU invalidity across SCL pathways
masarray commentedon Oct 7, 2026
2026-10-07 recovery checkpoint — P1.2 merged / P1.3 active
Accepted lineage: #140, #141, #142, #143, and #145 (P1.2) are merged.
0a08767df0352b0311fdcf5d31a9782ccba1a13b2a524f97f2554b61199e811248450ecd64ba64c4.New narrow post-P1.2 node:
main@0a08767df0352b0311fdcf5d31a9782ccba1a13bhardening/smv-p1-3-nofasdu-provenance76749d5718affb738a45cd6845c120ce9363da0fRemaining broader milestones: #33 interoperability breadth; #21 hardware TX timing evidence; #36 compiled-profile physical 4000/4800 acceptance; #24 parent P3. Keep open pending their independent acceptance evidence.
masarray commentedon Oct 7, 2026
Recovery checkpoint — 2026-10-07 P1.3 MERGED / P3-A1 next
Accepted host standards lineage
nofASDU: exact head76749d5718affb738a45cd6845c120ce9363da0f, 15/15 pull_request workflows completed SUCCESS, six-file parser/model/compiler/exporter/workspace/test diff audited, merged with expected-head lease.bdd895ae8641dbf3d9c5c6509e3eb94f78802b8d. Verified PR P3-H P1.3: fail-closed SCL nofASDU provenance #148 merged and Issue P3-H P1.3: fail-closed SCL nofASDU provenance and round-trip #147 CLOSED/completed. No runtime realtime/codecs or new authorities were introduced.First unaccepted node — existing #146 / #36 (do not recreate)
hardening/smv-p1-3-device-profile-binaryexact headdeda183bfb5ffa97bbc5bb009004bfc3d7904f98, 7 changed files. Retargeted base tomain@bdd895ae...; GitHub reports mergeable/clean, Draft retained.tests/test_scl.cppretains P1.3 malformed nofASDU negative cases AND P3-A1 device-envelope cases, then new exact-head full CI on the combined tree.ptp_lab_task.cppEMAC timestamp TX helper must be reused/adapted for SV correlation; canonicalapp_main.cppstill uses regularesp_eth_transmit(), without actual TX hardware timestamps. No unproven timing claim.Safe continuation
Recovery rule: never go back to P0–P1.3 unless a verified regression requires it. Accepted main =
bdd895ae8641dbf3d9c5c6509e3eb94f78802b8dat this checkpoint.P3-H P1.3: fail-closed SCL nofASDU provenance (#148)
Merge accepted P1.3 into P3-A1 and harden binary decoder
masarray commentedon Oct 7, 2026
Recovery P3-A1 checkpoint — 2026-10-07 (post P1.3 accepted)
bdd895ae8641dbf3d9c5c6509e3eb94f78802b8d(P3-H P1.3: fail-closed SCL nofASDU provenance #148 P1.3 merged / P3-H P1.3: fail-closed SCL nofASDU provenance and round-trip #147 closed).hardening/smv-p1-3-device-profile-binary, now483bd90e64891a62d474e94729b1a6a1b7c5f5a2. Integrated main by a two-parent fast-forward merge commit with branch-head expected-SHA lease (no force push). GitHub compare: ahead 5 / behind 0, seven original files in diff.tests/test_scl.cppand P3-A1 device-profile binary SCL tests. Existing V1 codec hardened: reject unknown enum values rather than alias to unicast; decode into temporary validated object, commit output only on success. Tests cover CRC-valid malformed late leaf descriptor, empty rejected output, 3 invalid enum cases; golden valid bytes remain expected unchanged.483bd90e.... Not yet accepted; previous 14/14 green was ondeda183...and must not be reused.RuntimePublisherProfileand STOPPED-onlyruntime_profile_commit(), not a second scheduler/clock/state machine. Do not confuse binary config decode with Sampled Values wire packet decode.masarray commentedon Oct 7, 2026
Recovery checkpoint supplement — active #146 CI fix
The prior recovery comment for #146 lists head
483bd90e64891a62d474e94729b1a6a1b7c5f5a2. That commit is now superseded after exact-head Windows/MSVC CI revealed test-onlyC4244fromstd::fill(..., 0U)in the new malformed-profile regression. The prior head was not merged.Current authoritative PR #146 head:
ba131a2481f8fe70f318488a4234fe2a21525cd1, same branchhardening/smv-p1-3-device-profile-binary, same current main basebdd895ae8641dbf3d9c5c6509e3eb94f78802b8d. Fix:std::uint8_t{0U}prevents narrowing warning in MSVC, retains identical byte semantics. Full exact-head pull_request CI is re-running. Keep Draft/unmerged pending acceptance. No duplicate branch, no fast rollback, no native hot-path changes.masarray commentedon Oct 7, 2026
2026-10-07 P3-A1 milestone — host contract merged, embedded Draft PR #149
Accepted dependency: PR #146 merged after 14/14 exact-head green, now
main@879f84b9b9791ebe700b9f000a0292afb083dc80. Host binary V1 schema/CRC/transactional decode and P1.3 malformed nofASDU regressions are now on main.Firmware implementation: draft PR #149 on
hardening/smv-p3a1-esp32p4-binary-activation, exact headb438d7e40538bfd54fc4e583b6558284a240d4b3(ahead 3, behind 0). No competingRuntimePublisherProfile, clock, scheduler, SV packet encoder or active-state authority introduced.SvDeviceProfileBinaryCodecthrougharstack_process_bus; adapter validates complete V1 envelope and narrows to the currently supported 4I+4V single-ASDUSmpPerSecINT32/Quality layout and SmvOpts, or refuses unsupported IEC-valid profiles.BinaryProfileStagingreceives 48-byte maximum HEX chunks (fits legacy 192-byte console) with increasing transaction ID and strict sequential offsets.PROFILE BINBEGIN/BINCHUNK/BINCOMMIT/BINABORTcannot produce partial activation: only successful binary CRC/schema/layout and STOPPED gate reach existingruntime_profile_commit().PROFILE-BINARY-V1advertised in IDENTIFY and firmware manifest for capability negotiation, while protocol version remains 1.b438d7e40538bfd54fc4e583b6558284a240d4b3, not accepted yet. Do not merge until C++ Windows/Linux, embedded, PTP and release gates pass. This tranche provides software decode/activation path only; hardware 4000/4800 TX/jitter/relay interoperability and GUI binary transport migration remain independent acceptance requirements. Keep P3-A1: compiled SV device profile and deterministic ESP32-P4 activation #36/P3-A: vendor-neutral SCL-driven SV interoperability profile foundation #33/P2: deterministic ESP32-P4 Sampled Values publisher and timing evidence #21 OPEN.masarray commentedon Oct 7, 2026
Recovery checkpoint — 2026-10-07 P3-A1 host and embedded accepted
PR #146 merged after exact-head 14/14 green ->
main@879f84b9b9791ebe700b9f000a0292afb083dc80. PR #149 merged after exact-head 9/9 green -> current main6255d88fe7216dbfa93999a27364958c853c6ca0, ESP32-P4 bounded binary V1 decoder + chunked console staging + existing STOPPED-only atomic runtime activation. Accepted merge SHA and main verified. No duplicate SV clock/scheduler/packet or active-profile authority. Post-merge push CI still running; do not claim verified until completion. Keep #36/#33/#21 OPEN: GUI binary transport migration/ACK proof and physical 4000/4800 egress timing/interop evidence remain. Full gate and technical boundary recorded in #36 comment #6030206107.masarray commentedon Oct 7, 2026
Recovery checkpoint #36 → GUI binary bench PR #150 active, exact head
83dbf331f68c14e0364d7be810a4b834f8d36af6, base accepted main6255d88fe7216dbfa93999a27364958c853c6ca0. Canonical C++->binary, per-chunk ACK, readback generation validation, portable Windows artifact workflow; full details #36 comment #6030507405. CI in progress. Keep #150 Draft, #36/#33/#21 open. Firmware board-test artifact is available via main Actions run 37566223094. Do not create parallel binary codec or duplicate active-profile state.masarray commentedon Oct 7, 2026
Recovery correction — 2026-10-07
Earlier recovery notes pointing to PR #150/browser GUI are superseded. #150 is closed unmerged. Native PR #151 is the only active P3-A1 host integration, exact head
8cebd21a46eb8232571f2dd0648c2a14aaafee11, base6255d88fe7216dbfa93999a27364958c853c6ca0. Product authority is Qt/C++ ARStack Studio and acceptance artifact is the Windows installer + bundled matching firmware. Detailed corrected architecture and state-machine boundary recorded in #36 comment #6033472809. Do not create/revive a browser deployment path.masarray commentedon Oct 7, 2026
Merged native Studio checkpoint: PR #151 ->
main@9e70a4937874e3e1752b725264fe5a2008aa8fb0. Exact release candidate run 37599444383 succeeded and produced native Windows installer artifact #11473055522 with matching bundled ESP32-P4 firmware; tree identity with main verified. Full hashes/evidence in #36 comment #6035184160. Web PR #150 remains closed/superseded. Physical bench gates remain open.