build: follow moonbit 0.10.13 and moonbitlang/async 0.22, update all deps - #179
Conversation
Bump every third-party dependency to its latest release and adapt the code to the toolchain and async API changes that broke the build: - moonbitlang/async 0.19.4 -> 0.22.1, moonbitlang/x 0.4.40 -> 0.5.5, bobzhang/toml 0.1.7 -> 0.4.3, mizchi/x 0.2.0 -> 0.6.1, mizchi/zlib 0.4.8 -> 0.4.9, mizchi/simd 0.4.1 -> 0.6.1, mizchi/llm 0.2.2 -> 0.3.2 (the old moonbitlang/x and toml releases no longer compile on the current compiler). - @http keys headers by CaseInsensitiveString: convert bit's plain String header maps at the transport boundary (bit_io_native, bit serve). - @fs.read_dir now returns an ArrayView: materialise it in the three RepoFileSystem::readdir implementations. - moonbitlang/core/strconv is empty now; use @string.parse_int / parse_int64 and drop the dead imports. - async cancellation is no longer an error and cannot be caught, so the `err if @async.is_cancellation_error(err) => raise err` guards are dead code (the function is deprecated and always returns false). Remove them and keep only the is_being_cancelled() checks. - Pin CI to the 0.10.13 compiler and bump the component pins to match. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
`pkf run check` runs moon check with --deny-warn, and the new compiler
adds a `fragile_catch_all` lint for `catch { err => raise err }` and for
cleanup done inside a catch-all handler (which no longer sees async
cancellation). Drop the 60 pure re-raise handlers, move the three
temp-dir / client cleanups to `errdefer`, and fix the fallout:
- two merge-state cleanup helpers no longer raise, so drop `raise Error`
- `@async.sleep` cannot fail any more, so the test doubles in
lfs_client_wbtest stop catching it
- bit_archive and bit_fast_import imported the now-empty strconv package
moon check --deny-warn --warn-list=-27-20-82 passes for native, js and
wasm.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
moonc 0.10.13's link-core pass overflows the default 8 MiB stack while building the debug configuration of modules/bit (an ICE reporting "Stack overflow"); the same step succeeds with `ulimit -s unlimited`, and the release build is unaffected. Apply that in the cmd-native-test job, which builds and tests cmd/bit in debug, and note it in AGENTS.md. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
moonc now emits `import` statements for the `#module("node:fs")` FFI
bindings that moonbitlang/x 0.5 uses, so the JS build of modules/bit is
an ES module and can no longer be loaded with `require` as bit.cjs
(js-build failed with "Cannot use import statement outside a module").
Copy the payload to npm/bit.mjs instead and import it from the ESM
wrapper (bit.js) and the bin script; update package.json exports/files,
.gitignore and the pkf task name (sync-npm-bit-mjs) to match.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
|
nix-build is red and I cannot fix it from this session. The job fails inside the moonbit-overlay dependency resolver with
Required fix, to be run by someone with Everything else on this PR is unaffected by the lock file. Generated by Claude Code |
The tree-shaken minimal lib bundle grew from ~163.5k to 174,458 raw / 40,265 gzip bytes with the new toolchain and dependency releases (moonbitlang/x 0.5, async 0.22); the exported surface is unchanged. Raise the raw and gzip ceilings to 180k / 44k, keeping the same kind of headroom the previous bumps left. The minimal/git-ops ratio guards are untouched (now 0.56 raw, 0.54 gzip against a 0.70 ceiling). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
|
cmd-native-test (cmd-bit-1) is red on The shard fails 2/242 on this branch:
The last CI run on Generated by Claude Code |
CLAUDE.md is a symlink to AGENTS.md, so the note was appended twice. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
The locked mooncakes index (2026-08-12) predates bobzhang/toml 0.4.3 and moonbitlang/async 0.22.1, so nix-build failed resolving the new dependency pins (`attribute '"0.4.3"' missing`). Advance moon-registry to today's index and moonbit-overlay to its current HEAD, which ships the v0.10.13+cbb11c36f toolchain the rest of CI is pinned to. moon-registry was relocked with `nix flake update`. The overlay entry was written from `nix flake prefetch` of the same revision over git (the sandbox blocks GitHub tarball downloads); the tree has no export attributes, so the NAR hash is the one the github fetcher produces. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
The new moonbit-overlay revision locks nixpkgs a831408e and treefmt-nix 27b3b12a; mirror them in the nested lock nodes so `nix build` does not have to rewrite flake.lock in CI. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv
|
Update on nix-build: Generated by Claude Code |
`git grep --column -o` prints one line per match, and each line carries the column where that match starts. bit added up the *ends* of the preceding matches instead, which double-counts the gap in front of every match after the first: on `foo_mmap bar mmap` the second match starts at column 14 and bit printed 13. Upstream git had the same bug and fixed it in "grep: fix --column --only-match for 2nd and later matches" (René Scharfe, 2026-04), shipped in 2.55 — the release `third_party/git` pins. It computes `cno = bol - start + match.rm_so + 1`; tracking the offset of the unscanned remainder and adding the match's own start column is the same thing. `grep: command path cases stay compatible` shells out to the system git, so its expectation had been captured from a pre-fix git, and the shard has been failing ever since the runners moved to 2.55. It fails the same way on `main`, unrelated to this branch's dependency bump. Verified with the native debug binary, with GIT_CONFIG_* unset so the shim does not delegate to the system git (2.43 here, still pre-fix): `bit grep --column -n -o -e mmap HEAD` now reports 5 and 14 on `foo_mmap bar mmap` and 3 and 8 on `abmmapXmmap` — the true columns — where it printed 13 and 9 before. `moon check --deny-warn --warn-list=-27-20-82 --target native` passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0134zgvUroAxAAggLS9yufPX
`serve --http: a repository resolves under the root` asserted that
`http_resolve_repo("/srv/git", "/acme/app.git")` strips the suffix and
answers `/srv/git/acme/app`. It never did: the resolver hands the path to
`normalize_repo_root`, which folds a trailing `/.git` — a working copy's
git directory — to the work tree that holds it, and leaves `<name>.git`
alone.
Leaving it alone is the point. A bare repository *is* the directory
`acme/app.git`, so stripping the suffix would make the normal server
layout unreachable; `bit upload-pack`, `receive-pack` and
`upload-archive` read a `.git` suffix the same way, and
docs/scalable-git-server.md records the route as verbatim ("Repository
paths are used verbatim, never percent-decoded").
So the expectation was wrong, not the resolver, and it never passed:
neither function has changed since the test landed in dd09350, whose own
message notes the end-to-end run had not been executed yet. Assert what
the listener implements, and add the `/<repo>/.git` case that
`normalize_repo_root` does fold.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0134zgvUroAxAAggLS9yufPX
|
The two
Verified locally with the native debug binary,
Generated by Claude Code |
A minor bump: every workspace module, its intra-workspace dependency pins, `bit_version_tag` and `npm/package.json` move from 0.46.4 to 0.47.0 together, the way the previous releases did. Since v0.46.4, `main` gained new capability rather than fixes alone, which is what makes this a minor and not a patch: - `bit serve --http`, a real listener for the Git smart protocol over many repositories (#178), with protocol v2 `ls-refs` on the upload-pack side and side-band-64k framing on receive-pack. - The object-storage layer underneath it: `bit_objstore` with compare-and-swap writes, a write-ahead log over it, and an S3 transport plus response headers and DELETE in `bit_io_native`. - The toolchain move to MoonBit 0.10.13 / moonbitlang/async 0.22 with every third-party dependency at its latest release (#179), which changed the npm CLI payload to an ES module. - A deprecation-free tree: `moon check` now reports no warnings on native, js or wasm (#180). `moon check` passes for native, js and wasm after the bump — the intra-workspace pins resolve consistently — and the JS build reports `git version 2.47.0 (bit v0.47.0)`. Publishing is left to the maintainer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0134zgvUroAxAAggLS9yufPX
Summary
The workspace no longer built on the current MoonBit toolchain (0.1.20260915 / moonc 0.10.13): the pinned
moonbitlang/x@0.4.40andbobzhang/toml@0.1.7fail to compile, andmoonbitlang/asyncchanged its HTTP header and cancellation APIs. This PR updates every third-party dependency to its latest release and adapts the code.Dependency bumps (
modules/*/moon.mod,component/moon.mod.json)mizchi/tempfile,mizchi/libgit2andmizchi/experimental_cryptowere already at their latest release.Code changes
@httpnow keys request/response headers byCaseInsensitiveString. bit keeps plainStringmaps in its transport-neutral interfaces and converts at the boundary (bit_io_native/http_client_native.mbt,cmd/bit/serve_http.mbt).@fs.read_dirreturns anArrayView; the threeRepoFileSystem::readdirimpls materialise it.moonbitlang/core/strconvis empty now;parse_int/parse_int64come from@string. Dead imports removed.@async.is_cancellation_erroris deprecated (it always returnsfalse). The 123err if @async.is_cancellation_error(err) => raise errguards are therefore dead code and were removed; theis_being_cancelled()checks stay.fragile_catch_alllint (new in this compiler, and fatal underpkf run check's--deny-warn): removed the 60 pure re-raisecatch { err => raise err }handlers and moved the three cleanup-in-catch sites (bit cat,bit treetemp dirs, HTTP client close) toerrdefer, which also makes them run on cancellation.importstatements for the#module("node:fs")FFI bindings that moonbitlang/x 0.5 uses, so the JS build ofmodules/bitcan no longer berequired asbit.cjs. It is now copied tonpm/bit.mjs;npm/bit.jsre-exports it andnpm/bin/bit.mjsimports it.package.jsonexports/files,.gitignoreand the pkf task (sync-npm-bit-mjs) follow.tools/verify-lib-js-treeshake.mjs; the minimal/git-ops ratio guards are unchanged and still hold (0.56 raw, 0.54 gzip vs 0.70).setup-moonbitaction now pins0.10.13+cbb11c36f(the old pin cannot compile the new dependency releases).Error: Stack overflow) when buildingmodules/bitin the debug configuration under the default 8 MiB stack. The same step succeeds withulimit -s unlimited, and the release build is unaffected. Thecmd-native-testjob now lifts the limit before building/testing, and AGENTS.md documents it.flake.lockrefreshed for nix-build:moon-registryadvanced to today's mooncakes index (the 2026-08-12 one lackedbobzhang/toml@0.4.3andmoonbitlang/async@0.22.1, failing withattribute '"0.4.3"' missing), andmoonbit-overlayto its current HEAD (86fff168, ships the v0.10.13+cbb11c36f toolchain) together with the nixpkgs/treefmt-nix pins from the overlay's own lock. The overlay entry was hashed withnix flake prefetchover git because the sandbox blocks GitHub tarball downloads; the tree has no export attributes, so it is the hash thegithub:fetcher yields.cmd-bit-1test failures fixed (93e8778, 44b919f), so the shard is green for the first time in a while:bit grep --column -ogave every match after the first a column that summed the preceding matches' ends — the same bug git fixed upstream in "grep: fix --column --only-match for 2nd and later matches" (2.55, the releasethird_party/gitpins) — andserve --http: a repository resolves under the rootasserted a.gitsuffix strip thathttp_resolve_reponever did and must not do, since a bare repository is the directoryacme/app.git.Verification
moon check --deny-warn --warn-list=-27-20-82(whatpkf run checkruns) passes for native, js and wasm (also green in CI'stestjob).moon build --target native --release modules/bitsucceeds;bit --versionruns.moon build --target native modules/bit(debug) succeeds withulimit -s unlimited; the resulting binary passes a smoke run (init,add, twocommits,status,log) and realgit fsck/git logread the repository cleanly.moon test --target nativefor every non-cmd workspace module plusmizchi/bit/tests: all pass (same loop as the CI full run; also green in CI'stestjob).moon test --target wasmfor bit_runtime, bit_diff3, bit_repo, bit_grep: pass.moon test --target js -p mizchi/bit -p mizchi/bit_lib: 361/363 pass. The two failures are the ssh-ed25519 signing tests, which shell out tossh-keygen; it is not installed in this sandbox (ssh-keygen failed with status null). They should pass on the CI runner.moon build --target js --releasefor bit_lib and bit, bun bundles,node --test tools/js-build.test.mjs tools/npm-lib.test.mjs tools/npm-cli.test.mjs): 5/5 pass; CI's js-build is green.nix flake metadata(with the overlay resolved over git) reports no pending lock changes. A full localnix buildwas not possible: the sandbox blocks the GitHub tarball downloads the other flake inputs need, so CI's nix-build is the check.node tools/check-layers.mjsandtools/check-layer-guards.shpass.grep --column -ofix was checked against the native debug binary withGIT_CONFIG_*unset (otherwise the shim delegates to the system git):foo_mmap bar mmapnow reports columns 5 and 14,abmmapXmmap3 and 8 — the true columns, where it printed 13 and 9 before.44b919f.Not done / follow-ups
@sys.get_env_var→@env,StringBuilder::new()→StringBuilder(), ~1.5k sites) are warning-only and left as is.🤖 Generated with Claude Code
https://claude.ai/code/session_018UDsHQQ4RZzjsqix2HYGBv