Skip to content

feat(M4-P0E3A): three independent MU CFG transactions with ACK+readback - #347

Open
masarray wants to merge 4 commits into
mainfrom
feat/m4-p0e3a-three-mu-scenario-apply
Open

masarray wants to merge 4 commits into
mainfrom
feat/m4-p0e3a-three-mu-scenario-apply

Conversation

@masarray

Copy link
Copy Markdown
Owner

P0E3A meaningful product milestone

  • Operator can use Apply 3 MU after SCD-based ARM3 roster is confirmed on the stopped board. All three MU drafts are captured and typed-validated before any UART write, so an invalid MU3 cannot partially commit MU1.
  • Shared source-of-truth M4ThreeMuScenarioApply encodes three independent fixed-capacity SVSTREAM 1/2/3 CFG BEGIN/FREQ/8 SET/SHAPE/COMMIT batches, computes each canonical sv_scenario_hash, and requires exact firmware COMMITTED token/hash/generation followed by firmware READBACK token/hash/generation before advancing to the next slot.
  • Uses the existing single DeviceIoWorker with exclusive batch, priority STOP, heartbeat; no cloned worker, no firmware frame-loop changes. Bounded per-step 7s and total monotonic 60s limits, session/boot/transport cancellation and explicit partial-board-state errors.
  • Supervisor requires current SCD hash == selected board ARM3 hash; no competing transactions/firmware handoff/running output. GUI shows distinct roster/upload/bank readback states and provides Stop/F6 cancellation even with publisher stopped.
  • Safety: three-MU START remains intentionally blocked pending independent runtime group START verification and physical 12kfps acceptance; V1 START/PROFILE and Official Stable remain unchanged.
  • Test same production class in existing arstack_m4_upload_harness (MU3 preflight failure; correct all three commits/readbacks; wrong hash; boot epoch fault), plus the existing S8 deterministic harness for STOP and V1 isolation. No extra workflows, runners, or matrix entries. Engineer guide.
    Tracks M4 P0: Three simultaneous SCL-configured 4I4V SV streams with shared PTP grid and per-stream Studio pages #333. Next P0E3B: complete firmware SHOW CT readback/reconnect adoption; then group START gate and P0F physical capture.

…MMIT/readback

Prevalidate/freeze all three typed 4I4V scenario drafts and canonical per-MU hashes before touching UART. Apply fixed 12-command per-slot SVSTREAM CFG batches via the sole DeviceIoWorker, with mandatory firmware token/hash/generation COMMIT+READBACK before moving to next MU. Enforce 7s stage/60s total bounds, STOP/boot/session cancellation and explicit partial-commit diagnostics. Integrate Apply 3 MU in single Studio GUI, keep global START gated. Extend existing M4 and S8 harnesses; no new CI jobs, no MCU realtime-path change.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T09:59:21.995838Z ed4a6a7 PR opened
ℹ️ 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: ed4a6a7f0c

ℹ️ 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 +1243 to +1247
m4ScenarioTimer_.stop();
if (m4Scenarios_.active()) m4Scenarios_.cancel(reason);
const int verified = m4Scenarios_.verifiedSlots();
m4ScenarioApplying_ = false;
m4ScenariosVerified_ = false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Cancel queued MU commands before releasing transaction ownership

If the seven-second timer expires while an exclusive batch is still draining, this only cancels the host state machine; the remaining SET/SHAPE/COMMIT commands stay in DeviceIoWorker::commandQueue_. When serial writes resume, firmware can still accept that COMMIT within its eight-second transaction deadline, changing a bank after Studio has reported cancellation and re-enabled Apply/Deploy. Explicit STOP avoids this through queuePrioritySvStop(), but timeout cancellation never invokes an equivalent queue-retirement path. Cancel or retire the outstanding worker batch before releasing serial ownership so cancelled transactions cannot continue mutating the board.

AGENTS.md reference: AGENTS.md:L160-L163

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in ce4095d5 (current PR head). DeviceController::cancelM4Scenarios now holds m4ScenarioRetiring_ and blocks new Deploy/Apply/SHOW until the existing DeviceIoWorker::retireExclusiveCommands signals complete. The worker drops remaining unsent exclusive CFG commands, preserving normal commands and never emitting an unsolicited STOP; if one command is actively writing, retirement confirmation waits until that write drains. Since already-written COMMIT may execute, GUI reports uncertain/partial bank state and START stays prohibited. Added S8 test for stale queued COMMIT removal, in-flight retirement gating and no SV/PTP STOP. Checking exact-head CI before resolution/merge.

Qt's slots macro collides with an internal DSP slots identifier when live_signal_state.hpp is included after Qt in DeviceController.hpp. Keep the M4 scenario public header transport-only, and load live_signal_transaction.hpp first in its .cpp. Addresses exact compiler log; no ABI or runtime change.
…thority

Serial worker now drops all unsent exclusive MU CFG commands on failed/timeout transaction, but does not synthesize SV/PTP STOP. Its retirement ACK is held until an active write drains; DeviceController maintains the command reservation meanwhile and never infers firmware bank rollback. Add S8 queue retirement and in-flight regression. Addresses Codex P2 safety review; no CI configuration or firmware changes.
…ment fixture

The seedVerified helper models semantic board identity before the asynchronous DeviceIoWorker ready signal. Explicitly mark the existing worker ready in the M4 STOP/retirement regression so the test exercises queued exclusive retirement, rather than failing its admission check.

This branch has not been deployed

No deployments
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