Skip to content

P0 physical PTP stale-role recovery + verified Time Sync clipboard - #266

Closed
masarray wants to merge 16 commits into
fix/p0-ptp-profile-contract-20261020from
fix/p0-ptp-stale-role-recovery-clipboard-20261021
Closed

masarray wants to merge 16 commits into
fix/p0-ptp-profile-contract-20261020from
fix/p0-ptp-stale-role-recovery-clipboard-20261021

Conversation

@masarray

Copy link
Copy Markdown
Owner

Physical incident on ESP32-P4 after PR #265: Studio once showed SOURCE ACTIVE with PTP TX, then displayed OFF/START FAILED while firmware rejected PROFILE PTPROLE with stop PTP before changing operating role. Copy diagnostics in Advanced → Time Sync appeared to do nothing.

Root cause / invariant: Board PTP runtime can stay active after GUI presentation marks it OFF; sending a mutating role request in that state is correctly rejected by firmware. Do NOT force role changes or fake OFF. The production Studio START state machine now recognizes this exact physical rejection and performs ONE bounded PTP STOP → explicit ACK → board PTP SHOW STOPPED readback → same role/config START; no ad hoc sleeps and no re-entry on generic profile errors. A second ACTIVE rejection, STOP timeout or queue failure is terminal STOP-UNVERIFIED and blocks unproven START until manual STOP/board evidence. Operator STOP cancels retained START intent. No changes to SOURCE cadence, SV publisher, PTP hot paths, ISR, smpSynch authority or firmware build.

Clipboard root: Time Sync panel lacked the module import that FirmwarePanel already had for its registered StudioClipboard singleton; the native adapter also returned void while UI unconditionally claimed “copied” with no clipboard readback. Explicit module import; adapter returns true only after OS clipboard contains exact multi-line diagnostics; on error Studio exposes a selectable modal copy fallback (no scripts). Firmware tab similarly reports truthful feedback. Native standalone Qt clipboard harness uses production adapter and tests empty, multiline, repeated copies and stale data. Windows+Linux Studio Qt CI and exact Windows Native Preview packaging run it; structural tests guard import/fallback path.

Regression matrix: stale runtime triggers exactly one verified STOP and resumes the same role; missed STOP readback blocks START; second rejected role no infinite loops or fabricated OFF; manual STOP cancels recovery; original positive verified START and negative wrong role/config remain. No main merge/public-release or physical PTP/SV certification without board evidence.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-20T21:31:01.103577Z 799b664 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: 799b66481f

ℹ️ 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".

boardStillRunning) {
const QString cause = QStringLiteral("Board PTP remained ACTIVE after one verified "
"STOP; manual STOP is required before START.");
ptpLastStartFailure_ = cause;

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 Clear the transient failure after successful recovery

When the first stale-runtime rejection occurs, this assigns a terminal-sounding value to ptpLastStartFailure_, but the successful STOP → role/config → START path only calls resetPtpStartup(), which does not clear that property. Consequently, after the intended automatic recovery succeeds and PTP is running, the Time Sync panel still displays “PTP start did not complete” and exported diagnostics still report that manual STOP is required. Clear or defer this failure state unless the recovery actually terminates unsuccessfully.

Useful? React with 👍 / 👎.

if (StudioClipboard.copyText(evidence)) {
panel.copyFeedback = "Firmware diagnostics copied."
} else {
panel.copyFeedback = "Clipboard unavailable. Open technical details to review diagnostics."

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 Expose the requested diagnostics when clipboard copy fails

If clipboard access fails, this message directs the operator to technical details, but that view displays only firmware.logText; the value that failed to copy is session.diagnosticsText(), which also contains session state, device identity and telemetry, PTP/SV evidence, and the device serial log. In the failure scenario the requested evidence therefore remains unavailable from this panel despite the recovery instruction. Show the captured evidence in a selectable fallback, as the Time Sync panel does, or direct the user to a view containing the same text.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

M3.H release=main reconciliation — 2026-10-24

Verified product baseline is a922e9bdba4e57a4e88406eb83344455dd8ff142 (ESP32-P4 firmware Build ID a922e9bdba4e57a4); consolidated PR #299 is MERGED to main with 14/14 integration checks passing. The official M3.H Stable tag and tested source are ancestors of main.

This PR has a distinct historical/divergent change scope and is not part of the immutable shipped M3.H baseline. It remains DRAFT / NOT READY for merge; do not merge against an obsolete stacked base or count its tests as final M3.H acceptance. Reconcile only still-needed unique behavior into a fresh branch from current main, with implementation-level comparison, all affected CI tests, and targeted ESP32-P4 FAT where relevant. If superseded, close with an explicit feature-by-feature disposition instead of importing old firmware wholesale.

Canonical closure record: https://github.com/masarray/arstack61850/blob/main/docs/integration/M3H_MAINLINE_RELEASE_SOURCE_CLOSURE_2026-10-24.md .

Copy link
Copy Markdown
Owner Author

PR archival decision — M3.H release hygiene (2026-10-24)

CLOSED as SUPERSEDED HISTORICAL IMPLEMENTATION — NOT MERGED and NOT marked as a completed feature.

This branch diverges from current main; its unique changes have not passed the validated M3.H release gate. The old source and discussion stay reachable for traceability. Future implementation must be a new, narrowly scoped PR based on current main, with focused CI and hardware evidence where applicable. Closing the obsolete PR removes misleading release-ready queue items while preserving the unresolved feature requirements.

Evidence ledger: M3.H Mainline Source Closure.

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