Skip to content

feat(view): open the viewer on the outline, and cancel the run on close (#85) - #93

Merged
gerchowl merged 3 commits into
mainfrom
feature/85-viewer-outline-first
Oct 13, 2026
Merged

gerchowl merged 3 commits into
mainfrom
feature/85-viewer-outline-first

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #85

What

stepv view opens its window at once and runs the kernel on a thread of its own (run_view / load_view in src/main.rs), through the CLI's own tessellate, so the artifact, the box and the progress code are shared, not duplicated. The loader sends the window view::Load messages over a channel:

  • Tree: a cached outline artifact's tree, sent before the kernel starts, then the run's Event::Tree. It's drawn in the tree panel (Tree::from_nodes).
  • Progress: "Transferring the shapes: P%" or "Meshing: P%", with a progress bar.
  • Done: the GPU scene is built and the viewer swaps in, with the full title.
  • Failed: the window closes and the report says why, as before. viewer: keep the tree with an honest message when a load is killed or times out (#63 part 3) #89 will keep the tree with its reason instead.

Closing mid-load cancels the run (Q1). occt::run_streaming gains a cancel: Option<&AtomicBool> parameter. supervise's tick may stop the run and kill the kernel, which is the new Outcome::Cancelled. view reports status cancelled with exit 0. This public API change is in the rustdoc and the CHANGELOG.

Known limits. --software, or no usable GPU, still waits for the whole run (#90). A failed run closes the window (#89).

Tests (each new one fails on origin/main)

  • tests/stream.rs a_cancelled_run_is_killed_at_once (nextest): Outcome::Cancelled, no summary, within seconds of a 60 s cap.
  • Window tests: #[ignore = "needs a window session; …"], run by scripts/test-window-tests.sh, which now counts 7. They go through Home::view (process group, memory cap, --timeout, screenshot hook). Under STEPV_VIEW_SCREENSHOT the window reports its frames on stderr, because the macOS CI runner never presents a window:
    • the_viewer_shows_the_tree_before_the_geometry: with the kernel stalled 8 s, the loading frame shows the outline's rows and no geometry, then the scene. On main: no loading frame with the tree.
    • a_cached_outline_shows_the_tree_before_any_kernel_event: a cached artifact with a mute kernel shows the artifact's rows. On main: no loading frame.
    • closing_the_viewer_mid_load_cancels_the_kernel: STEPV_VIEW_CLOSE_LOADING=1 with a stalled kernel gives cancelled, exit 0, in under 20 s, and the kernel's process is gone. On main: (4, "timeout") after 30 s.
  • The existing watchdog test's deadline goes from 2 s to 10 s. The window now opens alongside the run, and macOS's first-launch check of the test's fresh kernel script was measured at up to 1.5 s, which made 2 s flaky. That's still far below stepv's own 30 s timeout.
  • The no-session early failure (feat(cli): show progress on a terminal, and leave the outline from view (#63 part 1) #84) is unchanged and still passes in nextest.

Review round 1 (ed150e9)

  • Software fallback (blocker): the viewer's pipelines are now built and validated in eframe's creator (pipelines() in src/view/app.rs), before the window is the viewer's. A refusal hands the load back, and view::run falls back to software, as on main. Only the scene's buffers are checked after Done.
    • New window test a_gpu_that_refuses_the_pipelines_falls_back_to_software, using the STEPV_VIEW_REJECT_PIPELINES hook: status ok, backend software, and the screenshot is drawn. At f18f607 it fails with backend: "metal".
  • Loader panic: the loader takes the Sender by value, so a panic closes the channel. A unit test checks that a panicking loader ends the software viewer's wait.
  • cancelled report: it carries message, not error (documented in plan.md); the cancel test asserts it.
  • CHANGELOG: the run_streaming change is under Changed, marked breaking.
  • Harness: Outcome::Cancelled maps to a Crash verdict with a note, instead of unreachable!.

Gate

  • cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test → exit 0
  • nix build -L --no-link .#checks.aarch64-darwin.nextest → exit 0 (248 passed, 11 skipped: 3 existing ignores and the 8 window tests; at ed150e9)
  • just view-test → its test steps passed: 85 + 8 + the 8 window tests (at ed150e9). Its last step failed only because the recipe hardcodes target/release/stepv, while this build used CARGO_TARGET_DIR. scripts/test-viewer.sh <that build> → exit 0, with every check ok (both themes, software fallbacks, pick, measure, section, --frames on every fixture, failed topology).

gerchowl added a commit that referenced this pull request Oct 13, 2026
Review round 1 on #93. The viewer was built after Done, in an open
window, so a GPU that refused its pipelines closed the window and exited
1 instead of falling back to software, as main did. The pipelines are
now built and validated in eframe's creator (pipelines()), where a
refusal still hands the load back to the software viewer; only the
scene's buffers are checked after Done. STEPV_VIEW_REJECT_PIPELINES
forces the refusal for a new window test.

Also: the loader takes the channel's sender by value, so a panic closes
it; a cancelled report carries message, not error; the harness maps
Outcome::Cancelled to a crash verdict; the run_streaming change is in
the CHANGELOG under Changed, marked breaking.

Refs: #85
gerchowl added a commit that referenced this pull request Oct 13, 2026
Review round 2 on #93. The scene's buffers are uploaded after Done, in
the open window; a refusal closed it with an error, where main drew the
scene in software. The window now hands the loaded scene back
(app::Back::Loaded) and view::run draws it in software, so every GPU
failure that fell back before #85 still does. STEPV_VIEW_REJECT_UPLOAD
forces it for a new window test.

Also: the hooks are listed in scripts/test-viewer.sh, and the harness
has an error verdict for a cancelled run instead of calling it a crash.

Refs: #85
stepv view opens its window at once and runs the kernel on a thread of
its own, through the CLI's tessellate. The window shows the assembly
tree (from a cached outline artifact before the kernel starts, then from
the run's Event::Tree) and the run's progress, then swaps in the scene on
Done. A failed run closes the window and reports as before (#89).

Closing the window mid-load cancels the run: occt::run_streaming takes a
cancel flag, supervise kills the kernel when it is set, and the run is
the new Outcome::Cancelled; view reports status cancelled, exit 0.

The software viewer has no tree and still waits for the run (#90).

Refs: #85
Review round 1 on #93. The viewer was built after Done, in an open
window, so a GPU that refused its pipelines closed the window and exited
1 instead of falling back to software, as main did. The pipelines are
now built and validated in eframe's creator (pipelines()), where a
refusal still hands the load back to the software viewer; only the
scene's buffers are checked after Done. STEPV_VIEW_REJECT_PIPELINES
forces the refusal for a new window test.

Also: the loader takes the channel's sender by value, so a panic closes
it; a cancelled report carries message, not error; the harness maps
Outcome::Cancelled to a crash verdict; the run_streaming change is in
the CHANGELOG under Changed, marked breaking.

Refs: #85
Review round 2 on #93. The scene's buffers are uploaded after Done, in
the open window; a refusal closed it with an error, where main drew the
scene in software. The window now hands the loaded scene back
(app::Back::Loaded) and view::run draws it in software, so every GPU
failure that fell back before #85 still does. STEPV_VIEW_REJECT_UPLOAD
forces it for a new window test.

Also: the hooks are listed in scripts/test-viewer.sh, and the harness
has an error verdict for a cancelled run instead of calling it a crash.

Refs: #85
@gerchowl
gerchowl force-pushed the feature/85-viewer-outline-first branch from 5389cbc to ec500bf Compare October 13, 2026 01:14
@gerchowl
gerchowl merged commit 1bfce32 into main Oct 13, 2026
13 checks passed
@gerchowl
gerchowl deleted the feature/85-viewer-outline-first branch October 13, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

viewer: open on the outline — tree and progress first, meshes on Done (#63 part 2)

1 participant