Repository navigation
fix(ql-e2e): order the supervisor tests on logged events, not a first event (#111) - #113
Merged
Merged
Conversation
… event (#111) Root cause: #108 round 2 replaced a sleep with "wait for the run's first event" as the sign its kernel runs. The slow run's deadline is 1.5 s, and on CI's slower runner its TREE did not come before the kill, so no event ever came and the check ran out at 20 s. The handover case (2 s) had the same flaw. Reproduced locally with a slower slow file (main's own supervisor.sh failed as CI did); that run passes after the fix. - the probe asks supervisor.sh, on stdout, to wait for its run's logged spawn or queueing (run #N of the service instance it started), and goes on when told it was seen: ordering on the event, never on time - the deadline kill needs no "running" precondition: the log shows it - runs that must hold a slot while an order is checked (the concurrent case, admission, handover, cancel, the service kill) use a 4000-part file and are cancelled by the probe, so none ends on its own first; the service kill no longer orders on a sleep Refs: #111
… log on failure (#111) #113's first CI run failed differently: on the 7 GB runner the runs on the 4000-part file were mostly never logged as spawned, and service start lines were not found. The output could not tell a run that failed before its spawn from a log line that went missing: the probe now prints the run's reply when its spawn is not seen, and supervisor.sh prints the whole supervisor log of the run when anything fails. Refs: #111
…ase holds past its deadline (#111) #113's first CI run, reproduced locally with the new diagnostics: the held run DID spawn, but drive() waited on the wrong service: a window opened at a whole second held step 1's killed instance's start line, taken for step 2's (the same window counted 11 spawns for 10). Its second run failed in ql-e2e's cache control: the same whole-second window, there fixed on #107 (e2elog.py), still on main. - supervisor.sh opens each window at a microsecond (set_start, e2elog.py) - ql-e2e.sh and verdict.py count only the events from the request's own start on (e2elog.py, as on #107) - handover: B's deadline 20 s, the test build's hold 30 s, so B's deadline passes during the hold whatever the log's latency (it once exceeded the 4 s deadline) Refs: #111
… own event (#111) Review round 2 on #113: - B1: runs are told apart by who they are, never by a time window. The service sends the client accepted(run) as it takes a run, so the client knows the run's number in the service's log and the service's pid (StepvSupervisorRun.onAccepted, servicePid = the connection's processIdentifier, which is 0 until a message from the service arrives). The probe names both in every await; drive matches exactly that run of that service; every log check is scoped to the service pid its probe reported; set_start only bounds how much log is read. The cache control asks through a hard link (same inode, new path), and the verdict goes by path. A decoy self-check fails a pattern that ignores the pid. - B2: the handover hold is released by the test, not by elapsed time: a test build holds each admitted run until release-N appears in the service's tmp, and logs when its deadline passes while held; the probe releases only after that line. The widened deadlines and waits are reverted (B 2 s, drive 60 s, wait 15 s). Fails if the hold releases on its own timer. - the deadline kill is also tested beside a running run at L >= 2. Refs: #111
5 tasks
Review round 3 on #113: - every service filter goes through log_pattern (spawned, queued, held-deadline, started, cancelled) or owned_by, each pid anchored on both sides ("pid " before, "," ")" or space after), so 4521 never matches 45210; the admission-order check reads owned_by's lines. The self-check now plants a decoy of every kind whose pid has the real one as a prefix: fails with the old grep -F filter (exit 1), passes now - the test-build hold ends on a cancel (the cancelled reply, never spawned) and, with no release, 10 s past the run's deadline, logged as a fault: it never polls forever Refs: #111
…d log show (#111) #113's CI at 562a7ec: every awaited line was logged on time (its dump shows run #1 of service 87657 spawned 12 ms after the service started), yet the awaits ran out at 30 s, and went on once the 4000-part kernel ended. log show re-reads the system log on every 0.5 s poll; on CI's small runner, next to that kernel, the reads fell further behind than the bound. One /usr/bin/log stream for the whole run, pushed by logd into a file, replaces them: the awaits read the file. Started before any probe, its header line awaited so no event is missed, stopped on exit. Refs: #111
#111) c71e629 made the probe's completion signal `taken` after `done`. A refused run's probe is a temporary (`p().wait()`): once `done` is signalled, wait() returns and the probe is freed, so the unowned `self` of the `taken.signal()` after it aborted the probe (swift_abortRetainUnowned, on sage at L = 4). `done` is now signalled last. Refs: #111
…ream, never by time (#111) #113's CI judged a 769 ms real thumbnail cached, and found no line for four of six requests. The lines were in the log: the failure dump showed "thumbnail <the request's own path>: drawn", stamped 13:57:15.076, before the request's own start, which was taken earlier by the wall clock. A log event's timestamp does not keep to the clock the scripts read (on CI's macOS VM it ran behind by an estimated ~0.7 s), so every window opened at a wall-clock instant, `log show --start` to the second or e2elog's to the microsecond, dropped a request's own line. Not log lag: polling longer could not have found it. - run-all.sh starts one `log stream` of stepv's subsystem before the first request (QL_E2E_STREAM); ql-e2e.sh and supervisor.sh read it. No `log show` anywhere. - verdict.py finds a request's lines by its path alone (each request has its own), and names the extension's pid. ql-e2e.sh waits at most 30 s for the result line and says so when the bound is reached; the failure dump is the stream's last extension lines. - e2elog.py compares no time. supervisor.sh drops its time bound too: its checks were already by service pid and run number, and the bound was the same hazard. Its failure dump comes from the stream. Refs: #111
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
… close (#64 PR 2) - the linkage check requires a Mach header and linked libraries: a text file fails it (otool -L exits 0 on one) - the ql-e2e preview host logs its close to the unified log, so the closed-preview case is measured from the close, not from the spawn - plan.md: Quick Look makes a new controller per previewed item and releases the old one (measured), so prepare is not called twice on one The log scoping this commit first carried (log show, to the microsecond) is superseded by #113's single log stream and identity matching. Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
…ream (#64 PR 2) #107's Quick Look cases (the deadline with a thumbnail beside it, the next request, the closed preview) were written against log show and "since T" windows; #113 replaced both with one log stream, matched by identity. They now follow it: - each extension logs which run of which service took its file ("accepted: run #N (service pid P), thumbnail|preview <path>"), and runs.py reads that run's own lines from the stream, in stream order; no timestamp is compared - the concurrency check follows the service's admission limit (#108): at L >= 2 the run beside is never queued and exits before the held run's kill; at L = 1 it is queued and spawns only after that kill, if at all - a closed preview's cancel must fall between the host's logged close and its logged quit, 3 s later, so the kill at the quit cannot pass - a preview switched to another file under a live run: the old kernel goes at the switch, box.brep is shown. Quick Look makes a new controller (measured, again); should it ever reuse one, the controller cancels the session it replaces and logs it - verdict.py: a preview is ready once, on its tree before the scene (STEP) or on its mesh (IGES, BREP), in stream order - runs_test.py checks every verdict on made-up streams, a decoy service whose pid has the real one's as a prefix among them Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
… close (#64 PR 2) - the linkage check requires a Mach header and linked libraries: a text file fails it (otool -L exits 0 on one) - the ql-e2e preview host logs its close to the unified log, so the closed-preview case is measured from the close, not from the spawn - plan.md: Quick Look makes a new controller per previewed item and releases the old one (measured), so prepare is not called twice on one The log scoping this commit first carried (log show, to the microsecond) is superseded by #113's single log stream and identity matching. Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
…ream (#64 PR 2) #107's Quick Look cases (the deadline with a thumbnail beside it, the next request, the closed preview) were written against log show and "since T" windows; #113 replaced both with one log stream, matched by identity. They now follow it: - each extension logs which run of which service took its file ("accepted: run #N (service pid P), thumbnail|preview <path>"), and runs.py reads that run's own lines from the stream, in stream order; no timestamp is compared - the concurrency check follows the service's admission limit (#108): at L >= 2 the run beside is never queued and exits before the held run's kill; at L = 1 it is queued and spawns only after that kill, if at all - a closed preview's cancel must fall between the host's logged close and its logged quit, 3 s later, so the kill at the quit cannot pass - a preview switched to another file under a live run: the old kernel goes at the switch, box.brep is shown. Quick Look makes a new controller (measured, again); should it ever reuse one, the controller cancels the session it replaces and logs it - verdict.py: a preview is ready once, on its tree before the scene (STEP) or on its mesh (IGES, BREP), in stream order - runs_test.py checks every verdict on made-up streams, a decoy service whose pid has the real one's as a prefix among them Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
… close (#64 PR 2) - the linkage check requires a Mach header and linked libraries: a text file fails it (otool -L exits 0 on one) - the ql-e2e preview host logs its close to the unified log, so the closed-preview case is measured from the close, not from the spawn - plan.md: Quick Look makes a new controller per previewed item and releases the old one (measured), so prepare is not called twice on one The log scoping this commit first carried (log show, to the microsecond) is superseded by #113's single log stream and identity matching. Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
…ream (#64 PR 2) #107's Quick Look cases (the deadline with a thumbnail beside it, the next request, the closed preview) were written against log show and "since T" windows; #113 replaced both with one log stream, matched by identity. They now follow it: - each extension logs which run of which service took its file ("accepted: run #N (service pid P), thumbnail|preview <path>"), and runs.py reads that run's own lines from the stream, in stream order; no timestamp is compared - the concurrency check follows the service's admission limit (#108): at L >= 2 the run beside is never queued and exits before the held run's kill; at L = 1 it is queued and spawns only after that kill, if at all - a closed preview's cancel must fall between the host's logged close and its logged quit, 3 s later, so the kill at the quit cannot pass - a preview switched to another file under a live run: the old kernel goes at the switch, box.brep is shown. Quick Look makes a new controller (measured, again); should it ever reuse one, the controller cancels the session it replaces and logs it - verdict.py: a preview is ready once, on its tree before the scene (STEP) or on its mesh (IGES, BREP), in stream order - runs_test.py checks every verdict on made-up streams, a decoy service whose pid has the real one's as a prefix among them Refs: #64
gerchowl
added a commit
that referenced
this pull request
Nov 8, 2026
…64 part 2) (#107) ## #64 part 2: the Quick Look extensions run the kernel out of process Closes #64. Builds on #98 (part 1: the supervisor service), #103 (the kernel reads its descriptor directly) and #91. ### What changes - **No kernel in the extensions.** They link `libstepv_capi.a` only (the renderer and header reader). `otool -L` shows no libstepvocct and no OCCT, and `scripts/test-macos.sh` now checks that. The app's `Frameworks/` serves the CLI's kernel alone. - **Thumbnail:** - The fd goes to the service, which runs the kernel; the extension replies once with the rendered image. - **Deadline 15 s**, enforced by the service, plus a 17 s backstop in the extension. Quick Look's thumbnail watchdog is reportedly about 20 s, and a thumbnail has nothing to show partway, so the kernel gets 15 s and the render and reply get the rest. - **Preview:** - The header shows at once, then the assembly tree (the outline, indented, at most 14 lines) and live progress, then the scene. - **`handler(nil)`:** once the header and tree are on screen. With no tree (IGES, BREP, a failed or oversized outline), on the first mesh or the failure. At the latest **after 20 s** (the watchdog is about 30 s; 10 s of margin). - The view lives on, so the run may take up to **120 s** (the 42 s Ultimaker assembly loads). The run is cancelled when the view goes away. - **Memory cap:** 4096 MB in both, the CLI's default. ### ql-e2e on the real extensions (`just ql-e2e`) Every check reads #113's single `log stream` and matches by identity, never by time: - Each extension logs which run of which service took its file: `accepted: run #N (service pid P), thumbnail|preview <path>`. `scripts/ql-e2e/runs.py` reads that run's own lines and judges by stream order alone. `runs_test.py` checks each verdict on made-up streams first, with a pid-prefix decoy among them. - A preview and a thumbnail for STEP, IGES and BREP. Each preview must be ready exactly once: on its tree before the scene for STEP, on its mesh for IGES and BREP. - A 4000-part file is thumbnailed past its 15 s deadline, with `box.brep` beside it. - At L ≥ 2, box.brep's run is never queued and exits before the held run's kill. - At L = 1, box.brep's run is queued and spawns only after that kill, if at all. - Then the held run's `killed (deadline)`, no thumbnail, its kernel gone, and the next thumbnail under 3 s. - **Closed preview:** the host closes on a signal sent once the file's ready line is in the stream, never at a set time. It logs its close and its quit 3 s later. The kernel's SIGKILL cancel must fall between the two, be reaped within 1 s, and be gone. - **Closed before ready:** Quick Look keeps the controller until its handler is called, so the kernel is cancelled at the preview's ready (20 s at the latest), not at the close (#122). The case closes on the kernel's spawn. The close must come before the ready line, and the cancel after it, before the quit. - **Switched preview:** the host switches the view to `box.brep` once the file is ready. The old kernel must be cancelled between the switch and the quit, and box.brep must be shown. - Quick Look makes a new controller per item; this was measured again: no controller is prepared twice. - For a closed or switched preview, no result line may follow for the file that went, and its handler must complete exactly once. - **A cancelled session** (closed, or superseded by a second prepare: `StepvPreviewSlot`): - Its kernel is killed. - Nothing of it reaches the view: a late tree, progress, result, ready or decode is dropped and logged `stale, dropped`. - Quick Look's handler completes exactly once: `nil` when ready, `CocoaError(.userCancelled)` if cancelled first. It is then released, because it retains the controller. - The supervisor probe and the cache control are unchanged from main. ### Results (head 08eb056; sage, macOS 26.4; rebased on main after #113, #81, #116 and #119) - `just macos-test`: exit 0. That includes the preview-session unit tests, the linkage check and the supervisor probe. - **Linkage check fails closed:** it requires a Mach header and at least one `(compatibility version` line. A text file fails it, and so does `/nonexistent`. The old check passed a text file, because `otool -L` exits 0 on one. - `just ql-e2e` on the product build (L = 4): exit 0, **ALL PASS**. - Deadline: killed at 15 023 ms, reaped in 22.4 ms, gone. - Concurrent: box.brep was never queued and exited before the kill. - No throttle: 112 ms. - Closed: cancelled between the close and the quit, reaped in 17.7 ms. - Switched: the same, reaped in 18.7 ms. - **The same run on an L = 1 test build** (CI's 7 GB case): exit 0, ALL PASS. box.brep was queued and spawned after huge.step's kill (killed at 15 031 ms). - **Without the `deinit` cancel** (mutant): FAILURES. The closed and the switched preview were each cancelled only after the host quit. - **Controller reuse** (round 6, `PreviewSessionTests`): A's result arrives and its decode is still running when B supersedes it. - Passes: A shows nothing and its handler completes once, cancelled. B is ready on its own result, and its handler completes once. - Without the liveness check: exit 1. A's result is shown, and it marks B ready. - Without the handler's release: exit 1. In ql-e2e the closed and the switched previews were then cancelled only at the quit. - cbbe55e's macos-15 CI was red: the closed preview was cancelled only at the quit. The tree had not come by the fixed 8 s close, and the controller lives until its handler is called. Closes and switches are now ordered on the logged ready (08eb056). - Round 6 on 08eb056: `just macos-test` exit 0, `just ql-e2e` exit 0, ALL PASS. Closed before ready: ready (tree) at 4.47 s, then the cancel, reaped in 15.9 ms. - Nits filed: #120 (`.p21`), #121 (a mesh decode error is reported as "no geometry"). Design question: #122 (call the handler sooner?). - `scripts/ql-e2e/supervisor.sh`: exit 0. `cargo fmt --check`: exit 0. `cargo clippy --all-targets -- -D warnings`: exit 0. No kernel change. ### Known limits - #92: multi-file assemblies. - #97: Developer ID and the hardened runtime. - #101: three OCCT copies, +117 MB. - `macos-outer`: the kernel's own Seatbelt profile can't nest inside the service's sandbox. - The watchdog figures are reports, not documented values. The reasoning is in `macos/Shared/StepvKernel.swift` and plan.md.
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.
Fix #111: the supervisor tests wait on the service's own logged events, and tell runs apart by identity
Fixes #111.
Root cause (#111)
A 1.5 s run was killed before its first event, with admission limit 1 on the runner. #108 round 2 had replaced a sleep with "wait for the run's first event" as the sign that its kernel was running. The slow run's deadline is 1.5 s, and on CI's slower runner its TREE didn't arrive before the kill (
deadline: 1 run #4 … killed at 1509 ms, then the wait ran out atup 20440 ms). The handover case, with a 2 s deadline, had the same flaw. This is a test bug.A separate bug, introduced by this PR's own earlier commits
When 9a6ac31 removed the
sleep 1, the harness's whole-second log windows began to catch the lines of the step before.6 kernel spawns, expected 10, waiting on the wrong service instance.Fix
supervisor.sh, on stdout, to wait for a run's logged spawn, queueing or held-deadline (await <what> <run> <pid>), and goes on once that exact line is there.accepted(run)with the run's number in its log. The client then has the service's pid as well (StepvSupervisorRun.onAccepted,servicePid).processIdentifierstays 0 until a message from the service arrives, so it can't stand alone.drivematches exactly that run of that service, and every log check is scoped to the service pid its probe reported.set_startonly bounds how much log is read.STEPV_TEST_HOOKS,admission-hold) holds each admitted run untilrelease-Nappears in the service's tmp. It logs when the run's deadline passes while held, and the probe releases the run only after seeing that line. The run then reaches the admission-time check past its deadline and is refused, never spawned. The earlier widenings are reverted (deadline 2 s, drive 60 s, wait 15 s). This also resolves macOS supervisor admission: follow-ups from #108's review (timing-bound handover test, silent override parse, untested cancel race, docs) #109's first item.Results (sage)
scripts/test-macos.sh: exit 0 (L = 16).scripts/ql-e2e/supervisor.shon an L = 1 test build (CI's case): exit 0.scripts/ql-e2e/run-all.sh: exit 0, ALL PASS.Fails without the change:
supervisor.shwith a slower slow filethe slow run's kernel is runningfails, as on CIdrivepattern that ignores the piddrive takes another service's run #6 for its own(The branch is
bugfix/111-…: the repo's commit hook rejectsfix/branch names.)Round 4: ql-e2e judged by identity, from one log stream (dcabac0, 37de33d)
thumbnail <the request's own path>: drawnstamped 13:57:15.076 — but stamped before the request's own start, taken earlier by the wall clock. On CI's macOS VM a log event's timestamp runs behinddate(an estimated ~0.7 s), so every window opened at a wall-clock instant (log show --start, or e2elog's microsecondsince) dropped the request's own line, and a 769 ms thumbnail was judged cached. Not log lag: polling longer could not find it.run-all.shstarts onelog streambefore the first request (QL_E2E_STREAM), read byql-e2e.shandsupervisor.sh; nolog showanywhere. A request's lines are found by its own path, the supervisor's by service pid and run number; no time is compared (e2elog.py). Every wait is bounded (30 s) and says so when reached.takenafterdone, so a refused run's temporary probe could be freed first:swift_abortRetainUnownedon sage (L = 4).doneis now signalled last.just macos-testexit 0;scripts/ql-e2e/supervisor.shexit 0;just ql-e2eexit 0, ALL PASS.run-all.shexits 1 once the inodes are in Quick Look's cache: all three thumbnailsQL served a cached thumbnail(8–9 ms), VERDICT FAIL.