Repository navigation
Switch the site to the Rust planner, in a Web Worker (port stage 12b) - #174
Conversation
The site now loads rust/planner-wasm instead of the .NET WASM bundle. npm run build-wasm builds it with cargo (inside rust/, so the pinned toolchain applies) and copies planner.js and planner_wasm.wasm into src/lib/planner-wasm, where Vite gives the .wasm a hashed name under /assets/. /framework/ and its _headers note are gone. wasmPlanner.ts keeps plan() and normalize(). It plans in a module Worker (plannerWorker.ts) and falls back for good to the main thread if the worker fails to construct, errors, or does not answer init within 15 s. ?planner=main-thread forces the fallback. CI and the deploy workflow build the Rust module instead of the .NET publish, and the bundle check now looks for the hashed .wasm and worker. The devcontainer job builds the planner on the runner until the image gets Rust in stage 13. The .NET test jobs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PTSQFMEdmByebgkoa9RiqH
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Stage 12b of #138. Merging this PR deploys the live site. After the merge, https://oilfieldplanner.factorygamefan.com plans with the Rust module instead of the .NET WASM bundle.
What changes
npm run build-wasmrunscargo build --release -p planner-wasm --target wasm32-unknown-unknowninsiderust/, so the pinned toolchain applies. It then copiesplanner.jsandplanner_wasm.wasmintosrc/vue/src/lib/planner-wasm/. That folder is gitignored except forplanner.d.ts. Vite gives the.wasmand the worker hashed names under/assets/, which already have the one-yearimmutablecache. The/framework/copy and its_headersnote are gone.wasmPlanner.tskeeps the sameplan(json)andnormalize(json). It plans in a module Worker (plannerWorker.ts). If the worker fails to construct, reports an error, or doesn't answer its first request within 15 seconds, planning moves to the main thread for good and one warning is logged. Requests that were waiting on the worker run again on the main thread. Add?planner=main-threadto the URL to force the fallback. Errors reach callers the same way as before. The old worker problem was .NET's runtime deadlocking increate(). The Rust module has no runtime, so that problem doesn't apply.build-vuejob anddeploy-cloudflare.ymlbuild the Rust module instead of the .NET publish. The deploy workflow's PR path filter is nowrust/**,src/vue/**and the workflow file. The bundle check now requires the hashed.wasmand worker indist/assets, and fails if anything still points at/framework/. The devcontainer job builds the planner on the runner, because its image has no Rust yet (stage 13). The .NET test jobs and projects are unchanged.Checks
npm ci,npm run build-wasm,npm run buildandnpm test(51 tests) pass locally. Prettier and eslint are clean on the changed files.The 61-plan times include the UI's own work, so the planner's own speed-up is larger than these numbers show.
wrangler dev: no/framework/requests. The.wasmcame from/assets/withCache-Control: public, max-age=31536000, immutable.Before merging
.gitignorestill listssrc/vue/public/framework/, and the devcontainer image should get Rust when .NET leaves it.🤖 Generated with Claude Code
https://claude.ai/code/session_01PTSQFMEdmByebgkoa9RiqH
Summary by CodeRabbit