Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3d94663
refactor: extract x-kv into separate mizchi/bitx_kv module (PoC)
claude May 26, 2026
699ecf8
refactor: extract all x-* extensions into bitx_* workspace modules
claude May 26, 2026
6f418c5
refactor: move main bit module into modules/bit/ for uniform layout
claude May 26, 2026
69e9e1a
refactor: fix build paths after module move
claude May 26, 2026
e6d499f
refactor: extract 12 leaf core packages into bit_* modules
claude May 26, 2026
af7a074
refactor: extract bit_object, bit_config, bit_pack (wave 2)
claude May 26, 2026
06d90ae
refactor: extract bit_types, bit_protocol, bit_reftable (wave 3)
claude May 26, 2026
270f4e4
refactor: extract bit_io, bit_refs (wave 4)
claude May 26, 2026
29e7680
refactor: extract bit_remote, bit_repo (wave 5)
claude May 26, 2026
be64970
refactor: extract mid layer modules pack_ops/repo_ops/worktree/diff (…
claude May 26, 2026
959ae3e
refactor: extract bit_vfs, bit_fingerprint, bit_grep, bit_runtime (wa…
claude May 27, 2026
7bf9684
refactor: extract bit_lib porcelain facade (wave 8)
claude May 27, 2026
ed7f84a
ci: fix js-build and nix-build after the workspace split
claude May 27, 2026
ef32860
ci: fix git-compat job build path
claude May 27, 2026
e316151
ci: raise native test timeout and enable parallelism
claude May 27, 2026
8c9844e
ci: split native test into per-module loop + dedicated cmd job
claude May 27, 2026
4449768
ci: shard cmd-native-test by package, give cmd/bit 120m
claude May 27, 2026
3abbd88
ci: clear stale moon lock before cmd-native-test run
claude May 28, 2026
fc95403
build(native): use clang for cmd/bit and cmd/git-bit native compilation
claude May 29, 2026
995fe34
nix: add clang to nativeBuildInputs for moon.pkg cc=clang
claude May 29, 2026
6b8ec40
ci: dynamic bit.exe path discovery + kill clang in lock-clear step
claude May 29, 2026
d597ee6
ci: remove x/agent references from distributed-test (packages dropped…
claude May 29, 2026
2a1dcec
fix(workspace): use ./ prefix in moon.work member paths for correct r…
claude May 29, 2026
b54aa35
fix: add missing deps and update test for depth param
claude May 29, 2026
84a79ea
revert: remove cc=clang from cmd/bit and cmd/git-bit moon.pkg
claude May 29, 2026
33ed150
fix: update hardcoded bit.exe path to workspace output path
claude May 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
109 changes: 87 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,94 @@ jobs:
run: pkf run check
- name: Build native binary for wbtests
run: |
moon build --target native --release
cp _build/native/release/build/cmd/bit/bit.exe tools/git-shim/moon
moon build --target native --release modules/bit/src/cmd/bit
cp _build/native/release/build/mizchi/bit/cmd/bit/bit.exe tools/git-shim/moon
chmod +x tools/git-shim/moon
# Set system git as fallback for wbtests (third_party/git/git is not built in test job)
which git > tools/git-shim/real-git-path
# Allow file:// protocol for submodule wbtests (git 2.38+ defaults to user)
git config --global protocol.file.allow always
- name: Run JS and WASM tests
run: |
moon test --target js -p mizchi/bit -p mizchi/bit/lib
moon test --target wasm -p mizchi/bit/runtime -f storage_runtime_wbtest.mbt
moon test --target wasm -p mizchi/bit/diff3
moon test --target wasm -p mizchi/bit/repo
moon test --target wasm -p mizchi/bit/grep
moon test --target js -p mizchi/bit -p mizchi/bit_lib
moon test --target wasm -p mizchi/bit_runtime -f storage_runtime_wbtest.mbt
moon test --target wasm -p mizchi/bit_diff3
moon test --target wasm -p mizchi/bit_repo
moon test --target wasm -p mizchi/bit_grep
# Kill any orphan moon processes and remove stale lock before native tests
pkill -f "moon" || true
rm -f _build/.moon-lock
- name: Run native tests
- name: Run native tests (non-cmd modules)
timeout-minutes: 30
run: moon test --target native --no-parallelize -j 1
run: |
# Test extracted bit_* and bitx_* modules + mizchi/bit (without cmd).
# cmd/bit native tests run in the separate cmd-native-test job because
# they dominate runtime (~50 min for the linker pass).
modules=$(awk '/members = \[/,/\]/' moon.work | grep -oE '"[^"]+"' | tr -d '"' | sed 's|^\./||')
for m in $modules; do
case "$m" in
modules/bit) continue ;; # cmd lives here — handled separately
esac
mod_name="mizchi/$(basename "$m")"
echo "::group::moon test --target native -p $mod_name"
moon test --target native -p "$mod_name"
echo "::endgroup::"
done
# Test mizchi/bit's non-cmd packages (tests + fuzz_tests).
moon test --target native -p mizchi/bit/tests
moon test --target native -p mizchi/bit/fuzz_tests || true

cmd-native-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { name: cmd-bit, pkg: mizchi/bit/cmd/bit, timeout: 120 }
- { name: cmd-git-bit, pkg: mizchi/bit/cmd/git-bit, timeout: 30 }
name: cmd-native-test (${{ matrix.name }})
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install pkfire + pkspec
uses: mizchi/pkfire@v0
- name: Install pkspec
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: Moon update
run: moon update
- name: Build native binary for wbtests
run: |
set -euo pipefail
moon --version
moon build --target native --release modules/bit/src/cmd/bit
bin_path=$(find _build/native -maxdepth 8 -type f -name 'bit.exe' | head -1)
if [ -z "$bin_path" ]; then
echo "bit.exe not found after moon build"
find _build/native -maxdepth 8 -type f | head -20 || true
exit 1
fi
echo "bit.exe found at: $bin_path"
cp "$bin_path" tools/git-shim/moon
chmod +x tools/git-shim/moon
which git > tools/git-shim/real-git-path
git config --global protocol.file.allow always
- name: Clear stale processes and moon lock
run: |
pkill -f "moon" || true
pkill -f "clang" || true
sleep 1
rm -f _build/.moon-lock
- name: Run ${{ matrix.pkg }} native tests
timeout-minutes: ${{ matrix.timeout }}
run: moon test --target native -p ${{ matrix.pkg }}

distributed-test:
runs-on: ubuntu-latest
Expand All @@ -67,13 +135,9 @@ jobs:
run: moon update
- name: Distributed tests
run: |
moon test --target native -p mizchi/bit/x/agent
moon test --target native -p mizchi/bit/x/agent/llm
moon test --target native -p mizchi/bit/x/agent/mcp
moon test --target native -p mizchi/bit/x/agent/native
moon test --target native -p mizchi/bit/x-hub
moon test --target native -p mizchi/bit/x-hub/native
moon test --target native -p mizchi/bit/x-kv
moon test --target native -p mizchi/bitx_hub
moon test --target native -p mizchi/bitx_hub/native
moon test --target native -p mizchi/bitx_kv

nix-build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -124,14 +188,15 @@ jobs:
- name: Build bit
run: |
set -euo pipefail
moon build --target native --release
bin_path="_build/native/release/build/cmd/bit/bit.exe"
if [ ! -f "$bin_path" ]; then
echo "bit binary not found at $bin_path"
find _build/native -maxdepth 8 -type f -name 'bit.exe' || true
moon --version
moon build --target native --release modules/bit/src/cmd/bit
bin_path=$(find _build/native -maxdepth 8 -type f -name 'bit.exe' | head -1)
if [ -z "$bin_path" ]; then
echo "bit.exe not found after moon build"
find _build/native -maxdepth 8 -type f | head -20 || true
exit 1
fi
echo "Using bit binary: $bin_path"
echo "bit.exe found at: $bin_path"
cp "$bin_path" tools/git-shim/moon
chmod +x tools/git-shim/moon

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pages-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ on:
- "Taskfile.pkl"
- "Test.pkl"
- "pkspec/**"
- "moon.mod.json"
- "src/lib/**"
- "moon.work"
- "modules/bit/moon.mod.json"
- "modules/bit/src/lib/**"
- "tools/bit-git.mjs"
workflow_dispatch:

Expand Down
53 changes: 28 additions & 25 deletions Taskfile.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
amends "package://pkg.pkl-lang.org/github.com/mizchi/pkfire/pkfire@0.10.0#/Taskfile.pkl"

local moonbitSources: Listing<String> = new {
"src/**/*.mbt"
"src/**/moon.pkg.json"
"moon.mod.json"
"modules/**/*.mbt"
"modules/**/moon.pkg"
"modules/**/moon.pkg.json"
"modules/**/moon.mod.json"
"moon.work"
}

// -- formatting -----------------------------------------------------------
Expand Down Expand Up @@ -48,7 +50,8 @@ local checkLayers: Task = new {
cmd = "node tools/check-layers.mjs"
inputs {
"tools/check-layers.mjs"
"src/**/moon.pkg.json"
"modules/**/moon.pkg"
"modules/**/moon.pkg.json"
}
}

Expand All @@ -57,7 +60,7 @@ local checkGuards: Task = new {
description = "Layer-boundary guards (runtime/storage_runtime)"
cmd = "tools/check-layer-guards.sh"
inputs {
"src/**/*.mbt"
"modules/**/*.mbt"
"tools/check-layer-guards.sh"
}
}
Expand All @@ -76,42 +79,42 @@ local build: Task = new {
cmd = "tools/build-bit-native.sh"
inputs = moonbitSources
outputs {
"_build/native/release/build/cmd/bit/bit.exe"
"_build/native/release/build/mizchi/bit/cmd/bit/bit.exe"
"tools/git-shim/moon"
}
}

local buildJsLib: Task = new {
name = "build-js-lib"
description = "JS release build of src/lib"
cmd = "moon build --target js --release src/lib"
description = "JS release build of mizchi/bit/lib"
cmd = "moon build --target js --release modules/bit_lib/src"
inputs = moonbitSources
outputs { "_build/js/release/build/lib/lib.js" }
outputs { "_build/js/release/build/mizchi/bit_lib/bit_lib.js" }
}

local buildJsCli: Task = new {
name = "build-js-cli"
description = "JS release build of src/cmd/bit"
cmd = "moon build --target js --release src/cmd/bit"
description = "JS release build of mizchi/bit/cmd/bit"
cmd = "moon build --target js --release modules/bit/src/cmd/bit"
inputs = moonbitSources
outputs { "_build/js/release/build/cmd/bit/bit.js" }
outputs { "_build/js/release/build/mizchi/bit/cmd/bit/bit.js" }
}

local syncNpmLibRaw: Task = new {
name = "sync-npm-lib-raw"
description = "Copy the JS lib payload into the checked-in npm wrapper"
cmd = "cp _build/js/release/build/lib/lib.js npm/lib.raw.js"
cmd = "cp _build/js/release/build/mizchi/bit_lib/bit_lib.js npm/lib.raw.js"
deps { buildJsLib }
inputs { "_build/js/release/build/lib/lib.js" }
inputs { "_build/js/release/build/mizchi/bit_lib/bit_lib.js" }
outputs { "npm/lib.raw.js" }
}

local syncNpmBitCjs: Task = new {
name = "sync-npm-bit-cjs"
description = "Copy the JS CLI payload into the checked-in npm wrapper"
cmd = "cp _build/js/release/build/cmd/bit/bit.js npm/bit.cjs"
cmd = "cp _build/js/release/build/mizchi/bit/cmd/bit/bit.js npm/bit.cjs"
deps { buildJsCli }
inputs { "_build/js/release/build/cmd/bit/bit.js" }
inputs { "_build/js/release/build/mizchi/bit/cmd/bit/bit.js" }
outputs { "npm/bit.cjs" }
}

Expand All @@ -126,7 +129,7 @@ local bundleJsLibMinimal: Task = new {
"""#
deps { buildJsLib }
inputs {
"_build/js/release/build/lib/lib.js"
"_build/js/release/build/mizchi/bit_lib/bit_lib.js"
"tools/lib-js-minimal.mjs"
}
outputs { "target/lib-js-minimal.bundle.mjs" }
Expand All @@ -143,7 +146,7 @@ local bundleJsLibGitOps: Task = new {
"""#
deps { buildJsLib }
inputs {
"_build/js/release/build/lib/lib.js"
"_build/js/release/build/mizchi/bit_lib/bit_lib.js"
"tools/lib-js-git-ops.mjs"
}
outputs { "target/lib-js-git-ops.bundle.mjs" }
Expand Down Expand Up @@ -203,7 +206,7 @@ local verifyJsLibTreeshake: Task = new {
local sizeJsLib: Task = new {
name = "size-js-lib"
description = "Report raw + gzip size of the JS lib"
cmd = "tools/size-bytes.sh _build/js/release/build/lib/lib.js"
cmd = "tools/size-bytes.sh _build/js/release/build/mizchi/bit_lib/bit_lib.js"
deps { buildJsLib }
}

Expand Down Expand Up @@ -233,7 +236,7 @@ local buildDocsDemo: Task = new {
"""#
deps { buildJsLib }
inputs {
"_build/js/release/build/lib/lib.js"
"_build/js/release/build/mizchi/bit_lib/bit_lib.js"
"docs/demo/main.js"
"docs/demo/**/*.js"
}
Expand Down Expand Up @@ -318,10 +321,10 @@ local testDistributed: Task = new {
description = "Agent/orchestration focused native checks"
cmd = #"""
moon test --target native -p mizchi/bit/x-mcp
moon test --target native -p mizchi/bit/x-rebase-ai
moon test --target native -p mizchi/bit/x-hub
moon test --target native -p mizchi/bit/x-hub/native
moon test --target native -p mizchi/bit/x-kv
moon test --target native -p mizchi/bitx_rebase_ai
moon test --target native -p mizchi/bitx_hub
moon test --target native -p mizchi/bitx_hub/native
moon test --target native -p mizchi/bitx_kv
"""#
}

Expand Down Expand Up @@ -477,7 +480,7 @@ local benchFsReal: Task = new {

local benchKv: Task = new {
name = "bench-kv"
cmd = "moon bench --target native -p mizchi/bit/x-kv"
cmd = "moon bench --target native -p mizchi/bitx_kv"
}

local benchLib: Task = new {
Expand Down
14 changes: 7 additions & 7 deletions docs/distributed-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ Older agent/orchestrator notes still exist in `docs/`, but this guide is scoped

1. Pure logic (fast)
- Purpose: Detect regressions in pure coordination and serialization logic
- Target: `src/x-hub/*_test.mbt`, `src/x-kv/*_test.mbt`, `src/x-rebase-ai/*_wbtest.mbt`
- Target: `modules/bitx_hub/src/*_test.mbt`, `modules/bitx_kv/src/*_test.mbt`, `modules/bitx_rebase_ai/src/*_wbtest.mbt`
- Examples: Hub record round-trips, issue/PR state transitions, KV merge behavior, rebase-ai parser logic

2. Coordination/State (medium)
- Purpose: Verify read/write consistency across relay, native sync, and repo-backed state
- Target: `src/x-hub/native/*_wbtest.mbt`, `src/x-kv/native/*_wbtest.mbt`
- Target: `modules/bitx_hub/src/native/*_wbtest.mbt`, `modules/bitx_kv/src/native/*_wbtest.mbt`
- Examples: relay fetch/push behavior, sync conflict handling

3. Hub/Sync contract (medium)
- Purpose: Verify PR/Issue/Review representation and sync contracts
- Target: `src/x-hub/*_test.mbt`, `src/x-hub/*_wbtest.mbt`, `src/x-hub/native/*_wbtest.mbt`
- Target: `modules/bitx_hub/src/*_test.mbt`, `modules/bitx_hub/src/*_wbtest.mbt`, `modules/bitx_hub/src/native/*_wbtest.mbt`

4. End-to-end simulation (heavy)
- Purpose: End-to-end connectivity of repository collaboration and relay-oriented flows
Expand All @@ -46,10 +46,10 @@ pkf run check

Current `pkf run test-distributed` runs:

- `mizchi/bit/x-rebase-ai`
- `mizchi/bit/x-hub`
- `mizchi/bit/x-hub/native`
- `mizchi/bit/x-kv`
- `mizchi/bitx_rebase_ai`
- `mizchi/bitx_hub`
- `mizchi/bitx_hub/native`
- `mizchi/bitx_kv`

## 4. Minimal Fault Injection Set

Expand Down
Loading
Loading