Repository navigation
Teach tutorial 24's alarms step by step, with a walk test of every step (G282s) - #973
Open
johannesPettersson80 wants to merge 5 commits into
Open
johannesPettersson80 wants to merge 5 commits into
johannesPettersson80 wants to merge 5 commits into
Conversation
Tutorial 24's README is rewritten to the README standard from a real run of the tank example: how the program declares its alarms with the Alarm library and its own rise detection, acknowledging, shelving and unshelving the high-level alarm, the high-high trip in Manual and its first out, the drain to the low-level alarm (22.5 s by the tank's mass balance), the reset, and the event log. Its "Try it yourself" takes an alarm out of service as an engineer, adds a comment, and lifts the rise alarm's suppression in Auto. A native walk test (tutorial_projects/hmi_alarms.rs) follows every step through the display's API at 1x and checks each value the README states. The test harness now turns discovery off in every example copy unless a test keeps it, so a copy without a [runtime.discovery] table no longer advertises itself to another test's search. Specification: 25 3.5
…hat run A walk of the README's steps on the runtime at 1x gave the run's values, and the README now reports them: the high alarm 37.5 s after the setpoint, raised at 2.5002 m against the 2.5000 m limit, and the trip 3.6 s after the valve opening. After Reset trip the controller opens the valve gradually from closed, so the level falls a little more until the inflow meets the outflow. How far it falls depends on the level at the reset. The run reset at 0.10 m and fell for 2.7 s more, to 0.07 m, and the README says that a later reset falls less. The ten screenshots come from that walk, taken after G384's value column, and replace the nine old ones. The walk test presses Reset trip at 0.10 m, as the run did. Its bounds hold for a reset read down to 0.06 m, since the first read after the reset comes some hundred milliseconds late. Specification: 25 3.5
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…trip in the harness (G282s) On macOS the walkthrough test failed once at step 9 (run 47020466196): the scan that `ctl read` returned came about 0.13 s after the trip, when the level, 2.784 m, was already falling inside the high-high alarm's deadband, and the step asserted a level above 2.8 m. `ctl read` polls, so the first scan it sees with the alarm active can be a later one than the trip. Step 9 now reads the level at the trip from the alarm's own record, `raised` (limit 2.8, high, the level just above 2.8 m), as step 5 does, and from the polled scan only what holds at every scan from the trip on: the pump tripped, no inflow, the level below 2.82 m. The walkthrough could catch a trip one scan late only when its poll landed on the trip scan. The example's harness test, which steps the program one cycle at a time, now runs until the high-high alarm comes in and asserts that the pump tripped and the inflow stopped in that cycle. The mutant that calls the pump before the vessel fails it at that assertion.
This branch has not been deployed
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.
What
Tutorial 24 teaches the tank example's alarms step by step in the runtime display, from a real run, and a native test walks every step (G282s).
The old README toured the alarm features in sections. The new one follows the example README standard (specification 25 §3.5) in fifteen steps, each with what the run showed:
TankVesseldeclares its level alarms with the Alarm library, the program's own rise detection (LevelRiseAlarm, which extendsAlarm.Alarm), and the pump's trip with its first-out group;"What happened" covers:
"Try it yourself" takes an alarm out of service as an engineer, adds a comment, and lifts the rise alarm's suppression in Auto.
The ten screenshots come from one walk of the README's steps on the runtime at 1×, at 1920×1080, and replace the nine old ones. I reviewed each against its step. The README is off the pending list in
scripts/example_readmes.json.Found on the way
appliedand wrote nothing. The fix is its own pull request (G386, specification 39 §12.8): a command id now belongs to the user who sends it. Here, the test's ids carry the user's name.runtime.tomlthat has a[runtime.discovery]table. The tank example has none, so each of its copies advertised itself (discovery is on by default), and tutorial 15's mesh test found three runtimes where it expects one.tests/support/runtime_toml.rsnow turns discovery off in every copy unless a test keeps it.The tests
tutorial_projects::hmi_alarms::tutorial_24_handles_the_tank_alarms_as_its_readme_walks_themwalks steps 3 to 14 and the first two Try-its through the requests the display sends, at 1×. It reads each value and time withctl read, in the runtime's logical time:ctl readpolls, so that scan can come after the trip: on macOS in CI it came about 0.13 s late, with the level already falling (2.784 m), and the first round, which checked the level there, failed once (run 47020466196, passed on the suite's retry);tutorial_24_try_it_the_rise_alarm_alarms_in_auto_without_its_suppressionbuilds the README'sSuppressed := FALSEedit and checks the rise alarm in Auto.hmi_tank_level_example::a_high_high_level_trips_the_pump_and_is_the_first_out_until_resetsteps the program one cycle at a time. It now runs until the high-high alarm comes in and requires the pump tripped and no inflow in that cycle: the trip in the same scan, which the walk's polled reads cannot catch for certain.The screen test
scripts/hmi-screen-tests/tests/tutorial-alarms.spec.mjswalks steps 3 to 14 in Chromium.Mutants, each failing at its own assertion. Of the example's program:
latchingfalse;first_outfalse;hmi_tank_level_example's trip test, "the pump tripped in the scan the alarm came in". The walk catches it only when its read lands on the trip scan, as it did in the last check ("step 9: the trip stops the inflow", the pump not tripped and the inflow 0.05);Of the test, the walk pressing Reset trip at once, as the first round did: step 12, "4.3 s, from 0.265 m to 0.174 m". That is the first round's README run, which the new bounds refuse.
Checks
On the builder, over the merge of
mainwith G384 (392d288):-D warningson trust-runtime's tests with all features, and Windows Clippy;tutorial_projectswhole (22 tests), and the two tutorial 24 tests twice more;hmi_tank_level_example,examples_build_and_validateandtutorial_ctl_commands;tutorial-alarms.spec.mjsin Chromium, with a runtime built from the same tree;Step 12's bounds were then widened for a late first read (37972a1), and a focused check ran on the builder: fmt, Clippy, the two tutorial 24 tests three more times, and the two step-12 mutants again, each failing at its own assertion ("0 s, from 0.084 m to 0.084 m"; "4.3 s, from 0.265 m to 0.174 m").
After
main. This branch then tookmainatd794363f6and #966'spin-project-lite0.2.19 (G397,e90222778), without which Supply Chain fails on every pull request. Over that head, on the builder: fmt, the README check, the changelog fragments, Clippy on trust-runtime (all targets and features),tutorial_projects,hmi_tank_level_example,examples_build_and_validate,tutorial_ctl_commandsand every program that readstests/support/runtime_toml.rs, the documentation tests and Windows Clippy, and the pre-push contracts.The macOS retry. Step 9's level then came from the alarm's raised reading, and the same-scan trip moved to the harness test (a9e5a0f). On the builder over that head: fmt, Clippy
-D warningson trust-runtime's tests, the two tutorial 24 tests three times (102 s each),hmi_tank_level_example(10 tests), the pump-a-scan-late mutant against both tests, and Windows Clippy.