Skip to content

Plan 3 W13 WP 13.1: a run's ending says what ended it, and a stop time no longer reads DAWN CUTOFF (#1313, #1302) - #1365

Merged
epim merged 2 commits into
mainfrom
wave13/wp-13-1
Nov 30, 2026
Merged

epim merged 2 commits into
mainfrom
wave13/wp-13-1

Conversation

@epim

@epim epim commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Closes #1313. Closes #1302.

What was wrong

The engine knew why a run ended and published only an enum.

What changes

Server. _ending_cause builds (end_cause, window_end) once per ending and hands the pair to both the terminal state and the stored report, so the two cannot disagree.

  • end_cause is words. Fixed phrases for an operator's stop, a shutdown, a window boundary and set-aside targets. For unsafe, quality and error endings it is the exception's own message on one line, clipped to 400 characters; led by the class name when the exception is not one of ours, and equal to the class name when the message is empty.
  • It never reads SlewRefused.site_detail. A test plants figures there and scans the state and the report for them.
  • window_end names the boundary that closed a dawn_cutoff: dawn, stop time, run-length cap, targets set.
  • abort() takes an optional cause. All five callers are operator actions, so the default says "stopped on an operator's request".
  • A complete run publishes no new key, so the golden traces are unchanged. A report written before the fields loads as before.

UI. With a cause, the failure card states it and keeps a keyword rule's fix only when one matches; without one it is the card it was. The classic Monitor and Sequence cards, the new Live card, the plan header and the error toast use it. The report labels read STOP TIME, RUN-LENGTH CAP, TARGETS SET or WINDOW CLOSED, and DAWN CUTOFF only for dawn or a report without the field. Both report views draw the cause under the pill for unsafe, error, quality, cooling skip and incomplete.

What a viewer can read

The cause for an error ending is the same text the run's log line and state.detail already serve to every role, live and from the night log. Nothing new is exposed; one more durable place holds it. Whether a viewer should read free exception text at all is filed as #1358.

Tests

  • Server: test_w13_1_end_cause.py, 22 tests through the real engine (operator stop, shutdown, safety stop, refused slew, error with and without a message, quality, stop time, dawn, run-length cap, complete, the next run, old reports, a viewer principal, the label mirror).
  • UI: seven new files, 48 tests, six of them real-DOM tests of the cards and the report views.
  • On the tree merged with main: 2450 server tests across the 121 files that name end_reason, the report finalizer or a golden trace, and the full UI suite (796 files, 9656 passed). Typecheck clean.

Mutants, each from a byte backup and restored byte-identical:

Mutant Result
_ending_cause returns nothing for every ending 17 of 22 server tests fail ("an operator's stop published no end_cause", "a stop-time report names no boundary")
an abort says no cause a server test fails
the window boundary is not stored on the report a server test fails
the exception's class name always dropped a server test fails
diagnoseFailure ignores the cause 12 UI tests fail across 5 files
endReasonMeta ignores window_end 8 UI tests fail ("a stop-time report reads STOP TIME, not DAWN CUTOFF")

One mutant survives and is accepted: removing the line that drops end_cause at a non-terminal transition. start() replaces the whole state, so the line is a guard beside the existing one for end_reason; the behaviour itself is asserted by test_the_cause_does_not_ride_into_the_next_run.

Real browser

tools/ui_probe/probe_w13_1_end_cause.py drove a private simulator server through a real unsafe stop and a real stop-time run. At 1440x900 and 390x844 the classic Monitor card and the new Live card read "Simulated: the cloud sensor tripped." with no event-log advice, both report views show the cause under the pill, and the stop-time run reads STOP TIME. The screenshots were opened and looked at. The classic Sequence view and the plan header are covered by DOM tests only.

Follow-ups filed

🤖 Generated with Claude Code

https://claude.ai/code/session_01K7CHb44VFtZLGUDLF4us2p

epim and others added 2 commits November 30, 2026 02:07
…the toast and the reports say it, and a stop time no longer reads DAWN CUTOFF (#1313, #1302)

The engine knew why a run ended and published only an enum: an unsafe
stop read "Something interrupted the sequence and it couldn't continue.
Check the event log", and a run stopped by its own stop time or its
run-length cap was labelled DAWN CUTOFF.

Server. _ending_cause builds (end_cause, window_end) once per ending
and hands the pair to both the terminal _set_state and
_finalize_report, so the state and the stored report cannot disagree.
end_cause is words: fixed phrases for an operator's stop, a shutdown, a
window boundary and set-aside targets; an exception's own message for
unsafe, quality and error, on one line and clipped to 400 characters,
led by the class name when the exception is not one of ours and equal
to the class name when the message is empty. It never reads
SlewRefused.site_detail. window_end names the boundary that closed a
dawn_cutoff. abort() takes an optional cause. A complete run publishes
no new key, so the golden traces are unchanged. Reports written before
the fields load as before.

UI. diagnoseFailure takes the cause: with one, the card states it and
keeps a keyword rule's fix only when one matches; without one it is the
card it was. The classic Monitor and Sequence cards, the new Live card,
the plan header and the error toast use it. endReasonMeta takes
window_end: STOP TIME, RUN-LENGTH CAP, TARGETS SET, WINDOW CLOSED, and
DAWN CUTOFF only for dawn or a report without the field. Both report
views draw the cause under the pill for unsafe, error, quality, cooling
skip and incomplete.

Follow-ups filed: #1357 (the remaining surfaces), #1358 (free exception
text reaches every role).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7CHb44VFtZLGUDLF4us2p
@epim
epim merged commit 769b280 into main Nov 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant