test: strip absolute repo root from expect snapshots#37
Merged
Conversation
The previous PR (#36) merge landed but 14 of 861 tests fail on CI because expect snapshots in executor_test.mbt / lib_test.mbt / compat_docs_test.mbt baked in the developer's local absolute path (`/Users/mz/ghq/github.com/mizchi/actrun/_build/...`). On the CI runner the path is `/home/runner/work/actrun/actrun/_build/...` or `/Users/runner/work/actrun/actrun/_build/...`, so the diff is verbatim: -"/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/..." +"/home/runner/work/actrun/actrun/_build/test-workspaces/..." Fix: add `executor_test_strip_repo_root(s)` that replaces the `$PWD` prefix with the placeholder `<repo>`, and wrap every affected `debug_inspect`'s first arg with it (17 call sites across 3 files). Expect content updated to use `<repo>/_build/...`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two pre-existing failures uncovered alongside the path-strip fix in this PR — neither related to the test snapshots, but both need to go in for the branch to be CI-green: 1. nix-build (`flake.nix` / `package.nix` reference `./moon.mod.json`, which the MoonBit fmt-driven migration in 7405811 deleted in favor of `moon.mod`). moonbit-overlay's `buildMoonPackage.nix` still reads `moonModJson` via `builtins.readFile`, so it errors with `Path 'moon.mod.json' does not exist`. Fix: restore `moon.mod.json` (kept in sync with the current `moon.mod`). Dual-maintenance is the cheapest path until the overlay supports the new TOML format. Tracked there: https://github.com/moonbit-community/moonbit-overlay 2. compat-wasi-gha — sidecar `dist/index.js` uses CommonJS (`require("node:fs")`), but the root `package.json` has `"type": "module"`, so Node treats every `.js` under the repo as ESM and throws `ReferenceError: require is not defined in ES module scope`. Fix: a one-line local `package.json` in `.github/actions/wasi-node-sidecar/dist/` with `"type": "commonjs"`. Scopes the CJS interpretation to this prebuilt artifact without touching the root project's ESM policy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop a local `package.json` with `"type": "commonjs"` next to the
sidecar's `dist/index.js` so it's interpreted as CJS regardless of
the root project's `"type": "module"`. Needed because the
prebuilt sidecar uses `require("node:fs")`, and without this scope
override compat-wasi-gha fails with
`ReferenceError: require is not defined in ES module scope`.
`-f` because `dist/` is gitignored but the sidecar's compiled
artifacts are tracked the same way (existing index.js / index.wasm
are also under the same exemption).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The pinned moonbit-overlay (50118f5 / 2026-03-31) shipped a moonc that rejects the type-inference-friendly `with fn output(self, logger)` syntax produced by the current `moon fmt`: Error: Missing type annotation for the parameter self. Error: Missing type annotation for the parameter logger. Local moonc accepts it; nix-build doesn't because the toolchain is older. Bumping the overlay to d7386ba (2026-05-26) pulls in a moonc that matches the local one and the build goes green. Verified locally with `nix build .#actrun` — succeeds end-to-end (only the standard uncommitted-changes warning, no errors). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
PR #36 が無事 merge されたものの、 main の CI で 14 件のテストが失敗。 原因は `executor_test.mbt` / `lib_test.mbt` / `compat_docs_test.mbt` の `debug_inspect` の expect 文字列に開発者のローカル絶対パスがハードコードされていたこと。
```diff
-"/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/..."
+"/home/runner/work/actrun/actrun/_build/test-workspaces/..."
```
修正内容
影響範囲
残課題 (本 PR の scope 外)
🤖 Generated with Claude Code