Repository navigation
ci(viewer): build the WASM once per run, and test the file Deploy viewer publishes (#1457) - #1458
Merged
Merged
Conversation
…wer publishes (#1457) viewer-test.yml gets a `build` job that builds the WASM (honouring release_wasm) and gen-fixture once and uploads them with the WASM's sha256. The legs download them, set the executable bit, put gen-fixture on PATH, run it, print the WASM's sha256 and fail when it differs from the recorded one. They used to build both themselves, about 2 minutes of each leg. A caller that built the WASM already passes the artifact's name as `wasm_artifact`, and `build` is skipped. Deploy viewer's `build` job uploads the release WASM and gen-fixture before staging, and its `tests` and `measure` jobs need `build` and pass the name, so they test the bytes that are published; `build` checks the site holds that WASM. Before, the three jobs each built it and tested builds of their own. The legs run unless the run is cancelled and fail first when `build` did not succeed; a `result` job fails unless every leg succeeded, so a skipped leg cannot read as a pass in `CI passed`. Artifact names no longer collide when Deploy viewer calls the workflow twice. Deploy viewer's trigger paths now name viewer-test.yml and .github/actions. Refs #1457
DrunkOnJava
marked this pull request as ready for review
November 5, 2026 17:08
…WASM, and every upload can be rerun (#1457) The legs checked the sha256 of viewer/pkg/rvt_bg.wasm before "Build viewer", but the tests serve the viewer/dist that step produces, and only Deploy viewer's build checked that copy. A bundler bump that re-encoded or renamed the asset would have passed every leg and CI passed, then failed on main. tools/ci/check-wasm-in-site.sh now does the check, and both the legs and Deploy viewer's build run it after the vite build. The Playwright report and the saved-mesh measurement uploads get `overwrite: true`, as the build uploads have, so a rerun of every job whose first attempt uploaded them does not fail on a 409. Refs #1457
DrunkOnJava
enabled auto-merge (squash)
November 5, 2026 20:02
This was referenced Nov 5, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…ions (#1457) (#1491) ## Summary The last piece of #1457: the Rust install, which was thirty-two copies of one script, is a composite action, `.github/actions/setup-rust`, and the three copies of the wasm-bindgen steps are another, `.github/actions/wasm-tools`. Nothing else changes: the same toolchain in every job, the same rust-cache keys, the same release path. ## Motivation #1457's last box: "the Rust install is repeated 27 times and the `wasm-bindgen` steps 3 times". By `git grep` today the install is 32 steps in 10 workflows (`ci.yml` 17, `publish.yml` 5, `measure.yml` 2, `scheduled-checks.yml` 2, and one each in `corpus-nightly.yml`, `deploy-viewer.yml`, `fuzz.yml`, `perf-budget.yml`, `release-binaries.yml` and `viewer-test.yml`), each a copy of `rustup toolchain install`, `rustup default`, two `echo ... >> $GITHUB_ENV` lines and `rustc --version`, differing in the toolchain, one component, one target and whether the toolchain becomes the default. ## Changes - `.github/actions/setup-rust` (new): inputs `toolchain` (default `stable`), `component`, `target` and `make-default` (default `"true"`). One `shell: bash` step, inputs through `env:` (no expression in the script), the same `--profile minimal --no-self-update`, then `rustup default` unless `make-default` is `"false"`, then `CARGO_INCREMENTAL=0` and `CARGO_TERM_COLOR=always` into `$GITHUB_ENV`, then `rustc +<toolchain> --version`. No third-party action inside it. - `.github/actions/wasm-tools` (new): the "Locked wasm-bindgen version" step, byte for byte, and `taiki-e/install-action` at the same SHA and the same `[email protected]` and locked `wasm-bindgen`, with the comment about the DNS outage (CI run 41954251714) moved into the action. Used by `viewer-test.yml`, `deploy-viewer.yml` and `publish.yml`. - All 32 sites use `setup-rust` (33 uses: the semver job takes a second for its nightly), as `uses: $/.github/actions/setup-rust` with only the inputs that differ from the default: `component: rustfmt` and `clippy` (fmt, clippy), `toolchain: ${{ matrix.rust }}` (the test matrix), `toolchain: nightly-2026-10-01` (the docs.rs previews, the fuzz-check job), `toolchain: ${{ env.NIGHTLY }}` (Fuzz), `toolchain: nightly` (the floating docs.rs build), `target: i686-unknown-linux-gnu`, `target: wasm32-unknown-unknown` (three), `target: ${{ matrix.target }}` (release-binaries), `target: ${{ runner.os == 'macOS' && matrix.target || '' }}` (publish's wheels, still `if: runner.os != 'Linux'`). - Three sites install a toolchain they do not make the default, with `make-default: "false"`: the fuzz-check job (`cargo +nightly-2026-10-01`, its rust-cache keyed by the default stable's `rustc -vV`), the MCP server's 1.88 check (its own step now, `cargo +1.88 check ...` after the install), and the public API listing's nightly in the semver job (a second use of the action after the stable one). - Deploy viewer's trigger already names `.github/actions/**` and `viewer-test.yml` (#1458), which covers both new actions, so it is unchanged. - `docs/maintaining.md`: a section on the two actions and on why the environment they set is not tidying. ## What is the same, and what is not Same: every job's toolchain, component and target; the default toolchain; `CARGO_INCREMENTAL=0` and `CARGO_TERM_COLOR=always` before the cache steps; the dated nightly stays at its sites; `shell: bash` on the composite steps; `rustup` flags. Swatinem/rust-cache hashes the default toolchain's `rustc -vV` and every `CARGO*`, `CC*`, `CFLAGS`, `CXX*`, `CMAKE*` and `RUST*` variable into its key (`src/config.ts` at the pinned SHA), so a change of default toolchain or of one of those variables in a job that restores a cache would start it from nothing. None changes: - every site that restores a cache set both variables and made its toolchain the default, as the action does; - the sites that differ are `i686-overflow` (no `CARGO_TERM_COLOR` before, which `ci.yml`'s workflow-level `env` sets for every step anyway), `docs-rs-nightly` of `scheduled-checks.yml` (the same, from that file's workflow-level `env`; no cache there) and the `Audit` jobs of `scheduled-checks.yml` (no `CARGO_INCREMENTAL` before; they compile nothing, their tools are prebuilt, and restore no cache): these two files' sites gain a variable that is already set or that nothing reads; - the log gains `rustc +<toolchain> --version` where a step printed none (fuzz-check), and shows the install as one step with its inner steps. ## Left alone Nothing in the issue's list was left. `publish.yml`'s `publish-crate` job runs only at a tag, so no dispatch runs its install step; it is the same invocation (`setup-rust` with no inputs) that `release-source-smoke` runs in a dispatch. ## Testing Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead. - [ ] `tools/check-local.sh` passes. N/A: CI-only change; no local compute on this lane. - [ ] Verified end to end on real Revit files. N/A: no Rust or reader change. - [ ] If this touches the IFC exporter. N/A. - [ ] If this is a performance change. N/A. What was run on this head (`13aa7f41`): - `python3 tools/ci/check-workflows.py`: 0 errors, 0 warnings; 65 jobs run steps in 17 workflows, `PENDING` empty, and 67 uses of this repository's own actions and workflows, whose files exist and whose `with:` names only inputs they declare (the `target`, `toolchain`, `component` and `make-default` of `setup-rust`). `actionlint` exits 0. - `zizmor` 1.32.0 offline over `.github` on this head and on `origin/main`: 45 findings each (2 ignored, 37 suppressed, 6 medium, all the Dependabot 3-day cooldown), none in the new actions or the changed steps, and no inline suppression removed. The repository's own `zizmor.yml` runs 1.30.1 on this pull request. - No inline Rust install is left: `git grep "rustup toolchain install\|rustup default" -- .github` finds only the action's own. - rust-cache keys, before: the `Cache Key` lines of the latest CI run on `main` (42120229711, at `16682a7a`, this branch's base): clippy `v0-rust-clippy-Linux-x64-cdee7d24-2ff012fc`, doc `v0-rust-doc-Linux-x64-0c88e82e-2ff012fc`, the shared `v0-rust-ci-release-Linux-x64-cdee7d24-2ff012fc` (Corpus health, MCP on Einhoven, Writer patch corpus, IfcOpenShell, bench and the Ubuntu stable build), `-1bcc85bf-` (MSRV), the macOS and Windows builds, `v0-rust-ci-i686-Linux-x64-3f01e9d1-2ff012fc`, `v0-rust-ci-docs-rs-Linux-x64-ab072a77-2ff012fc`, `v0-rust-ci-fuzz-check-Linux-x64-cd142760-c3664f70` and the viewer's `v0-rust-viewer-wasm-fast-Linux-x64-a74c6f26-2ff012fc`; Deploy viewer's build on `main` (42112535877) `v0-rust-viewer-wasm-Linux-x64-a74c6f26-2ff012fc`; Measure's build on `main` (42121438036) `v0-rust-measure-Linux-x64-a74c6f26-2ff012fc`. The runs on this head are compared against them (below). Runs on this head (`13aa7f41`), none read yet: not yet measured on this head until they are. - The draft's fast CI, run 42122477187: clippy and doc (component and default), the Ubuntu stable and MSRV builds (`toolchain: ${{ matrix.rust }}`), Corpus health and the MCP server on Einhoven (their rust-cache keys), the env config lint and the PII guard. At the first look `fast / cargo fmt`, `env config lint`, `PII guard` and both zizmor runs had passed. - Measure, which this pull request starts itself because it changes `measure.yml` (run 42122476881, Build head and Build base): the build job's install and cache. I dispatched no Measure of my own on top of it, since the filtered run asked for would build the same job again. - Release binaries, which a change to `release-binaries.yml` starts on a pull request (run 42122476923): the five targets, Windows, both macOS (one cross-compiled and smoked under Rosetta) and both Linux musl legs, with `target: ${{ matrix.target }}`. - Publish, dispatched on the branch (run 42123198927; a dispatch publishes nowhere, `test-pypi` stays false): the preflight, the wheel builds on all three systems (the non-Linux `if:` and the macOS target), the source install, the docs.rs preview on the dated nightly and the viewer smoke (`target: wasm32-unknown-unknown` and `wasm-tools`). Not run by it: `publish-crate`, which runs at a tag only; its install is the invocation `release-source-smoke` runs. - Deploy viewer, dispatched on the branch (run 42123203945; it deploys nothing from a branch): its build job (`viewer-wasm`'s cache key, `wasm-tools`) and the two calls of `viewer-test.yml`. - The full CI on ready: every other site, and the keys compared with the list above: `python3 cachekeys.py <main run> <this run>` over each job's `Cache Key:` lines (`.claude/scripts/cache-keys.py RUN_A RUN_B`, kept out of the tree; the baselines are CI run 42120229711, Deploy viewer run 42112535877 and Measure run 42121438036, all on `main`) reports the jobs whose key differs; the expected result is none. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR (`docs/maintaining.md`) - [ ] A user-visible change has its entry as a fragment under `changelog.d/<section>/`. N/A: CI only, as agreed for #1457. - [ ] If a limitation was resolved, the "Known limitations" section is updated. N/A. - [x] If a new limitation was introduced, it is documented in the PR body (none) - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [ ] Reverse-engineering finding. N/A. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] Any new test fixtures use synthetic values ## Breaking changes None. ## Screenshots or output samples See Testing. ## Related issues Closes #1457
DrunkOnJava
added a commit
that referenced
this pull request
Nov 6, 2026
…ead on selection (#35) (RE-207) (#1468) ## Summary The viewer's info panel lists a selected element's saved parameters (RE-207): instance, then type, named ones first, nameless ones behind a fold grouped by why they have no name (#255), each row saying where its parameter is defined. They are read for that element only, on selection, by a new `savedParameters` binding in a worker of its own; the open and every export are unchanged. File Status's Parameters row no longer says the rest are "still to be decoded". **Nothing is requested once the first file is open** (Griffin, 2026-11-05, "Keep the claim, no request"): selecting an element, exporting IFC, plan or glTF, and opening the file again fetch nothing, and a page taken offline after it loaded does all of them. ## Motivation The last open acceptance item of #35 that is not blocked: "Viewer info panel displays them in readable form". The CLI, Python and IFC (`--revit-property-sets`) expose the saved parameters; the viewer showed a count and a sentence that RE-207 had already made wrong. ## Changes - `rvt-wasm/src/lib.rs`, `rvt-wasm/Cargo.toml`, `Cargo.lock`: `savedParameters(bytes, ids, limits)` returns JSON text: each entry is `serde_json::to_value` of the parameter `native_element_parameters::read` gives, the call `rvt-elements` makes, with the release and how far it is read. `rvt` gets `unstable-research` here, which "adds paths and changes nothing else" (`src/research.rs`); no file under `src/` changes, so no export can move, and `arm.sh`'s `src/` gate path does not match `rvt-wasm/src/`. **The result's keys are a 1.0-stable surface** (`RELEASE.md`): `release`, `release_read`, `release_experimental`, `releases_read`, `releases_measured`, `elements`, `unresolved_family_slots`, `instance_parameters_without_value`. I chose them to say what they mean (not the research module's "native"): the read range, the measured range (Revit 2015 to 2022 are read experimentally, RE-281), and what could not be listed. `ids` is a `Float64Array`. - `viewer/src/parameters-worker.ts`, `viewer/src/saved-parameters.ts`, `viewer/src/wasm-failure.ts` (new; the out-of-memory test both workers use), `viewer/src/worker.ts`, `viewer/src/main.ts`, `viewer/src/styles.css`, `viewer/index.html`, `viewer/src/env.d.ts`: the panel group and its states (loading, ready, empty, release not read, experimental release, no ElementId, error with Try again, read-when-asked), the page's map of answers, focus and a live region, the status row text, and the no-request mechanics below. The "Not recovered" note for an element with no IFC property set now says "IFC property sets". - `viewer/tests/parameters-row.spec.ts`, `viewer/tests/no-network.spec.ts`, `viewer/tests/worker-failures.spec.ts` (now patches the inline worker's blob where it routed a worker URL), `viewer/tests/folded-pieces.spec.ts` (prints what a read does and what the page keeps on the BIM4LCA office, and fails if the read errors). - `.github/workflows/viewer-test.yml`, `.github/workflows/deploy-viewer.yml`: after #1458, `--bin rvt-elements` is built beside `gen-fixture` in the `build` job, copied into the artifact and checked to run in each leg; Deploy viewer builds and uploads its own artifact for `tests` and `measure`, so it carries the binary the same way. A local `pnpm test:browser` needs `rvt-elements` on PATH (`viewer/README.md`); the `parameters-row` specs skip without it locally and fail in CI. - Docs: `docs/viewer-api.md`, `docs/viewer-privacy-posture.md` (the CSP change, below), `README.md` (13 bindings), `docs/status.md`, `docs/support-matrix.json` (it also drops the "wall's or floor's type parameters are not joined" caveat RE-256 made stale), `docs/evidence.md`, `docs/export-diagnostics.md`, `docs/user-guide.md`, `docs/viewer-build-pipeline.md`, `docs/maintaining.md`, `viewer/README.md`, and `changelog.d/added/35-viewer-saved-parameters.md`. ## Design **A worker of its own, nothing resident.** `extract` is a pass over the file, so the read is lazy, per selected element. The open's worker keeps no `RevitFile` and no bytes: a held handle would keep the file's bytes and every partition it inflates for the session, and its reads would hold up the panel (Core Interior's take seconds). Instead the page opens a worker for one element, which reads the `File` the page already holds, calls the binding, answers and is terminated, or is terminated at once when another element, a storey or a scaffold panel replaces the group. wasm linear memory only grows, so ending the worker gives a read's memory back. A worker the browser ends with no word (no event) is found by a Web Lock it holds, so "Reading" cannot show for ever. **No request once the file is open; the CSP change.** The page's `worker-src` was `'self'`; it is now `'self' blob:`, and nothing else in the policy moves (`docs/viewer-privacy-posture.md` says so and why). Both workers (the open's and the reader) are bundled into the page (`?worker&inline`) and start from blob URLs; the decoder's glue is a static import (the main thread's exports used to `import()` it, and fetch the wasm, at the first export click). The first open's worker fetches the wasm once, compiles it and hands the module to the page, which keeps it: the next open (another phase, the saved-mesh toggle, the large-model retry), the readers (`initSync({ module })`) and the main thread's exports (`default({ module_or_path })`; the main thread does not allow `initSync` of a large module) start from it. The lazy loads in `viewer/src` that could run after the open were: `import('../pkg/rvt.js')` (static now), `new Worker(new URL('./worker.ts', ...))` (inline now), the worker's `fetch(new URL('../pkg/rvt_bg.wasm', ...))` (the page resolves the URL once, and fetches only at the first open). Opening a gallery demo still fetches the demo, which is an open. **First page load.** The page's one script is 999.56 kB (271.47 kB gzipped) against 959.29 kB (262.82 kB) in the build of `d1de8adf`: 40.27 kB, 8.65 kB gzipped, more, mostly the glue and the two workers it used to fetch later; the built site holds one script, one stylesheet and the wasm. **When a selection is read on its own.** A read has taken 0.74 to 1.04 times the open's wasm memory, and the ratio rises with the file (Einhoven 23 MiB, Core Interior 326, the office 910). Nothing above the office has been measured, so a selection is read on its own only while the wasm memory the page holds (the open's, plus the main thread's instance if an export made one) is at most 1 GiB (a quarter of `?memoryCeilingBytes=` where that lowers the 4 GiB ceiling), and above that the panel asks first with a button whose copy says clicking may close the tab: a renderer out of memory takes the tab and the model with it, with no error. After a read that ran out of memory, or a worker that went without a word, that file is read only when asked. This replaces the rule that two instances stay inside the ceiling, which extrapolated past what is measured. **What the page keeps.** Each element's answer, in a map on the page: at most 64 (`?parametersRemembered=` lowers it for the test), the least recently selected going first, emptied when a file is opened. Selecting an element again starts no worker. On the office after the test's selections it held 2 answers, 4,654 characters of JSON (the entries are small; the answers there have 8 entries). ## Testing Unit tests are banned in this repository: none added. Measured in **Viewer tests run 42125048710**, dispatched on head `3146f14e6fcf221adc4f632ac1a5cfa31a3b885d` (the merge of main with #1457's changes included), `release_wasm=false`, on a CI runner: success in all three legs, `check-wasm-in-site.sh` finding the one wasm sha256 in the site in each. **Deploy viewer run 42125109395**, dispatched on the same head, on the release (LTO) wasm: success. Its `tests` job passed all 61 tests of the suite (the whole of it, on the wasm the site publishes), its `measure` job 6, and `check-wasm-in-site.sh` found the artifact's one sha256 (`d2b60a7e…`) in the built site in each of the three jobs that build it; the page's one script is the same size as in the viewer tests' build (999.56 kB, 271.47 kB gzipped). On the office with that wasm a read took 3.3 s in 942 MiB beside the open's 910 MiB, on selection, and the page kept 3 answers, 4,929 characters; the real capped read ran out of memory as in the other run. (`deploy` is skipped on a branch, by design.) This PR's head is `3146f14e` plus documentation (the figures, in the changelog, `docs/status.md` and `docs/viewer-api.md`) plus a merge of main as it stood at #1470, whose export changes (#1456, #1470, `src/ifc`) were not part of either run; the full CI of the ready PR runs the viewer tests on this head. Earlier runs on earlier code are not counted; Deploy viewer 42122627698 and viewer tests 42122623374, on `7663a4f3`, each failed once, in the test of a worker ended with no word, which ended a worker that had already answered (a read of Einhoven takes a fraction of a second); the test now holds the file back first. `viewer/tests/parameters-row.spec.ts`, in the viewer's leg 1/3 (no new spec file). The oracle is the command line: the test runs `rvt-elements` on the same file. | | Einhoven (2023) | Core Interior (2024) | BIM4LCA office as built | |---|---|---|---| | Compared with `rvt-elements`, whole entries | 37 of 37 tree elements: 28 with parameters (369 entries: 332 instance, 37 type, 8 named) equal, 7 with none show the empty state, 2 have no ElementId in the export (shown as such) | 4 elements, IFCSLAB 22756 (4 entries), IFCWALL 22771 (11), IFCCOLUMN 22798 (17), IFCDOOR 80750 (21), equal | **not compared** | | A read, time (a CI runner's) | median 153 ms, most 210 ms | 1.5 to 1.9 s | 3.9 s (8 entries, IFCCOVERING 2097832) | | That read's wasm memory | 17 MiB | 275 MiB | 943 MiB | | The open's worker | 23 MiB, 0.7 s in the open call | 326 MiB, 17.3 s | 910 MiB, 66.6 s | | Read over open (memory) | 0.74 | 0.84 | 1.04 | | How it was read | on selection | on selection | on selection (no button) | | Kept by the page | | | 2 answers, 4,654 characters of JSON | Also in the spec (each passed in 42125048710): - **A real out-of-memory read.** A Chromium whose V8 caps wasm memory at 927 MiB (`--wasm-max-mem-pages`, the pattern of `memory-ceiling-capped.spec.ts`) opens the office (910 MiB) and the read (943 MiB) really runs out: the page says "The tab ran out of memory reading the file a second time (unreachable)... read only when asked from now on", and the next element asks. A read of Einhoven cannot fail after its open succeeds (17 MiB against 23), so the office is the only file in CI where a cap separates the two. - **No request, offline.** After the load the page is taken offline and every request is recorded (workers included): three elements are read and equal `rvt-elements`', an IFC, a plan and a glTF export are made, the file is opened again (the saved-mesh toggle), an element is read again, and no http(s) request was made. `no-network.spec.ts` runs the same exports and re-open, and a selection, in phases that allow nothing, and fails if the sample has no element to select, if the wasm is fetched to boot the page or more than once. - The gate at its edge (a limit 8 MiB over and 8 MiB under Einhoven's measured open memory: read on selection, then asked); the bare-`unreachable` branch and its copy, and the file read only when asked afterwards; a worker ended with no word, with the file held back four seconds so it is still reading; a read for an element no longer shown ended (another element, a storey), and the shown element's read not started over by selecting it again; an element selected again starting no worker; a copy of the file opened under another name emptying the map; the bound; a read that fails with a panic, with Try again, and focus on the result; the empty state; the Parameters row text; Revit 2013 (the worker's answer replaced) and Revit 2019 experimental (replaced). Not verified: - **The release-not-read and experimental-release states.** No file of a release outside Revit 2015 to 2027, or of 2015 to 2022, is in the viewer's job, so those two tests replace the worker's answer to the page with the binding's shape for one (`release_read` false; `release_experimental` true). They test the page's rendering only. The Rust branches (`NATIVE_RELEASES.contains`, the measured range) are not exercised by any file. - `tools/check-local.sh`, clippy and `tools/ci/check-workflows.py` (no local compute; PyYAML is not installed here); CI's fast jobs on this PR are the check. The wasm network-import audit passed in the viewer legs. - An ElementId above `u32::MAX`: the binding reads it, the command line lists such elements as `id: null`, so nothing compares them. - The office is not compared with `rvt-elements`; only that its read does not error. The gate is held at its edge on Einhoven's open memory; no file between 910 MiB and the 4 GiB ceiling is in the viewer's job, which is why the limit is the measured 1 GiB. - The CDP session of `no-network.spec.ts` may not see worker requests; the offline test, which records every request and fails any, is what covers them. - Screen-reader announcements were not heard: the live region's text and the focus move are asserted, not a screen reader's output. ## Breaking changes None. A binding is added (`tools/ci/wasm-api.py compat` has nothing to flag); no existing binding or output changes. The `worker-src` of the page's Content-Security-Policy gains `blob:`. ## Related issues Refs #35 (#255 and the family built-in slots stay open).
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.
Summary
The viewer's WASM and gen-fixture are built once per run, and Deploy viewer's browser tests and measurement run on the very WASM it publishes.
Motivation
#1457, item "The viewer builds its WASM once per run, and Deploy viewer tests what it publishes". Measured in that issue's audit of recent runs: each of CI's three viewer legs built the WASM and gen-fixture itself (about 2 minutes of its 5.5 to 6.6), and Deploy viewer built the WASM three times (
build4.1,tests4.3,measure3.6 of 27 job-minutes a run). More important than the time: it published thebuildjob's copy whiletestsandmeasureeach tested a build of their own, so the file published was not a file that was tested.Changes
viewer-test.yml: abuildjob builds the WASM (release_wasmhonoured) and gen-fixture once and uploadspkg/,bin/gen-fixtureandwasm.sha256as a run artifact. Each legneedsit, downloads it, sets the executable bit, puts gen-fixture onPATH, runsgen-fixture --help(the stager would otherwise build gen-fixture itself, since cargo is on the runner image, and pass), prints the WASM's sha256 and fails if it differs from the recorded one. Rust toolchain,rust-cache, wasm-bindgen and wasm-pack steps are gone from the legs. The network-import audit stays in each leg, on the copy it tests; demo staging, Playwright and the tests stay in the legs.viewer/dist, notviewer/pkg, so after "Build viewer" each leg also runstools/ci/check-wasm-in-site.sh: some.wasmin the site must have the recorded sha256. Deploy viewer'sbuildruns the same script on the site it publishes. A bundler that re-encoded or renamed the asset would otherwise pass every leg and fail onmain.workflow_callinputwasm_artifact: a caller that built the WASM already passes the artifact's name, andbuildis skipped. It is not a dispatch input (a dispatched run has no artifact to name, so it builds its own).if: !cancelled()), and their first step fails unlessbuildsucceeded or was skipped withwasm_artifactgiven. Aresultjob (legs passed) then fails unless thetestjob's result issuccess, so atestjob that was skipped, or alegslist that yields no leg, fails the call;ci-oktherefore never sees an all-skippedviewer. The only way a leg does not run is a cancelled run, whichci-okreads as cancelled.viewer-build-<12 hex of a sha256 of legs and release_wasm>, so two calls in one run differ. The failure report wasplaywright-report-<job index>, which is 0 in both of Deploy viewer's calls; it now follows the leg's name (/and spaces replaced). Every upload, the build's, the report's and the saved-mesh measurement's, hasoverwrite: true, so a rerun of every job does not fail on a 409.deploy-viewer.yml:buildbuilds gen-fixture beside the WASM as viewer-test.yml does, uploadsviewer-build-releasebefore anything is staged, andtestsandmeasurehaveneeds: buildandwasm_artifact: viewer-build-release..github/workflows/viewer-test.ymland.github/actions/**, with the reason in a comment.docs/maintaining.mdanddocs/viewer-build-pipeline.md.ci.ymlis unchanged:release_wasm: falsestill selects the fast build andwasm_artifactdefaults to empty.buildkeepsviewer-wasmandviewer-wasm-fast; Deploy viewer'sbuildkeepsviewer-wasmand addstarget-native(see "Not measured" below).Testing
Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead.
tools/check-local.shpasses: N/A, workflow, shell and docs only (no Rust changed). Locally:actionlintreports only the known$/complaints,zizmor --offlineon viewer-test.yml, deploy-viewer.yml and ci.yml finds nothing,shellcheckon the new script finds nothing, and the script was run against a matching, a changed and a missing.wasm.Proofs
Heads:
7ae87737(first push) and82fb52a7(adds the dist check, the twooverwrites and a merge ofmain). The structure of both is the same.buildran; thebuild the WASMjob insidetestsandmeasurewas skipped, and the legs andlegs passedof both calls succeeded;deployskipped (notmain). The WASM's sha256 is e4360cda5fd0050bd5aad645d281b9f2a00de9e8846ddc33ce96f0513315d22f inbuild, intests' leg and inmeasure's leg, and each of the three found that same sha256 in the.wasmof the site it had built, so vite copies the file unchanged.CI passedprintedjob results:with 21 results, allsuccess,viewer-pathsandvieweramong them;viewerran itsbuild the WASMjob (2.2 min), the three legs andlegs passed. The earlier full run, 42071653521 on head 7ae8773, also passed.viewer-test.ymlwithlegs='[]'(andrelease_wasm=false), run 42092950916, head 82fb52a: red, not green. Notestjob was created for the empty matrix andneeds.test.resultreadfailure;legs passedfailed.buildstill ran to the end (2.2 min).wasm_artifactdispatch input), run 42092956350:buildskipped, all three legs failed at the download ("Artifact not found for name: viewer-build-does-not-exist"),legs passedfailed, run red.buildthat exits 1, run 42092960158:buildfailed, all three legs failed in their first step ("the build job ended failure; there is no WASM to test"),legs passedfailed, run red.Job-minutes and wall time
"Before" is the 12 most recent full
CI (pull request)runs of other branches that had the old shape (2026-11-05: 42091450363, 42089961945, 42089583832, 42069752738, 42069162991, 42068363131, 42067703359, 42067234997, 42066197964, 42065433127, 42064122054, 42062387965), and, for Deploy viewer, the 9 successful pushes tomainthat day (42063967923, 42043964976, 42037978731, 42034472263, 42029351913, 42025959298, 42013240274, 42008824775, 42000482201). "After" is this branch's runs. Times are each job's started-to-completed time from the Actions API; "from the first job" counts from the run's first job start.CI, a ready pull request:
build the WASMbuildstart tolegs passedendCI passeddone, from the first jobCI passedThe viewer saves about 4 to 5 job-minutes a run.
CI passeddid not get slower on these two runs, and the chain through the viewer is no longer than the longest leg was: a leg now takes 2.7 to 3.8 minutes because it no longer builds, and the build job takes 2.2 to 2.5 minutes before it. The second read's estimate of 1 to 1.5 minutes more on that chain did not show. Two runs cannot separate a minute from runner queueing, though: the 82fb52a run shared the runners with the four dispatched runs above and other lanes' runs (its jobs started up to 121 s after the first), which is part of its 507 s; every job of the 7ae8773 run started within 11 s. The viewer is the last job beforeCI passedin both runs after and in 8 of 12 before, so a later change that shortens the other jobs makes it the critical path.Deploy viewer (jobs before
deploy):builddeploycould startDeploy viewer saves about 7 job-minutes a run and takes as long:
testsandmeasurenow wait forbuild, which is a serial step of about 6 minutes that used to run beside them, and the legs no longer carry the 4 minutes of building. One run after, against nine before whose own spread is 7 minutes.Not measured
buildhere compiled gen-fixture cold in 2 min 23 s beside the WASM, whose release build took 5 min 10 s, because the restoredviewer-wasmcache (150 MB) holds notarget-native. I did not test whether that slows the WASM; a branch run does not save a cache. It should correct itself onmainwhen a push with a changedCargo.locksaves one withtarget-native. If it does not, giving Deploy viewer'sbuilda newshared-keywould.deployjob and the real Pages publish have not run on this shape.overwrite: trueuploads are for, was not exercised.Audit-honesty checklist
changelog.d/<section>/: N/A, CI only, no user-visible changeLegal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md)Breaking changes
None.
Screenshots or output samples
N/A.
Related issues
Refs #1457