Skip to content

P0-A transactional 4I+4V START, firmware ACK/readback, safe STOP and independent SV PCAP evidence - #252

Open
masarray wants to merge 112 commits into
fix/studio-smart-serial-reconnect-20261019from
fix/p0-sv-reject-unverified-start-20261019
Open

masarray wants to merge 112 commits into
fix/studio-smart-serial-reconnect-20261019from
fix/p0-sv-reject-unverified-start-20261019

Conversation

@masarray

@masarray masarray commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

P0-A implementation scope — fail-closed 4I+4V application transaction

Root cause: previous guided START appended START to 8-channel SET/ENABLE + FREQ/SHAPE Qt queue without firmware-applied ACK. A partial or rejected SET could emit SV with stale/wrong channels.

This PR builds on #247 head f3e445616e9e7d8ba10e787ba4248a1a0396e557 (stack #247 → #246 → #234; no merge to main). Reuses exactly one signal bank, existing UART command parser, DeviceController session generation, and bounded DeviceIoWorker queue.

Code

  • New portable SvScenarioTransaction: bounded 18-field presence bitmask (FREQ, 8 SET, 8 ENABLE, SHAPE), a single isolated SvLiveSignalState draft, shared encoded-state 64-bit hash, 8-second expiry, invalid/reject taint, one atomic bank publish and generation/hash readback.
  • Firmware CFG BEGIN <nonce> <boot_id>, CFG <legacy SET/FREQ/ENABLE/SHAPE>, CFG COMMIT <nonce> <hash>, CFG SHOW <nonce>, then token-bound START <nonce> <boot_id> <hash>. Bare START rejected. Firmware advertises SV-CONFIG-TXN-V1, requires fresh heartbeat control lease; on STOP invalidates the transaction ticket. Explicit successful readback must precede START. No malloc, second supervisor/codec, or ISR changes.
  • Qt normalized typed 8-channel scenario uses the existing formatSignalCommand conversion authority, constructs exactly the same encoded state as firmware, and sends only the bounded exclusive CFG stage/COMMIT initially. Application ACK + readback of session, boot, nonce, hash, generation are required before actual START transmission. STOP/timeout/negative ACK fail closed.
  • Reserved preemptive SV STOP even with a full ordinary worker queue, preserving the independent PTP STOP slot.
  • Preserve last-value-wins GUI updates while applying the immutable snapshot; no unsent START after STOP.

Deterministic regressions

  • tests/test_sv_scenario_transaction.cpp tests atomic visibility, complete/partial sets, stale/replayed tokens, checksum mismatch, malformed data, rejected values, expiry, live generation drift, no START before readback.
  • DeterministicSessionHarness.cpp: bare START rejected; valid COMMIT → READBACK → START ACK; negative/stale ACK, wrong generation, STOP during transaction; saturated command queue priority.
  • Studio operator contract assertions updated from old queued START equals success wording to the stronger ACK/readback chain.
  • Platform targets: C++ GCC/Clang/MSVC, ESP32-P4 firmware, Qt Studio, Windows Lifecycle, Native Preview. Verify exact SHA after CI; do not copy PASS statuses between SHAs.

Important blockers and prohibitions

Do NOT merge or ship without all exact-HEAD CI and physical acceptance. Transaction correctness at source/portable test level is not real on-wire 4I4V equivalence. Need isolated-bench ESP32-P4 IDENTIFY firmware boot/build, serial CFG COMMIT/READBACK/START and SHOW, independently decoded 120s+3600s PCAP (all 8 channels, quality, smpCnt continuity), PTP SOURCE AUTO true MAC evidence + lock timing, resource/ISR/stack and 10x reconnect. Never force smpSynch, automatically flash, or claim physical PASS from CI. Known working rollback remains available.

@masarray
masarray marked this pull request as ready for review October 19, 2026 07:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T07:45:27.980059Z 3dbd29f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dbd29f180

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +666 to +668
if (!identity_.capabilities.contains(QStringLiteral("SV-CONFIG-TXN-V1"), Qt::CaseInsensitive) ||
identity_.bootId.size() != 16 || sessionGeneration_ == 0) {
setError(QStringLiteral("Firmware does not support verified SV configuration transactions; START refused."));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require the transaction capability before reporting READY

When a device has the expected firmware version and the previously required capabilities but lacks SV-CONFIG-TXN-V1, identitySupportsCurrentContract() still makes firmwareIsCompatible() true, so SmartSessionController::reconcile() reports READY with startReady_ = true; every attempted start is then rejected here. Because the bare START path is also permanently disabled by this change, such firmware has no usable injection path while Studio presents it as ready and does not require an update. Add this capability to the compatibility contract or otherwise gate READY on it.

AGENTS.md reference: AGENTS.md:L11-L18

Useful? React with 👍 / 👎.

…ve canonical hash, generation and PROFILE SHOW; fallback legacy unchanged
…+4V readback and generation match; reject stale hash
… START/profile/PTP; reject different device identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant