Repository navigation
fix(p0): gate PTP SOURCE on real Ethernet link, preserve INVALID_STATE and fail clearly in Studio - #271
Conversation
…ded 3-epoch physical SOURCE proof
… SOURCE START rejection
…undant PTP rollback on preflight reject
…ATE START transitions
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ng from USB or status
…ly hidden console proof
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d31421710a
ℹ️ 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".
| and "kTxReady" in eth_port | ||
| and "ETHERNET_LINK_DOWN" in eth_port | ||
| and "ETHERNET_DRIVER_NOT_STARTED" in eth_port | ||
| and "ar_esp32p4_ptp_print_link_status()" in eth_port |
There was a problem hiding this comment.
Fix the impossible link-status source check
Whenever check_operator_workspace.py runs, this predicate is false: the newly added function is declared in ethernet_port.c as ar_esp32p4_ptp_print_link_status(void), while the exact ar_esp32p4_ptp_print_link_status() text occurs only in live_control.cpp. Consequently, the workspace contract test now fails unconditionally before validating the rest of the change; check the C declaration spelling or inspect the call-site file instead.
AGENTS.md reference: AGENTS.md:L230-L234
Useful? React with 👍 / 👎.
2026-10-21 final #271 artifact handoff: physical LINK + EMAC SOURCE START gateExact unmerged HEAD Implemented on top of #270: ETH_EVENT START+CONNECTED gate before EMAC PTP enable; bounded 2500ms preflight; typed ETHERNET_LINK_DOWN / ETHERNET_DRIVER_NOT_STARTED / ETHERNET_TX_INVALID_STATE; correctly classified GUI fail-closed transitions (no gratuitous rollback for preflight rejection, stop ACK proof for launched runtime); preserves actual SOURCE three-frame TX evidence; 3.5s bounded SOURCE startup at 1s cadence; board-reported driver/PHY link in Exact SHA CI: 8/8 workflow SUCCESS (Product Naming, Embedded Profile, ESP32-P4 SMV Injector, PTP SOURCE/RECEIVER, Qt Studio native session harness and QML, Windows Lifecycle, C++ CI Linux+MSVC, Native Preview with matched firmware and clean install/upgrade/uninstall/NSIS migration). Windows matched installer is the setup.exe within GitHub Actions artifact https://github.com/masarray/arstack61850/actions/runs/39538730514/artifacts/12319535776 . EXE Hardware still NOT ACCEPTED. Operator: install and flash matching firmware via Studio, connect ESP32-P4 physical Ethernet port to active switch, verify Advanced → Time Sync |
Physical bench PTP SOURCE START failure — proven on #270 build
Operator flashed matching Studio+board
7f30f99a1fe43228and attached native Copy diagnostics and GUI screenshots. PTP CONFIG accepted, but ESP32-P4 logged:Actual PTP Announce/Sync/Follow_Up counts each 0. Role=SOURCE, STOPPED, no SV. This is a real board MAC/PHY TX readiness failure, not a cosmetic QML toggle. Whether cable/PHY link was physically DOWN or the EMAC failed despite LINK_UP is not proven by this log; the old firmware did not persist actual ETH driver+PHY state in PTP SHOW.
Fixes
ethernet_port.c: register independent per-driver ESP-IDF ETH_EVENT observer beforeesp_eth_start, distinguish STARTED/STOPPED driver and real CONNECTED/DISCONNECTED PHY. PTP START now waits at most 2.5s for both real proofs before enabling EMAC PTP mode. Fail withETHERNET_LINK_DOWN,ETHERNET_DRIVER_NOT_STARTED, orETHERNET_DRIVER_UNAVAILABLE, not noisy misleading TX attempts. Any Ethernet unplug/replug is reflected by event state; no guessed readiness from USB identity or selected PTP profile.PTP ETH driver=... link=... tx_ready=... start_reason=...in board PTP SHOW and on SOURCE START rejection.ptp_lab_task.cpp: classifyESP_ERR_INVALID_STATEfrom BOTH general and hardware-timestamp TX asETHERNET_TX_INVALID_STATE; preserve it through timeout rather than overwriting withSOURCE_TX_EVIDENCE_TIMEOUT. Actual transmitted Announce+Sync/FollowUp evidence remains the only successful SOURCE proof. Give up to 3.5s (was 1.6s) for established-link verified 1s-cadence TX, within Studio's 10s START_ACK deadline.Review/acceptance
New native Qt, embedded ESP32-P4, SOURCE/RECEIVER, C++ and Windows installer CI at exact HEAD required; do not merge main or release. Physical acceptance only after ESP32-P4 with real Ethernet cable on live switch emits consecutive Announce, Sync and HW FollowUp through PCAP and Studio, survives PTP STOP/START cycles and SV injection without device STOP, plus 1h endurance. If link remains physically DOWN, PTP must continue to refuse START and clearly identify that wiring issue (never fake RUNNING).