feat(ocpp-cp): honor v201 TriggerMessage(LogStatusNotification) by re-reporting the latest log-upload status (M7) - #587
Open
duyhuynh-vn wants to merge 2 commits into
Open
duyhuynh-vn wants to merge 2 commits into
duyhuynh-vn wants to merge 2 commits into
Conversation
…-reporting the latest log-upload status (M7) A CSMS asking `TriggerMessage(requestedMessage = LogStatusNotification)` on the OCPP 2.0.1 CP simulator now gets the station's current log-upload status re-reported as one schema-valid `LogStatusNotification` — the direct log-upload twin of #583 (FirmwareStatusNotification) and the 2.0.1 analog of the 1.6J TriggerMessage(DiagnosticsStatusNotification) re-report. Previously the trigger was classified NotImplemented despite the simulator modeling GetLog uploads. - V201LogUploadStore: retain the latest V201LogStatusReport { status, request_id } (default { Idle, None }) alongside the in-flight requestId, recorded at the single send_v201_log_status choke point and deliberately not cleared with the in-flight slot, so a settled Uploaded / terminal failure stays reportable. - v201_command: reclassify LogStatusNotification NotImplemented -> Accepted; add v201_log_status_report(status, Option<i32>) re-report builder (the async v201_log_status_notification now delegates to it) that omits requestId for an Idle snapshot. - lib: send_v201_log_status records the status before sending; new trigger_v201_log_status_notification re-reports the snapshot as a pure, side-effect-free CALL on the command-consumer task, wired into send_v201_triggered_message. Ports ocpp.v201.call.LogStatusNotification (request_id: Optional[int]). Pure snapshot: starts no upload, leaves the in-flight store untouched, off the inbound-CALL path. 1.6J unaffected. Closes #584. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176cR1foeU8uwtbWZQDdsPZ
…atus_notification The bare [`trigger_v201_firmware_status_notification`] link in the new trigger_v201_log_status_notification doc comment did not resolve (a method needs a qualified path), failing the `--deny warnings` Documentation CI job. Qualify it with `Self::` so rustdoc resolves it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176cR1foeU8uwtbWZQDdsPZ
This was referenced Sep 28, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Honors
TriggerMessage(requestedMessage = LogStatusNotification)on the OCPP 2.0.1 CP simulator by re-reporting the station's latest log-upload status as one schema-validLogStatusNotification— advancing M7 (OCPP 2.0.1). The direct log-upload twin of #583 (FirmwareStatusNotification).Closes #584Real use case
A support engineer is diagnosing a charge point that uploaded its diagnostics log hours ago via
GetLog. The station reported progress asynchronously at the time, but the CSMS operator wasn't watching and the notifications have scrolled off. Rather than kicking off a fresh (slow, bandwidth-heavy) upload, the operator sendsTriggerMessage(LogStatusNotification)and the station immediately re-reports where that last upload landed —Uploaded(with the correlatingrequestId), or a terminalUploadFailureif it never made it — so the operator knows whether the log is already sitting at the remote location before acting. Before this change the 2.0.1 simulator answered that trigger withNotImplemented, so a CSMS conformance suite exercising the log-status re-report had no station-side counterpart.What changed
crates/ocpp-cp/src/v201_log_upload.rs— newV201LogStatusReport { status, request_id }(default{ Idle, None }) retained inV201LogUploadStorealongside the in-flightrequestId.record_reportedcaptures every emitted status;last_reportedreturns the snapshot. Deliberately not cleared when the in-flight slot is, so a settledUploaded/ terminal failure stays reportable.crates/ocpp-cp/src/v201_command.rs—LogStatusNotificationreclassifiedNotImplemented→Acceptedinv201_trigger_message_status; newv201_log_status_report(status, Option<i32>)re-report builder (the asyncv201_log_status_notificationnow delegates to it) that omitsrequestIdfor anIdlesnapshot (schema has nonullfor it).crates/ocpp-cp/src/lib.rs—send_v201_log_statusrecords the status before sending (so the CP's notion of upload progress advances even if a progress CALL fails to transmit); newtrigger_v201_log_status_notificationre-reports the snapshot as a pure, side-effect-free CALL on the command-consumer task (off the inbound-CALL path — no receive-loop re-entrancy), wired intosend_v201_triggered_message.Trust boundary / failure modes: the trigger is CSMS-originated over the WebSocket; the re-report starts no upload and leaves the in-flight store untouched.
requestIdis stored opaquely (never parsed/indexed), so no wire value can panic. A send failure is logged, not propagated.What was ported
Ports
ocpp.v201.call.LogStatusNotification(whoserequest_id: Optional[int]we mirror), gated byMessageTriggerEnumType.log_status_notificationand reportingUploadLogStatusEnumType(ocpp/v201/enums.py). Follows the pattern established by #583 (#586). The 2.0.1 analog of the 1.6JTriggerMessage(DiagnosticsStatusNotification)re-report.Test plan
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --workspace— all green (ocpp-cp lib: 1002 passed; integration: 51 passed). Added:{ Idle, None };record_reportedtracks latest(status, requestId); the terminal survives the in-flight clear; extremerequestIds don't panic.Idlere-report omitsrequestIdon the wire (absent, notnull); aSomere-report carries it; both, plus every lifecycle status, are schema-valid against the bundled 2.0.1 FINALLogStatusNotificationschema.v201_trigger_message_status(LogStatusNotification) == Accepted; producible/unsupported counts updated (7 Accepted / 4 NotImplemented); totality test still passes.AcceptedthenLogStatusNotification(Idle), norequestId; with a recorded status → re-reports it +requestIdand leaves the in-flight slot untouched.run_v201_log_uploadleavesUploaded(happy path) /UploadFailure(fault-injected) as the re-reportable status.central_system_bootintegration test to usePublishFirmwareStatusNotificationas itsNotImplementedexample (LogStatusNotification is now Accepted).Acceptance criteria
TriggerMessage(LogStatusNotification)isAcceptedand originates one schema-validLogStatusNotificationwith the latest status.requestId) tracked across the upload lifecycle; never-ran reportsIdle,requestIdomitted.GetLog → LogStatusNotificationflow or 1.6J.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --workspaceall green.Known gaps / notes
PublishFirmwareStatusNotificationremainsNotImplemented— the last of the status-re-report family, tracked in port(m7): CP simulator 2.0.1 — honor TriggerMessage(PublishFirmwareStatusNotification) by re-reporting the latest publish-firmware status #585.Sign*Certificate) stayNotImplemented; they must originate a freshSignCertificateCSR rather than re-report a status — a distinct, heavier slice to be filed once port(m7): CP simulator 2.0.1 — honor TriggerMessage(PublishFirmwareStatusNotification) by re-reporting the latest publish-firmware status #585 lands.🤖 Generated with Claude Code
https://claude.ai/code/session_0176cR1foeU8uwtbWZQDdsPZ
Generated by Claude Code