Commit a2a2faa
committed
fix(opcua,#386): Copilot review feedback batch (observability + hygiene)
Eight Copilot findings on PR #387 addressed in one batch:
Observability (#6/#7/#8/#10): every per-event / per-method-call
``std::cerr`` trace is now gated by the ``ROS2_MEDKIT_OPCUA_TRACE``
env-var (off by default). Covered the trampoline, ``add_event_monitored_item``,
``call_method``, ``on_event``, EventId capture, state-machine
classification, dispatch trace, and the SOVD ack/confirm EventId hex
dump. Production logs now stay clean; integration-test debugging
re-enables verbose mode with one env-var. Operator-visible
``[opcua_poller WARN] ConditionRefresh rejected`` stays unconditional.
Comment / code mismatches (#1/#11/#12):
- ``OpcuaPlugin::on_event_alarm`` ReportHealed branch now explicitly
documents the intentional no-op and explains why pushing EVENT_PASSED
to fault_manager would defeat the OPC-UA Part 9 ack/confirm contract.
- ``alarm_state_machine.hpp`` Retain comment matches reality - we do
not currently strip Retain=false events because the EventFilter
doesn't include Retain in its select clauses (followup issue #389).
Test fixes:
- (#3) ``DisabledNoOpWhenAlreadyCleared`` renamed to
``DisabledTransitionsClearedToSuppressedNoOp`` so the name reflects
both the status transition (Cleared -> Suppressed) and the no-op
action.
- (#13) New ``NodeMapTest.RejectsAlarmSourceUnderNodes``: locks the
schema validation that rejects misplaced ``alarm_source`` keys under
``nodes:`` (was silently ignored), pointing the user at
``event_alarms:``.
Schema validation (#13): ``NodeMap::load`` now rejects any
``alarm_source`` key under ``nodes:`` with an actionable error message.
Previous behaviour silently ignored the typo unless paired with
``alarm.threshold``, leaving "subscribed alarm that never fires" cases
impossible to diagnose at runtime.
Test/script hygiene:
- (#9) ``run_alarm_tests.sh`` replaces the fixed ``sleep 3`` between
``fault_manager_node`` start and ``gateway_node`` start with a 30-try
poll on ``ros2 service list | grep /fault_manager/report_fault``.
Matches the project rule "no fixed sleeps".
- (#2) ``run_ctest.py`` smoke-test runner: skips on missing ``asyncua``
by default (preserves local dev iteration), but treats the env-var
``ROS2_MEDKIT_OPCUA_SMOKE_REQUIRE=1`` as "fail hard" so a CI step
that drops the ``asyncua`` install cannot silently bypass the smoke
check.
Local verify: 27/27 test_opcua_client + 27/27 test_alarm_state_machine
+ 1/1 new RejectsAlarmSourceUnderNodes.1 parent b95b218 commit a2a2faa
9 files changed
Lines changed: 187 additions & 56 deletions
File tree
- src/ros2_medkit_plugins/ros2_medkit_opcua
- docker/scripts
- include/ros2_medkit_opcua
- src
- test
- fixtures/test_alarm_server
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
271 | 281 | | |
272 | 282 | | |
273 | 283 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
341 | 344 | | |
342 | | - | |
| 345 | + | |
343 | 346 | | |
344 | | - | |
| 347 | + | |
| 348 | + | |
345 | 349 | | |
346 | 350 | | |
347 | 351 | | |
| |||
Lines changed: 42 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
32 | 47 | | |
33 | 48 | | |
34 | 49 | | |
| |||
599 | 614 | | |
600 | 615 | | |
601 | 616 | | |
602 | | - | |
603 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
604 | 621 | | |
605 | 622 | | |
606 | | - | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
607 | 626 | | |
608 | 627 | | |
609 | 628 | | |
| |||
710 | 729 | | |
711 | 730 | | |
712 | 731 | | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
718 | 739 | | |
719 | 740 | | |
720 | 741 | | |
| |||
731 | 752 | | |
732 | 753 | | |
733 | 754 | | |
734 | | - | |
735 | | - | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
736 | 759 | | |
737 | 760 | | |
738 | 761 | | |
| |||
836 | 859 | | |
837 | 860 | | |
838 | 861 | | |
839 | | - | |
840 | | - | |
841 | 862 | | |
842 | 863 | | |
843 | 864 | | |
844 | | - | |
845 | | - | |
846 | | - | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
847 | 874 | | |
848 | | - | |
849 | 875 | | |
850 | 876 | | |
851 | 877 | | |
| |||
Lines changed: 33 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
534 | 546 | | |
535 | 547 | | |
536 | 548 | | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
542 | 569 | | |
543 | | - | |
544 | | - | |
545 | 570 | | |
546 | 571 | | |
547 | 572 | | |
| |||
898 | 923 | | |
899 | 924 | | |
900 | 925 | | |
901 | | - | |
| 926 | + | |
902 | 927 | | |
903 | 928 | | |
904 | 929 | | |
| |||
Lines changed: 39 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
300 | 314 | | |
301 | 315 | | |
302 | 316 | | |
303 | | - | |
304 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
305 | 321 | | |
306 | 322 | | |
307 | 323 | | |
| |||
386 | 402 | | |
387 | 403 | | |
388 | 404 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
395 | 414 | | |
396 | | - | |
397 | | - | |
| 415 | + | |
398 | 416 | | |
399 | 417 | | |
400 | 418 | | |
401 | 419 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
407 | 427 | | |
408 | 428 | | |
409 | 429 | | |
| |||
436 | 456 | | |
437 | 457 | | |
438 | 458 | | |
439 | | - | |
440 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
441 | 463 | | |
442 | 464 | | |
443 | 465 | | |
| |||
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
| |||
0 commit comments