From 69c1c11c323647f752a06334c1dd6065215f823c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 13:14:38 +0000 Subject: [PATCH 1/4] fix(for-each-ref): accept upstream/push strip modifiers and strip signature for trailers (#86) t6300-for-each-ref.sh progress: 28 -> 13 failures (15 fixed, no regressions). Two fixes: 1. %(upstream:...) / %(push:...) argument validation rejected the ref-strip modifiers (lstrip=/strip=/rstrip=), the `nobracket` token, and comma-combined tokens like `track,nobracket`, even though the renderer already handled them. Validation now splits the argument on commas and accepts each token, matching git. Fixes t6300 cases 20-25, 28-33, 238, 239. 2. The %(trailers) / %(contents:trailers) atoms parsed trailers from the full message including the PGP/SSH signature block, so signed tags emitted the signature body as bogus trailers. Trailer parsing now runs on the message with the signature stripped (lines before the signature armor), matching git. Fixes t6300 case 411. Remaining t6300 failures are separate features: GPG %(signature) verification (420-428), the describe atom algorithm (252, 255, 256), and GPG-signed body/CRLF edge cases (317, 409). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM --- modules/bit/src/cmd/bit/for_each_ref.mbt | 57 +++++++++++++++++------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/modules/bit/src/cmd/bit/for_each_ref.mbt b/modules/bit/src/cmd/bit/for_each_ref.mbt index 5059a907..16be3161 100644 --- a/modules/bit/src/cmd/bit/for_each_ref.mbt +++ b/modules/bit/src/cmd/bit/for_each_ref.mbt @@ -1009,24 +1009,40 @@ async fn for_each_ref_validate_atom(atom : String) -> Unit { @sys.exit(1) } } - // Validate upstream/push arguments + // Validate upstream/push arguments. The argument may be a comma-separated + // list of tokens (e.g. "track,nobracket"); each token is a simple option or + // a ref-stripping modifier (lstrip=/strip=/rstrip=), mirroring git. if atom.has_prefix("upstream:") { let arg = String::unsafe_substring(atom, start=9, end=atom.length()) - match arg { - "short" | "track" | "trackshort" | "remotename" | "remoteref" => () - _ => { - eprint_line("fatal: unrecognized %(upstream) argument: " + arg) - @sys.exit(1) + for tok_view in arg.split(",") { + let tok = tok_view.to_owned() + match tok { + "short" | "track" | "trackshort" | "nobracket" | "remotename" + | "remoteref" => () + _ if tok.has_prefix("lstrip=") || + tok.has_prefix("strip=") || + tok.has_prefix("rstrip=") => () + _ => { + eprint_line("fatal: unrecognized %(upstream) argument: " + arg) + @sys.exit(1) + } } } } if atom.has_prefix("push:") { let arg = String::unsafe_substring(atom, start=5, end=atom.length()) - match arg { - "short" | "track" | "trackshort" | "remotename" | "remoteref" => () - _ => { - eprint_line("fatal: unrecognized %(push) argument: " + arg) - @sys.exit(1) + for tok_view in arg.split(",") { + let tok = tok_view.to_owned() + match tok { + "short" | "track" | "trackshort" | "nobracket" | "remotename" + | "remoteref" => () + _ if tok.has_prefix("lstrip=") || + tok.has_prefix("strip=") || + tok.has_prefix("rstrip=") => () + _ => { + eprint_line("fatal: unrecognized %(push) argument: " + arg) + @sys.exit(1) + } } } } @@ -4081,6 +4097,17 @@ async fn for_each_ref_commit_atom( } else { "" } + // Message with the signature block removed (lines before sig_start). Trailer + // parsing must ignore the signature, matching git which strips it first. + let no_sig_parts : Array[String] = [] + for i = 0; i < sig_start; i = i + 1 { + no_sig_parts.push(message_lines[i]) + } + let message_no_sig = if no_sig_parts.length() > 0 { + no_sig_parts.join("\n") + } else { + "" + } // Determine which ident to use for creator* atoms let creator = if tagger.length() > 0 { tagger @@ -4328,17 +4355,17 @@ async fn for_each_ref_commit_atom( lines.join("\n") } } - "trailers" => for_each_ref_format_trailers_atom(atom, raw_message) + "trailers" => for_each_ref_format_trailers_atom(atom, message_no_sig) _ if atom.has_prefix("trailers:") => - for_each_ref_format_trailers_atom(atom, raw_message) + for_each_ref_format_trailers_atom(atom, message_no_sig) "contents:trailers" => { let trailer_atom = "trailers" - for_each_ref_format_trailers_atom(trailer_atom, raw_message) + for_each_ref_format_trailers_atom(trailer_atom, message_no_sig) } _ if atom.has_prefix("contents:trailers:") => { let trailer_atom = "trailers" + String::unsafe_substring(atom, start=17, end=atom.length()) - for_each_ref_format_trailers_atom(trailer_atom, raw_message) + for_each_ref_format_trailers_atom(trailer_atom, message_no_sig) } _ if atom.has_prefix("contents:") => { let arg = String::unsafe_substring(atom, start=9, end=atom.length()) From 9c699ca4c98d231d63243bc1446bde3aaefea3dc Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 16:16:17 +0000 Subject: [PATCH 2/4] ci: pin MoonBit toolchain via cache + fix $|/#| mixed string lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second bleeding-edge toolchain break after the async [3002] one: the newest MoonBit compiler added syntax_lint [0063], which errors under `moon check --deny-warn` when a multi-line string literal mixes `$|` and `#|` prefixes. CI installs the toolchain via `curl ... | bash` (always latest), so this broke the `test` job on main and every PR. Two changes: 1. upload_pack_process.mbt: the partial-clone config template mixed `#|` (static) and `$|` (interpolated) lines in one literal. Converted all lines to `$|`; the static lines contain no backslash/`\{`, so the emitted config is byte-identical. Verified with `moon build --target native`. 2. Pin the toolchain. MoonBit's installer only fetches `latest`/`nightly` (cli.moonbitlang.com returns 403 for version strings — no real pinning), so a new composite action `.github/actions/setup-moon` caches ~/.moon (toolchain only; `moon update` still refreshes the registry) keyed by a `pin` marker. The toolchain is frozen to whatever was current when `pin` was last bumped; bump it to upgrade intentionally. Wired into every Unix install across ci/js-build/pages-demo/git-compat-random/copilot-setup/ release. The Windows install and nix-build (already overlay-pinned) are unchanged. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM --- .github/actions/setup-moon/action.yml | 33 +++++++++++++++++++ .github/workflows/ci.yml | 24 +++++--------- .github/workflows/copilot-setup-steps.yml | 6 ++-- .github/workflows/git-compat-random.yml | 6 ++-- .github/workflows/js-build.yml | 6 ++-- .github/workflows/pages-demo.yml | 6 ++-- .github/workflows/release.yml | 6 ++-- .../bit_io/src/native/upload_pack_process.mbt | 20 +++++------ 8 files changed, 61 insertions(+), 46 deletions(-) create mode 100644 .github/actions/setup-moon/action.yml diff --git a/.github/actions/setup-moon/action.yml b/.github/actions/setup-moon/action.yml new file mode 100644 index 00000000..b5649b11 --- /dev/null +++ b/.github/actions/setup-moon/action.yml @@ -0,0 +1,33 @@ +name: Setup MoonBit (pinned) +description: > + Install the MoonBit toolchain, pinned via an actions/cache key. MoonBit's + installer can only fetch `latest`/`nightly` (it has no version-pinning), so a + bleeding-edge release can break CI at any time (see #83: async [3002] and the + $|/#| syntax_lint [0063]). Caching ~/.moon freezes the toolchain to whatever + was current when `pin` was last bumped; bump `pin` to intentionally upgrade. +inputs: + pin: + description: Toolchain pin marker. Bump this string to pull a newer toolchain. + required: false + default: "2026-06-22" +runs: + using: composite + steps: + - name: Restore MoonBit toolchain cache + id: moon-cache + uses: actions/cache@v4 + with: + # Cache the toolchain only (binaries + bundled core), not the registry + # index — `moon update` still refreshes ~/.moon/registry every run. + path: | + ~/.moon/bin + ~/.moon/lib + ~/.moon/include + key: moon-toolchain-${{ runner.os }}-${{ inputs.pin }} + - name: Install MoonBit CLI + if: steps.moon-cache.outputs.cache-hit != 'true' + shell: bash + run: curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + - name: Add MoonBit to PATH + shell: bash + run: echo "$HOME/.moon/bin" >> "$GITHUB_PATH" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4677cef..b333e3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,8 @@ jobs: uses: mizchi/pkspec@v0.2.1 with: pkl-version: none - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update - name: pkf run check @@ -88,10 +86,8 @@ jobs: uses: mizchi/pkspec@v0.2.1 with: pkl-version: none - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update - name: Build native binary for wbtests @@ -127,10 +123,8 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update - name: Distributed tests @@ -180,10 +174,8 @@ jobs: cd third_party/git make -j$(nproc) - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 6f8811a5..2741bacc 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,10 +29,8 @@ jobs: - name: Checkout code uses: actions/checkout@v5 - - name: Set up MoonBit - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> $GITHUB_PATH + - name: Set up MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Update MoonBit dependencies run: | diff --git a/.github/workflows/git-compat-random.yml b/.github/workflows/git-compat-random.yml index 27563b95..13bf87fb 100644 --- a/.github/workflows/git-compat-random.yml +++ b/.github/workflows/git-compat-random.yml @@ -74,11 +74,9 @@ jobs: if: ${{ steps.shard_guard.outputs.should_run == 'true' }} uses: mizchi/pkfire@v0 - - name: Install MoonBit CLI + - name: Setup MoonBit (pinned toolchain) if: ${{ steps.shard_guard.outputs.should_run == 'true' }} - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + uses: ./.github/actions/setup-moon - name: Build git from source if: ${{ steps.shard_guard.outputs.should_run == 'true' }} diff --git a/.github/workflows/js-build.yml b/.github/workflows/js-build.yml index efec590b..b7e2a439 100644 --- a/.github/workflows/js-build.yml +++ b/.github/workflows/js-build.yml @@ -34,10 +34,8 @@ jobs: with: bun-version: 1.3.5 - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update diff --git a/.github/workflows/pages-demo.yml b/.github/workflows/pages-demo.yml index 657c116e..55240fde 100644 --- a/.github/workflows/pages-demo.yml +++ b/.github/workflows/pages-demo.yml @@ -56,10 +56,8 @@ jobs: with: bun-version: 1.3.5 - - name: Install MoonBit CLI - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + - name: Setup MoonBit (pinned toolchain) + uses: ./.github/actions/setup-moon - name: Moon update run: moon update diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a26a1663..a6379a6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,11 +27,9 @@ jobs: with: submodules: true - - name: Install MoonBit CLI (Unix) + - name: Setup MoonBit (pinned toolchain, Unix) if: runner.os != 'Windows' - run: | - curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + uses: ./.github/actions/setup-moon - name: Install MoonBit CLI (Windows) if: runner.os == 'Windows' diff --git a/modules/bit_io/src/native/upload_pack_process.mbt b/modules/bit_io/src/native/upload_pack_process.mbt index bd5676ce..c54693c6 100644 --- a/modules/bit_io/src/native/upload_pack_process.mbt +++ b/modules/bit_io/src/native/upload_pack_process.mbt @@ -1325,19 +1325,19 @@ fn write_partial_clone_metadata( let filter_value = filter.to_string() let config_path = @bit.join_path(git_dir, "config") let config = - #|[core] - #| repositoryformatversion = 1 - #| filemode = true - #| bare = false - #| logallrefupdates = true - #|[extensions] - #| partialclone = origin + $|[core] + $| repositoryformatversion = 1 + $| filemode = true + $| bare = false + $| logallrefupdates = true + $|[extensions] + $| partialclone = origin $|[remote "origin"] $| url = \{remote} - #| fetch = +refs/heads/*:refs/remotes/origin/* - #| promisor = true + $| fetch = +refs/heads/*:refs/remotes/origin/* + $| promisor = true $| partialclonefilter = \{filter_value} - #| + $| fs.write_string(config_path, config) let packed_refs_path = @bit.join_path(git_dir, "packed-refs") fs.write_string(packed_refs_path, "# pack-refs with: peeled fully-peeled\n") From 52841d05dd111d1bf7b7332c647e1b584655fdcd Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 17:26:20 +0000 Subject: [PATCH 3/4] ci(setup-moon): pin toolchain via nix overlay instead of latest+cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The curl-installer + actions/cache approach could only freeze "latest at first run", which captured 0.1.20260618 — a build whose `moon test` changed the working directory and broke bit_pack's repo-root-relative fixtures (6/72 failures). MoonBit's installer cannot fetch a specific version (cli.moonbitlang.com serves only latest/nightly). Switch setup-moon to install the toolchain from moonbit-overlay pinned to rev 96727d9, which provides moon 0.1.20260608 — the last build before the CWD regression. Verified locally (via nix profile install of that rev): `moon build --target native` is clean and `moon test -p mizchi/bit_pack` passes 72/72. The action reuses the existing setup-nix (Nix install + store cache) and adds ~/.nix-profile/bin to PATH. Bump `overlay-rev` to upgrade the toolchain deliberately after re-validation. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM --- .github/actions/setup-moon/action.yml | 50 +++++++++++++-------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/actions/setup-moon/action.yml b/.github/actions/setup-moon/action.yml index b5649b11..36465960 100644 --- a/.github/actions/setup-moon/action.yml +++ b/.github/actions/setup-moon/action.yml @@ -1,33 +1,31 @@ -name: Setup MoonBit (pinned) +name: Setup MoonBit (pinned via nix overlay) description: > - Install the MoonBit toolchain, pinned via an actions/cache key. MoonBit's - installer can only fetch `latest`/`nightly` (it has no version-pinning), so a - bleeding-edge release can break CI at any time (see #83: async [3002] and the - $|/#| syntax_lint [0063]). Caching ~/.moon freezes the toolchain to whatever - was current when `pin` was last bumped; bump `pin` to intentionally upgrade. + Provide the MoonBit toolchain from moonbit-overlay, pinned to a specific + revision. MoonBit's curl installer only fetches `latest`/`nightly` (no + version pinning, see cli.moonbitlang.com returning 403 for version strings), + and bleeding-edge releases repeatedly broke CI: async [3002], the $|/#| + syntax_lint [0063], and the `moon test` working-directory change in + 0.1.20260618 that broke bit_pack's repo-root-relative fixtures. Pinning the + overlay rev freezes the toolchain to a known-good build; bump `overlay-rev` + (and re-validate) to upgrade intentionally. inputs: - pin: - description: Toolchain pin marker. Bump this string to pull a newer toolchain. + overlay-rev: + description: > + moonbit-overlay git revision whose `#default` toolchain is installed. + Default provides moon 0.1.20260608 (the last build before the + 0.1.20260618 moon-test CWD regression), verified to build the workspace + and pass `moon test`. required: false - default: "2026-06-22" + default: "96727d9f3962fffe8342713f94bd714f81a00c6b" runs: using: composite steps: - - name: Restore MoonBit toolchain cache - id: moon-cache - uses: actions/cache@v4 - with: - # Cache the toolchain only (binaries + bundled core), not the registry - # index — `moon update` still refreshes ~/.moon/registry every run. - path: | - ~/.moon/bin - ~/.moon/lib - ~/.moon/include - key: moon-toolchain-${{ runner.os }}-${{ inputs.pin }} - - name: Install MoonBit CLI - if: steps.moon-cache.outputs.cache-hit != 'true' + - name: Install Nix (with store cache) + uses: ./.github/actions/setup-nix + - name: Install pinned MoonBit toolchain shell: bash - run: curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash - - name: Add MoonBit to PATH - shell: bash - run: echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + run: | + nix profile install \ + --extra-experimental-features 'nix-command flakes' \ + "github:moonbit-community/moonbit-overlay/${{ inputs.overlay-rev }}#default" + echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH" From 6d46a38a69325a65b1951905db31d1943ca0d151 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 17:43:59 +0000 Subject: [PATCH 4/4] fix(bit_pack): resolve fixtures independent of moon test CWD; revert toolchain pin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit moon 0.1.20260618 changed the working directory `moon test` runs the native test binary from, so bit_pack's repo-root-relative "fixtures/*.pack" reads failed (6/72). Make read_fixture_bytes walk up parent directories until the fixture path resolves, so it works regardless of the test CWD (verified with moon 0.1.20260618: bit_pack 72/72). This removes the need to pin the toolchain (the nix-overlay pin was reverted: the overlay's native runtime is incomplete — `tcc: undefined symbol __mzerodf` breaks native tests like bitx_hub — and MoonBit's installer cannot fetch a specific known-good version). CI returns to the plain curl install of latest; the only remaining toolchain-compat change kept is the $|/#| lint fix. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM --- .github/actions/setup-moon/action.yml | 31 ------------------- .github/workflows/ci.yml | 24 +++++++++----- .github/workflows/copilot-setup-steps.yml | 6 ++-- .github/workflows/git-compat-random.yml | 6 ++-- .github/workflows/js-build.yml | 6 ++-- .github/workflows/pages-demo.yml | 6 ++-- .github/workflows/release.yml | 6 ++-- .../bit_pack/src/pack_index_write_test.mbt | 22 ++++++++++++- 8 files changed, 57 insertions(+), 50 deletions(-) delete mode 100644 .github/actions/setup-moon/action.yml diff --git a/.github/actions/setup-moon/action.yml b/.github/actions/setup-moon/action.yml deleted file mode 100644 index 36465960..00000000 --- a/.github/actions/setup-moon/action.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Setup MoonBit (pinned via nix overlay) -description: > - Provide the MoonBit toolchain from moonbit-overlay, pinned to a specific - revision. MoonBit's curl installer only fetches `latest`/`nightly` (no - version pinning, see cli.moonbitlang.com returning 403 for version strings), - and bleeding-edge releases repeatedly broke CI: async [3002], the $|/#| - syntax_lint [0063], and the `moon test` working-directory change in - 0.1.20260618 that broke bit_pack's repo-root-relative fixtures. Pinning the - overlay rev freezes the toolchain to a known-good build; bump `overlay-rev` - (and re-validate) to upgrade intentionally. -inputs: - overlay-rev: - description: > - moonbit-overlay git revision whose `#default` toolchain is installed. - Default provides moon 0.1.20260608 (the last build before the - 0.1.20260618 moon-test CWD regression), verified to build the workspace - and pass `moon test`. - required: false - default: "96727d9f3962fffe8342713f94bd714f81a00c6b" -runs: - using: composite - steps: - - name: Install Nix (with store cache) - uses: ./.github/actions/setup-nix - - name: Install pinned MoonBit toolchain - shell: bash - run: | - nix profile install \ - --extra-experimental-features 'nix-command flakes' \ - "github:moonbit-community/moonbit-overlay/${{ inputs.overlay-rev }}#default" - echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b333e3e6..b4677cef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,10 @@ jobs: uses: mizchi/pkspec@v0.2.1 with: pkl-version: none - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update - name: pkf run check @@ -86,8 +88,10 @@ jobs: uses: mizchi/pkspec@v0.2.1 with: pkl-version: none - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update - name: Build native binary for wbtests @@ -123,8 +127,10 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update - name: Distributed tests @@ -174,8 +180,10 @@ jobs: cd third_party/git make -j$(nproc) - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 2741bacc..6f8811a5 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,8 +29,10 @@ jobs: - name: Checkout code uses: actions/checkout@v5 - - name: Set up MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Set up MoonBit + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> $GITHUB_PATH - name: Update MoonBit dependencies run: | diff --git a/.github/workflows/git-compat-random.yml b/.github/workflows/git-compat-random.yml index 13bf87fb..27563b95 100644 --- a/.github/workflows/git-compat-random.yml +++ b/.github/workflows/git-compat-random.yml @@ -74,9 +74,11 @@ jobs: if: ${{ steps.shard_guard.outputs.should_run == 'true' }} uses: mizchi/pkfire@v0 - - name: Setup MoonBit (pinned toolchain) + - name: Install MoonBit CLI if: ${{ steps.shard_guard.outputs.should_run == 'true' }} - uses: ./.github/actions/setup-moon + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Build git from source if: ${{ steps.shard_guard.outputs.should_run == 'true' }} diff --git a/.github/workflows/js-build.yml b/.github/workflows/js-build.yml index b7e2a439..efec590b 100644 --- a/.github/workflows/js-build.yml +++ b/.github/workflows/js-build.yml @@ -34,8 +34,10 @@ jobs: with: bun-version: 1.3.5 - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update diff --git a/.github/workflows/pages-demo.yml b/.github/workflows/pages-demo.yml index 55240fde..657c116e 100644 --- a/.github/workflows/pages-demo.yml +++ b/.github/workflows/pages-demo.yml @@ -56,8 +56,10 @@ jobs: with: bun-version: 1.3.5 - - name: Setup MoonBit (pinned toolchain) - uses: ./.github/actions/setup-moon + - name: Install MoonBit CLI + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Moon update run: moon update diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6379a6c..a26a1663 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,9 +27,11 @@ jobs: with: submodules: true - - name: Setup MoonBit (pinned toolchain, Unix) + - name: Install MoonBit CLI (Unix) if: runner.os != 'Windows' - uses: ./.github/actions/setup-moon + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" - name: Install MoonBit CLI (Windows) if: runner.os == 'Windows' diff --git a/modules/bit_pack/src/pack_index_write_test.mbt b/modules/bit_pack/src/pack_index_write_test.mbt index 4f634b32..b4e5781f 100644 --- a/modules/bit_pack/src/pack_index_write_test.mbt +++ b/modules/bit_pack/src/pack_index_write_test.mbt @@ -1,8 +1,28 @@ ///| Pack index fixture tests (git index-pack output) +///| +/// Resolve a repo-root-relative fixture path independent of the test's working +/// directory. `moon test` does not guarantee the native test binary runs from +/// the repo root (this changed in moon 0.1.20260618, which broke the plain +/// "fixtures/..." reads), so walk up parent directories until the path exists. +fn resolve_fixture(path : String) -> String { + let mut prefix = "" + let mut i = 0 + while i < 32 { + let candidate = prefix + path + if @fs.path_exists(candidate) { + return candidate + } + prefix = prefix + "../" + i = i + 1 + } + path +} + ///| fn read_fixture_bytes(path : String) -> Bytes raise { - @fs.read_file_to_bytes(path) catch { + let resolved = resolve_fixture(path) + @fs.read_file_to_bytes(resolved) catch { e => fail("failed to read fixture: \{path} (\{e})") } }