Skip to content

[Goal #349] Add Rust/WASM acceleration coverage for core functions #355

Description

@github-actions

Goal

Add a Rust/WASM acceleration layer for eligible tsb core functions (searchsorted, natsort), with full coverage manifest, parity tests, and benchmarks.

Closes / tracks: #349

What was added

Rust crate (rust/)

  • Cargo.toml — wasm-bindgen + js-sys, wasm-opt disabled for portability
  • src/searchsorted.rssearchsorted_f64, searchsorted_many_f64, argsort_f64, searchsorted_str, searchsorted_many_str, argsort_str (15 Rust unit tests)
  • src/natsort.rsnat_compare, nat_sorted, nat_argsort (natural sort, mirrors TS algorithm exactly)
  • pkg/ — pre-built WASM output (wasm-pack --target nodejs)

TypeScript glue (src/wasm/)

  • types.tsTsbWasmModule interface (authoritative API contract, no as casts)
  • loader.ts — lazy WASM loader via createRequire; isTsbWasmModule type guard uses Reflect.get pattern
  • accelerated.ts — public wrappers for all 6 functions with TS fallbacks
  • index.ts — public module index

Coverage manifest

  • wasm-coverage.json — 121-entry manifest (6 rust-wasm, 115 ts-only-ineligible, 0 unclassified, 0 eligible_missing)

Tests & benchmarks

  • tests/wasm/parity.test.ts — 35 parity tests (all passing)
  • benchmarks/wasm-core/run.ts — benchmark runner
  • benchmarks/results-wasm-core.json — benchmark results

Scripts (package.json)

  • wasm:buildwasm-pack build rust --target nodejs --out-dir pkg
  • wasm:test — Rust unit tests + TS parity tests
  • wasm:coverage — validates coverage manifest
  • bench:wasm-core — runs benchmarks and writes JSON

Config

  • biome.json — added rust/** and scripts/** to ignore list
  • scripts/wasm-coverage-check.ts — manifest validator

Completion Contract Evidence

Check Result
bun run wasm:test ✅ 35/35 parity tests pass
bun run wasm:coverage ✅ 0 unclassified, 0 eligible_missing
bun run bench:wasm-core ✅ 8 benchmarks, results-wasm-core.json written
bun run lint ✅ 0 errors (628 warnings, down from baseline 117 errors)
bun run typecheck ✅ No errors
Coverage manifest ✅ 121 entries: 6 rust-wasm, 115 ts-only-ineligible

Remaining work

None — all completion contract checks pass. Awaiting maintainer review and merge.


Run URL: https://github.com/githubnext/tsb/actions/runs/28274237232

This PR is maintained by the Goal workflow. Each run may add commits to the same branch.


Warning

Protected Files — Push Permission Denied

This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.

Protected files
  • package.json

The push was rejected because GitHub Actions does not have workflows permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.

Create the pull request manually
# Download the patch from the workflow run
gh run download 28274237232 -n agent -D /tmp/agent-28274237232

# Create a new branch
git checkout -b goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-28274237232/aw-goal-349-goal-add-rust-wasm-acceleration-coverage-for-core-functions.patch

# Push the branch and create the pull request
git push origin goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions
gh pr create --title '[Goal #349] Add Rust/WASM acceleration coverage for core functions' --base main --head goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions --repo githubnext/tsb

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Goal · 4.4K AIC · ⌖ 122 AIC · ⊞ 39.8K ·
Comment /goal to run again

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions