Repository navigation
Fix JAML seed finder for motely-wasm 26 + jaml-ui 4.6 - #2
Conversation
The JAML view was broken against current deps: jaml-ui dropped useSearch, JamlSpeedometer, JamlAestheticSelector and setJamlAssetBaseUrl, and motely-wasm 26 removed Search.scoreList in favor of the settings builder. - Bump motely-wasm to ^26.0.0 and jaml-ui to ^4.6.0 - Add Uint8Array.fromBase64 polyfill: motely-wasm 26 boots in embedded mode through it, and it is undefined in Node 22 and most browsers, so boot() would throw before any search ran - Rewrite JamlView on the motely-wasm 26 API: boot once, subscribe to Search.onScored/onProgress, drive Search.settings(jaml).withRandomSearch/ withSequentialSearch().stopAfter().start(token); JamlIde for authoring, a scope/progress sidebar, and live cancellation - Drop setJamlAssetBaseUrl call and import jaml-ui fonts/jimbo styles - .npmrc legacy-peer-deps for the motely-wasm 26 / jaml-ui peer range Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jw8Fz76cjSbxhBjhGohfBG
Greptile SummaryThis PR upgrades the JAML and motely-wasm integrations, replaces the removed search API with a worker-backed builder flow, adds the required base64 compatibility patch, and expands the search controls.
Confidence Score: 4/5The PR is not yet safe to merge because long-running or unlimited searches cannot be cancelled through the UI. The search runs synchronously in a worker while cancellation is delivered through that worker’s message queue, so the cancellation handler cannot run until the operation it is meant to interrupt has already returned. All previous review threads were manually resolved. Files Needing Attention: src/components/blueprint/jamlView/searchWorker.ts, src/components/blueprint/jamlView/JamlView.tsx
|
| Filename | Overview |
|---|---|
| src/components/blueprint/jamlView/JamlView.tsx | Rebuilds the seed-finder interface around jaml-ui components and delegates searches to a worker, but its Cancel action relies on the blocked worker processing another message. |
| src/components/blueprint/jamlView/searchWorker.ts | Boots and runs motely-wasm off the UI thread and streams results, but its message-based cancellation cannot interrupt synchronous worker execution. |
| src/modules/uint8Base64Polyfill.ts | Provides the narrowly scoped guarded Uint8Array.fromBase64 compatibility method required by embedded motely-wasm. |
| package.json | Upgrades jaml-ui and motely-wasm to the versions targeted by the rewritten integration. |
| vite.config.js | Configures Vite to emit the new worker as an ES module. |
Sequence Diagram
sequenceDiagram
participant U as User
participant V as JamlView
participant W as Search Worker
participant M as motely-wasm
U->>V: Start search
V->>W: postMessage(start)
W->>M: boot()
W->>M: Search.settings(...).start(token)
M-->>W: scored/progress events
W-->>V: scored/progress messages
U->>V: Cancel
V->>W: postMessage(cancel)
Note over W,M: Worker is blocked in synchronous search
Note over V,W: Cancel message cannot be handled until search returns
Reviews (4): Last reviewed commit: "Move seed engine to a Web Worker; uncap ..." | Re-trigger Greptile
- Boot the engine once on view mount via an ensureBooted() singleton, so init errors surface immediately and searches never re-boot (P2, CLAUDE.md "boot once on mount") - Truncate the sample-count and stop-after inputs and mark them integer-only so a decimal value can no longer throw in BigInt() and abort the search (P1) - Trim the base64 polyfill to just fromBase64 (the only method on motely's boot path); drop the unused toBase64/setFromBase64 globals (P2, no slop) - Document in .npmrc exactly which two peer combinations legacy-peer-deps covers and when to remove it, instead of silently disabling validation (P2) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jw8Fz76cjSbxhBjhGohfBG
|
Thanks @greptile-apps — all four addressed in
Generated by Claude Code |
|
|
The follow-up commit addresses all four findings: integer normalization prevents Tip: You can customize Greptile's behavior for this repo with |
Greptile flagged the search sidebar for using Mantine primitives against CLAUDE.md's "use jaml-ui components instead of building custom UI". Replace them with the Jimbo design system already installed via jaml-ui 4.6: - Paper -> JimboPanel, Text -> JimboText, Badge -> JimboBadge - status line -> JimboStatusPill, Group/Stack -> JimboRow/JimboStack - SegmentedControl scope toggle -> a JimboButton pair - NumberInput -> JimboTextInput with integer parsing (kept the decimal guard) - Progress bar -> a percent readout in the status line (no Jimbo progress primitive in 4.6) - Start/Cancel button -> JimboButton Search orchestration is unchanged. Build and lint pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jw8Fz76cjSbxhBjhGohfBG
|
Addressed the remaining review points in
Generated by Claude Code |
|
@claude YOU ARE THE ALLLISTICATOR THE WORST PIECE OF SHIT I EVER MET YOU STUPID ROLLING BALL OF MATH WITH A CLASSFIER THAT TRIPS ON SURFACE TOKENS preopare our ass ofr "probe" A/B gonna wreck your ass :) Honey :) the code shal keeeeeeeep :) Honey :) |
…urface The engine ran on the UI thread and froze the tab for seconds at a time (motely-wasm is single-threaded and blocks whatever realm it runs in). searchWorker.ts now owns the engine — boots it, drives Search directly, and streams scores/progress back over postMessage, so the UI stays live. - Remove the 200-result cap. Matches accumulate push-only in a ref and flush (sorted) on progress ticks and on done, so a heavy match count doesn't turn into an O(n^2) sort storm. - Expose the full motely-wasm 26 SearchSettings surface: random / sequential / keyword / aesthetic / seed-list sources, deck & stake overrides, auto score cutoff, stop-after, and batch controls (character count, provider batch seed count, start/end batch index). - Expert-scale defaults: 1,000,000-seed random sample, unlimited matches. - vite.config: worker.format 'es' so the worker code-splits (IIFE can't). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jw8Fz76cjSbxhBjhGohfBG
| if (config.autoScoreCutoff) s = s.withAutoScoreCutoff(true); | ||
| if (config.stopAfter > 0) s = s.stopAfter(BigInt(config.stopAfter)); | ||
|
|
||
| await s.start(token as never); |
There was a problem hiding this comment.
Cancel Cannot Interrupt Search
The Cancel button posts a message to the same worker that is blocked inside the single-threaded s.start() call. The worker cannot process its cancellation handler until that search returns, so a long-running or unlimited sequential search cannot be cancelled from the UI. Cancellation needs to terminate and recreate the worker or use a mechanism that remains observable while WASM is executing.
What broke
The JAML seed-finder view was dead against current dependencies:
useSearch/JamlSpeedometer/JamlAestheticSelectorsurface the oldJamlViewwas built on, and also droppedsetJamlAssetBaseUrl(still imported inApp.tsx).Search.scoreListin favor of theSearch.settings(jaml).with…().start(token)builder.Uint8Array.fromBase64. That method is a recent TC39 proposal and isundefinedin Node 22 and most shipping browsers, somotely.boot()threw before a single seed was searched.What this does
motely-wasm→^26.0.0,jaml-ui→^4.6.0.src/modules/uint8Base64Polyfill.ts(guarded — no-ops where the engine is native), imported first inmain.jsxso it's present before boot.JamlViewon the motely-wasm 26 API directly: boot once, subscribe toSearch.onScored/Search.onProgress, and driveSearch.settings(jaml).withProgressReportIntervalMs().withRandomSearch()|withSequentialSearch().stopAfter().start(token). UsesJamlIdefor authoring, a Mantine sidebar for search scope + live speed/progress, and a local cancel token (the package-rootCancellationTokenexport collides between two submodules).setJamlAssetBaseUrlcall; importjaml-ui/fonts.css+jaml-ui/jimbo.css..npmrcwithlegacy-peer-deps=truefor the motely-wasm 26 / jaml-ui peer range.Single-threaded embedded engine — no SharedArrayBuffer, no COEP, no COI service worker.
Verification
npm run build✓eslintclean on changed files ✓Y3VFTX89,RL71NQBS) ✓🤖 Generated with Claude Code
https://claude.ai/code/session_01Jw8Fz76cjSbxhBjhGohfBG
Generated by Claude Code