Repository navigation
Ariadne: runtime warnings reach the user while a document runs - #922
Merged
Merged
Conversation
- (quit [code]): AppRuntime::register_quit() binds `on: quit` and the verb; the first close request's code is exit_code(). ari run/snapshot/check and arigl (window and --terminal) exit with it; snapshot stops on the frame the document quit. - (assert cond [message [data]]): a builtin raising AssertionError (a new class under Exception), "assertion failed[: message]"; its traceback ends at the form. - tests: block (name -> program) captured by the loader; Runtime::run_program runs a program on the action lane and reports how it ended to a callback. - ari test [--tap] [--timeout S] [--frames N] doc.ari...: each document headless until it quits, its tests have run, N frames, or the timeout. Fails on a non-zero quit, an uncaught error, a failed or warning load, a failed test, or a timeout. One line per document with what failed and in which program; TAP with --tap; exit 1 on failure. Network flags and settling as snapshot's. - Action failure warnings name their program; resident ones their lane. - Docs: ARIADNE.md §13, the exceptions table, the developer guide.
…s modules (#894) - functions: (top level): a program of (defun ...) forms that every program in the document's scope can call (init:, on:, residents, key bindings, tests:); anything else is skipped with a warning. import: merges a library's functions. - load: functions: [names] | name | "*": grants the parent's functions to the module, each with the functions it calls; a module gets none otherwise, and its own functions: stay inside it. Code, not authority: a granted function runs chrooted to the module. - Mechanism: Widget::functions (FunctionScope) on the root and every mount wrapper; the runtime keeps a function-scope stack beside the mount scopes and runs the scope's prelude ahead of each program (actions, residents, run_program, init:, mount init:). - The free-head preflight is scope-aware and scans function bodies and mount init:. - Docs: ARIADNE.md §6.6.
- Loader: expand_load captures the fragment's on_tick: onto the mount wrapper (Widget::tick_script), as it does init:. A fragment's on_key:, on_pointer: and on_signal: now load with a warning instead of being dropped silently: input and signals stay the outermost document's (docs/ARIADNE.md §6.3). - Runtime: one tick resident per mount sub-prefix, owner-tagged, chrooted there with the mount's FunctionScope prelude, on <owner>#tick@<sub-prefix>, woken each drain by post_tick. Started on the mount's first frame, after its init:. A reconcile keeps it when the new tree has the same mount and program, and stops it otherwise. A repeated mount's instance stops when its outermost repeat: count drops below it. - A failing module tick is reported as on_tick: of mount '<sub-prefix>'. The preflight and the channel lint scan a mount's on_tick:. - Tests: AriadneModuleTick.* (ariadne_host_test), AriTest.AModulesOnTickRuns. - Docs: ARIADNE.md §2.3, §2.4, §6.3, §7.4.
…-tick The locks spawn context (#865) makes resident contexts shared and built by make_action_context: a mount's tick resident is made the same way, chrooted to its sub-prefix.
…illing stepped_solve::impl did f.assign(nv, f[0]): the value is a reference into f, and libc++'s assign frees the old buffer before filling the new one, so on macOS every entry was read from freed memory (Fem.SteppedPoissonMatchesTheOneShotSolve, rel diff 6.7e268 in the macOS recipe lanes). libstdc++ and MSVC copy the value first, so Linux and Windows passed.
Takes #903's fix for the stepped Poisson solve in place of the same fix made here.
- A tick, key, pointer or signal resident, or a module's tick, that is killed (its per-step cap, a syntax error read inside it) or fails (an exception it didn't catch) is reported once per message as before, reaped, and started again on a later drain: at once the first time, then 1, 2, 4 ... up to 64 drains later while it keeps stopping within 100 drains of starting. After 8 such stops in a row it is given up with a warning, until its program is set again. A module's tick restarts whether or not the mount is drawn. A signal arriving during the delay starts its handler at once. Before, a stopped resident stayed dead: a module's on_tick request loop sat on "loading..." for good, and a dead on_signal swallowed every Ctrl-C. - Residents share one Resident record (context, pid, restart state) instead of parallel context and pid fields. - The per-step cap is the tree setting ariadne.limits.resident_max_step_time (0 = none), default 0.05 s, 0.25 s in wasm, which has no thread CPU clock, so a step that checks often on a loaded machine is charged for its waits. - Tests: AriadneResidents.* (a failed tick restarts, a module tick killed by its cap restarts, one that always fails is given up and a reload starts it afresh). - Docs: ARIADNE.md §2.3, §2.4.
…at/ari-resident-restart
cypkg's browser test (single-threaded ari.html, load 10-33): with the 0.05 s cap one run of nine lost a module's tick; with 2 s none of nine did. A runaway step in a tab then freezes it for at most a second before the resident is killed and restarted.
A resident that stopped, was restarted or given up, a program that failed, a broken expression: until now the stock hosts printed these only after the document exited, so a module stuck on "searching..." in ari's full-screen UI or the browser page gave no sign why. - AppRuntime::set_warning_listener: called once per warning at the drain that collects it; take_warnings() still returns them all, for the summary at exit. - LiveWarnings (cvc/ariadne/host_warnings.h), a host's report of them as they come: --log FILE (or ARIADNE_LOG=FILE) appends each with the time; stderr gets each when it is not the terminal (2>file, a pipe, the browser page); notice() is the latest for 8 s; at exit summarize() lists them, or counts them when stderr already had them. - FtxuiBackend::RunOptions::notice: a line over the bottom of the screen, wrapped; the tvision desktop shows it in its status line. ari run and arigl run --terminal show their latest warning there. - report_warning (web_document.h): Module.ariadneWarning(text). ari.html shows the latest in its header; arigl-web in the canvas's corner for 8 s; both keep window.ariadneWeb.warnings. arigl's window loop already printed each per frame; it now logs and tells the page too. - --log FILE is a general host flag (host_cli.h). - Tests: AriadneLiveWarnings.* (the listener hears each as it comes; the log file and the notice), AriRun.WarningsWhileTheDocumentRuns (ari run: in the log, on stderr and on the screen while ari still runs, then the count at exit), and the browser smoke test's warning cases for arigl-web and ari.html (docset app/warns.ari). - Docs: ARIADNE.md §2.4 (where a host shows them), the ari flags paragraph, CVCGL_WASM.md (the page hook), ari's usage text.
The PRs below this one landed on master squashed, so this branch's own change is applied to master unchanged.
…estart # Conflicts: # src/cvc/tests/ariadne_host_test.cpp
…feat/ari-live-warnings # Conflicts: # src/cvc/ariadne/host_cli.cpp # src/cvc/tests/ariadne_host_test.cpp
transfix
enabled auto-merge (squash)
October 31, 2026 18:27
# Conflicts: # src/ari/main.cpp # src/arigl/main.cpp # src/cvc/ariadne/host_cli.cpp
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.
Stacked on #917 (
feat/ari-resident-restart), which adds the restart and give-up warnings. Retarget to master once #917 merges.A resident that stopped, was restarted or given up, a program that failed, a broken expression: the stock hosts printed these only after the document exited (
AppRuntime::take_warnings()after the FTXUI loop). cypkg's browser test could not tell why a module stayed on "searching..." because the resident's kill was invisible. Now each warning reaches the user as it is produced, and the end-of-run summary stays.Runtime
AppRuntime::set_warning_listener(fn): called once per warning at the drain that collects it.take_warnings()still returns them all.LiveWarnings(cvc/ariadne/host_warnings.h), the hosts' report:--log FILE(a general host flag) orARIADNE_LOG=FILEappends each one with the time, flushed per line;2>file, a pipe, the browser page). On a terminal the full-screen UI owns it, so they wait for the exit;notice()is the latest one for 8 s, with how many there have been;summarize()lists them on stderr, or counts them when stderr already had them.ari run / arigl run --terminal
FtxuiBackend::RunOptions::notice: a line over the bottom of the screen, wrapped on a narrow terminal. The tvision desktop shows it in its status line.Browser pages
report_warning(web_document.h) callsModule.ariadneWarning(text).window.ariadneWeb.warnings. ari also writes each to stderr (the console andariadneWeb.log), and arigl's window loop already printed each one per frame.Tests
AriadneLiveWarnings.TheListenerHearsEachAsItComes,.LogFileAndNotice(ariadne_host_test).AriRun.WarningsWhileTheDocumentRuns(ari_test_command_test, POSIX):ari run --logon a document whose on_tick fails once and never quits. While ari is still running, the warning is in the log, on stderr and on the screen. Then a SIGTERM ends the run with exit 143, and stderr hasari: 1 warning while the document ran (above).app/warns.ari.Verified locally (Linux, RelWithDebInfo): ari_test_command_test 9/9, ariadne_host_test 43/43, ariadne_ftxui_test 71/71. The arigl-web recipe build (wasm,
cvcpkg/recipes/arigl-web/build-wasm.sh) with the smoke test in headless Chromium passed 11/11, the two new cases included. I also checked by hand in tmux: the wrapped notice at 60 columns, live stderr with2>file, and the list at exit with stderr on the terminal.Docs: ARIADNE.md §2.4 (where a host shows them), the ari flags paragraph, CVCGL_WASM.md (the page hook), and ari's usage text.
Not covered: a tmux case. The tmux harness (
src/ari/tests/run_in_tmux_test.sh) is in #883, which this branch does not have. The ari_test_command_test case drivesari runwith stdout and stderr in files instead. A message is still reported once per run (warn_once), so a resident that stops the same way each time shows onestopped:warning, then the give-up warning.