| id | 2606110517 | |
|---|---|---|
| title | tinygo wasm build under the 8 MiB budget | |
| status | ✅ | |
| model | sonnet | |
| summary | Make `tinygo build -target wasm ./cmd/mdsmith-wasm` succeed and fit the plan-215/218 ≤ 8 MiB budget by isolating the four standard-library calls tinygo's wasm target lacks — os.Chmod, os.SameFile, os.Symlink, filepath.EvalSymlinks — behind build-tagged seams per package, then un-skip the size budget test and flip the CI tinygo-wasm job to enforcing. | |
| depends-on |
|
Make tinygo build -target wasm ./cmd/mdsmith-wasm compile. The
artifact must fit the plan-215/218 budget of 8 MiB.
This is the one remaining criterion from
plan 240. Dropping cuelang.org/go
cleared two earlier walls. The sync.Map.CompareAndDelete swap
cleared a third. The tinygo build still fails.
The failure is not size. It is four standard-library calls tinygo's wasm target does not implement. Each one is reached transitively from pkg/mdsmith.
The real build attempt under tinygo 0.39.0 named this inventory:
os.Chmod— internal/schema/index.go:231, internal/fix/fix.go:689, and internal/githooks.os.SameFile— internal/githooks.os.Symlinkandfilepath.EvalSymlinks— internal/schema, internal/lsp, and the cross-file rules.
The standard GOOS=js wasm path must stay unchanged. Only the
tinygo build needs the seams.
-
Add a build-tagged seam per package for each missing call. A non-tinygo file keeps the current body. A tinygo file supplies the variant. Pick the variant semantics per call site.
-
For
os.Chmodon a freshly written index or fixed file, the tinygo variant is a no-op. The wasm host has no POSIX mode bits. Skipping the chmod degrades nothing the engine reads back. -
For
os.SameFileand the symlink calls in internal/githooks, the tinygo variant degrades. The hook-install path is not reachable from the wasm surface. The variant returns a "not supported" error. -
For
os.Symlinkandfilepath.EvalSymlinksin internal/schema, internal/lsp, and the cross-file rules, the tinygo variant skips symlink resolution. The wasm sandbox has no symlinks. An identity resolution is correct there. -
Un-skip
TestTinyGoWASMArtifactSizeBudgetin cmd/mdsmith-wasm/size_test.go. Replace the known-failure skip with the size assertion againstmaxTinyGoWASMBytes. -
Flip the
tinygo-wasmjob in .github/workflows/ci.yml to enforcing. Removecontinue-on-error: true. Remove the comment that points here. -
Update the engine-api page and plan 218. Record the tinygo build as CI-verified, not scheduled.
-
tinygo build -target wasm ./cmd/mdsmith-wasmsucceeds with tinygo 0.39.0. - The tinygo artifact is at or under 8 MiB.
TestTinyGoWASMArtifactSizeBudgetasserts it rather than skipping. - The standard
GOOS=jswasm build is unchanged.TestWASMArtifactSizeBudgetstill passes. - The CI
tinygo-wasmjob enforces the build. A regression fails the PR. - No call site loses its standard-library behaviour on a non-tinygo build.
- Plan 240, plan 218, and the engine-api page read truthfully. The tinygo build is verified, not pending.
-
go test ./...andgo run ./cmd/mdsmith check .pass.