name: Native Bindings
on:
schedule:
- cron: "17 18 * * *"
workflow_dispatch:
inputs:
windows_abandonment_qualification:
description: "Run only the complete Windows abandonment GC power-loss qualification"
type: boolean
default: false
boundary_comparison:
description: "Run the manual Linux ordinary-boundary comparison instead of binding tests"
type: boolean
default: false
benchmark_sizes:
description: "Comma-separated row counts; default is the complete three-size matrix"
type: string
default: "1000,100000,1000000"
benchmark_cases:
description: "Comma-separated workload cases"
type: string
default: "select,point,fill,fill_bulk,wide"
benchmark_samples:
description: "Measured iterations, in addition to one discarded iteration"
type: string
default: "3"
benchmark_layers:
description: "Comma-separated language layers; select a shard without changing its workload"
type: string
default: "rust,python,go"
benchmark_backends:
description: "Comma-separated storage backends"
type: string
default: "memory,file"
rabitq_baseline:
description: "Run the manual RaBitQ baseline instead of binding checks"
type: boolean
default: false
canonical_vector_lifecycle:
description: "Run only the fixed 100k canonical DiskANN CRUD/MVCC matrix"
type: boolean
default: false
windows_power_loss_test_threads:
description: "Parallel Windows GC fault groups (repository uses its variable or 4)"
type: choice
default: "repository"
options: ["repository", "1", "2", "4", "8"]
pull_request:
paths:
- "src/**"
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "scripts/cargo-test-required.sh"
- "scripts/run-windows-native-bazel.sh"
- "scripts/run-windows-native-bazel.test.sh"
- "scripts/vector_recovery_cases.py"
- "scripts/automatic_checkpoint_cases.py"
- "scripts/branch-power-loss-shard.py"
- "scripts/branch-power-loss-shard.test.py"
- "scripts/check-windows-native-features.py"
- "windows_native_features.bzl"
- ".github/actions/windows-bazel/**"
- "tests/in_memory_portable.rs"
- "tests/branch_project_open.rs"
- "bindings/ffi/**"
- "bindings/bun/**"
- "bindings/go/**"
- "bindings/moonbit/**"
- "bindings/swift/**"
- "Package.swift"
- "MODULE.bazel"
- "BUILD.bazel"
- ".bazelrc"
- ".cargo/**"
- ".bazelversion"
- ".github/workflows/native-bindings.yml"
push:
branches: [main]
paths:
- "src/**"
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "scripts/cargo-test-required.sh"
- "scripts/run-windows-native-bazel.sh"
- "scripts/run-windows-native-bazel.test.sh"
- "scripts/vector_recovery_cases.py"
- "scripts/automatic_checkpoint_cases.py"
- "scripts/branch-power-loss-shard.py"
- "scripts/branch-power-loss-shard.test.py"
- "scripts/check-windows-native-features.py"
- "windows_native_features.bzl"
- ".github/actions/windows-bazel/**"
- "tests/in_memory_portable.rs"
- "tests/branch_project_open.rs"
- "bindings/ffi/**"
- "bindings/bun/**"
- "bindings/go/**"
- "bindings/moonbit/**"
- "bindings/swift/**"
- "Package.swift"
- "MODULE.bazel"
- "BUILD.bazel"
- ".bazelrc"
- ".cargo/**"
- ".bazelversion"
- ".github/workflows/native-bindings.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.windows_abandonment_qualification }}-${{ inputs.boundary_comparison }}-${{ inputs.benchmark_sizes }}-${{ inputs.benchmark_cases }}-${{ inputs.benchmark_layers }}-${{ inputs.benchmark_backends }}-${{ inputs.benchmark_samples }}-${{ inputs.canonical_vector_lifecycle }}
cancel-in-progress: true
jobs:
bazel:
if: >-
github.event_name != 'schedule' &&
(github.event_name != 'workflow_dispatch' ||
(!inputs.windows_abandonment_qualification && !inputs.boundary_comparison && !inputs.rabitq_baseline && !inputs.canonical_vector_lifecycle))
name: Bazel native bindings (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest]
include:
- os: ubuntu-24.04
library: libhawdb_ffi.so
- os: macos-latest
library: libhawdb_ffi.dylib
env:
USE_BAZEL_VERSION: "9.3.1"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Bazel
uses: bazel-contrib/setup-bazel@0.19.2
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ github.job }}
repository-cache: true
external-cache: true
- name: Build the C ABI libraries and Go package
run: |
bazel build //bindings/ffi:hawdb_ffi //bindings/ffi:hawdb_ffi_static //bindings/go:hawdb
# Later profile changes retarget the bazel-bin convenience symlink.
library_path="$(bazel info bazel-bin)/bindings/ffi/${{ matrix.library }}"
test -f "$library_path"
printf 'HAWDB_LIBRARY=%s\n' "$library_path" >> "$GITHUB_ENV"
- name: Test Go against the Bazel-built C ABI
run: bazel test --test_output=errors --test_arg=-test.v //bindings/go:hawdb_go_tests
- name: Install Swift on Linux
if: runner.os == 'Linux'
uses: swift-actions/setup-swift@v2
with:
swift-version: "6.0.3"
- name: Test Swift against the Bazel-built C ABI
run: |
swift --version
library_dir="$(dirname "$HAWDB_LIBRARY")"
swift test -j 2 -Xswiftc -warnings-as-errors \
-Xlinker -L -Xlinker "$library_dir" \
-Xlinker -rpath -Xlinker "$library_dir"
swift run --package-path bindings/swift/Tests/Consumer -j 2 \
-Xswiftc -warnings-as-errors \
-Xlinker -L -Xlinker "$library_dir" \
-Xlinker -rpath -Xlinker "$library_dir"
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.3
- name: Test Bun against the Bazel-built C ABI
working-directory: bindings/bun
run: |
bun install --frozen-lockfile
bun run typecheck
bun test
- name: Test original generation spool ownership
run: >-
bazel test --test_output=errors --test_arg=generation_spool
//crates/search:hawdb_search_tests
- name: Test consumer publication and reopen on Unix
run: >-
bazel test --test_output=errors
//:hawdb_search_projection_consumer_tests
//:hawdb_search_projection_consumer_minimal_tests
- name: Test the retained C ABI contract
run: bazel test --test_output=errors //bindings/ffi:hawdb_ffi_tests
- name: Test the MoonBit native adapter
run: bazel test --test_output=errors //bindings/moonbit/native:hawdb_moonbit_rust_tests
- name: Test query observer under the repository release profile
if: matrix.os == 'ubuntu-24.04'
run: >-
bazel test --config=release --test_output=errors
//crates/executor:hawdb_query_observer_release_tests
- name: Install Go for the race detector
uses: actions/setup-go@v7
with:
go-version-file: bindings/go/go.mod
cache-dependency-path: bindings/go/go.sum
- name: Check retained read and close concurrency with the race detector
working-directory: bindings/go
env:
CGO_ENABLED: "1"
run: go test -race -count=1 -run '^TestRetained' ./...
windows-bazel-contracts:
if: >-
github.event_name != 'schedule' &&
(github.event_name != 'workflow_dispatch' ||
(!inputs.windows_abandonment_qualification && !inputs.boundary_comparison && !inputs.rabitq_baseline && !inputs.canonical_vector_lifecycle))
name: Windows Bazel (${{ matrix.shard }})
runs-on: windows-2025
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
shard: [transactions, storage, search, consumers, identities, snapshots, bindings,
consumers-recovery-births, consumers-recovery-unselected,
consumers-recovery-selected, consumers-recovery-lost-sql-link,
consumers-recovery-lost-sql-selector, consumers-recovery-lost-nodes-link,
consumers-recovery-lost-nodes-selector, consumers-publication-artifacts,
consumers-publication-selectors, consumers-publication-barriers]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Restore native Bazel toolchain and caches
id: bazel
uses: ./.github/actions/windows-bazel
with:
cache-scope: ${{ matrix.shard }}
- name: Record exact native source and cache configuration
shell: bash
run: |
set -euo pipefail
mkdir -p windows-native-results
git log -1 --format='%H%n%T%n%P' > windows-native-results/source.txt
rustc --version --verbose > windows-native-results/toolchain.txt
bazel version > windows-native-results/bazel-version.txt
bazel info > windows-native-results/bazel-info.txt
python scripts/check-windows-native-features.py | tee windows-native-results/feature-inventory.txt
- name: Run fresh native contract selections
shell: bash
run: bash scripts/run-windows-native-bazel.sh '${{ matrix.shard }}'
- name: Preserve Windows shard evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: windows-native-${{ matrix.shard }}-${{ github.sha }}-${{ github.run_attempt }}
path: windows-native-results
if-no-files-found: error
- name: Save updated disk actions for this source
if: always() && steps.bazel.outputs.disk-cache-key != '' && steps.bazel.outputs.disk-cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: D:/hawdb-bazel-disk
key: ${{ steps.bazel.outputs.disk-cache-key }}
windows-native-clippy:
if: >-
github.event_name != 'schedule' &&
(github.event_name != 'workflow_dispatch' ||
(!inputs.windows_abandonment_qualification && !inputs.boundary_comparison && !inputs.rabitq_baseline && !inputs.canonical_vector_lifecycle))
name: Windows native Clippy
runs-on: windows-2025
timeout-minutes: 120
env:
CARGO_TARGET_DIR: D:/hawdb-clippy-target
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Install Rust
uses: dtolnay/rust-toolchain@1.99.1
with:
components: clippy
- name: Restore native Clippy dependencies
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
D:/hawdb-clippy-target
key: Windows-${{ runner.arch }}-clippy-v1-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml', '.cargo/config.toml') }}-${{ github.sha }}
restore-keys: |
Windows-${{ runner.arch }}-clippy-v1-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml', '.cargo/config.toml') }}-
Windows-${{ runner.arch }}-clippy-v1-
- name: Validate native runner failure controls and feature inventory
shell: bash
run: |
set -euo pipefail
python scripts/check-windows-native-features.py
bash scripts/run-windows-native-bazel.test.sh
python scripts/branch-power-loss-shard.test.py
- name: Run unchanged strict native Windows Clippy
shell: bash
run: |
set -euo pipefail
mkdir -p windows-native-results
git log -1 --format='%H%n%T%n%P' > windows-native-results/source.txt
rustc --version --verbose > windows-native-results/toolchain.txt
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings \
2>&1 | tee windows-native-results/clippy.txt
- name: Preserve native Clippy evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: windows-native-clippy-${{ github.sha }}-${{ github.run_attempt }}
path: windows-native-results
if-no-files-found: error
windows-native-contracts:
if: >-
always() && github.event_name != 'schedule' &&
(github.event_name != 'workflow_dispatch' ||
(!inputs.windows_abandonment_qualification && !inputs.boundary_comparison && !inputs.rabitq_baseline && !inputs.canonical_vector_lifecycle))
name: Windows native contracts
runs-on: ubuntu-24.04
needs: [windows-bazel-contracts, windows-native-clippy]
steps:
- name: Require every Windows shard and native lint
env:
CONTRACTS_RESULT: ${{ needs.windows-bazel-contracts.result }}
CLIPPY_RESULT: ${{ needs.windows-native-clippy.result }}
run: |
test "$CONTRACTS_RESULT" = success
test "$CLIPPY_RESULT" = success
windows-abandonment-qualification:
if: >-
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.windows_abandonment_qualification)
name: Windows abandonment GC power-loss qualification
runs-on: windows-2025
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Restore native Bazel toolchain and caches
id: bazel
uses: ./.github/actions/windows-bazel
with:
cache-scope: abandonment
- name: Record tested source and toolchain
shell: bash
run: |
set -euo pipefail
mkdir -p windows-abandonment-results
git log -1 --format='%H%n%T%n%P' > windows-abandonment-results/source.txt
rustc --version --verbose > windows-abandonment-results/toolchain.txt
bazel version > windows-abandonment-results/bazel-version.txt
python scripts/check-windows-native-features.py > windows-abandonment-results/feature-inventory.txt
- name: Test abandonment GC power-loss cuts
shell: bash
env:
POWER_LOSS_TEST_THREADS: ${{ inputs.windows_power_loss_test_threads != 'repository' && inputs.windows_power_loss_test_threads || vars.HAWDB_WINDOWS_POWER_LOSS_TEST_THREADS || '4' }}
run: |
set -euo pipefail
case "$POWER_LOSS_TEST_THREADS" in
1|2|4|8) ;;
*) echo "Windows power-loss test threads must be 1, 2, 4, or 8" >&2; exit 1 ;;
esac
echo "power_loss_test_threads=$POWER_LOSS_TEST_THREADS" \
| tee windows-abandonment-results/abandonment-config.txt
WINDOWS_NATIVE_RESULTS=windows-abandonment-results \
bash scripts/run-windows-native-bazel.sh abandonment
- name: Preserve Windows abandonment qualification evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: windows-abandonment-gc-${{ github.sha }}-${{ github.run_attempt }}
path: windows-abandonment-results
if-no-files-found: error
- name: Save updated abandonment disk actions
if: always() && steps.bazel.outputs.disk-cache-key != '' && steps.bazel.outputs.disk-cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: D:/hawdb-bazel-disk
key: ${{ steps.bazel.outputs.disk-cache-key }}
boundary-comparison:
if: github.event_name == 'workflow_dispatch' && !inputs.windows_abandonment_qualification && !inputs.canonical_vector_lifecycle && inputs.boundary_comparison
name: Manual ordinary-boundary comparison (Linux)
runs-on: ubuntu-24.04
timeout-minutes: 360
env:
USE_BAZEL_VERSION: "9.3.1"
BENCHMARK_SIZES: ${{ inputs.benchmark_sizes }}
BENCHMARK_CASES: ${{ inputs.benchmark_cases }}
BENCHMARK_SAMPLES: ${{ inputs.benchmark_samples }}
BENCHMARK_LAYERS: ${{ inputs.benchmark_layers }}
BENCHMARK_BACKENDS: ${{ inputs.benchmark_backends }}
steps:
- name: Checkout the candidate
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install Bazel
uses: bazel-contrib/setup-bazel@0.19.2
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ github.job }}
repository-cache: true
external-cache: true
- name: Install Go for provenance
uses: actions/setup-go@v7
with:
go-version-file: bindings/go/go.mod
cache-dependency-path: bindings/go/go.sum
- name: Compare frozen ordinary producers with unchanged defaults
run: |
python3 -B bindings/benchmarks/compare.py \
--output "$RUNNER_TEMP/hawdb-boundary-comparison" \
--sizes "$BENCHMARK_SIZES" --cases "$BENCHMARK_CASES" \
--layers "$BENCHMARK_LAYERS" --backends "$BENCHMARK_BACKENDS" \
--samples "$BENCHMARK_SAMPLES"
- name: Preserve complete or partial evidence, including failed outcomes
if: always()
uses: actions/upload-artifact@v7
with:
name: ordinary-boundary-comparison-${{ github.sha }}
path: ${{ runner.temp }}/hawdb-boundary-comparison/evidence
if-no-files-found: error
rabitq-baseline:
if: github.event_name == 'workflow_dispatch' && !inputs.windows_abandonment_qualification && !inputs.canonical_vector_lifecycle && inputs.rabitq_baseline
name: Manual RaBitQ baseline (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
architecture: x86_64
- os: macos-latest
architecture: arm64
env:
HAWDB_RABITQ_BENCH_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@1.99.1
with:
components: clippy
- name: Record native environment
shell: bash
run: |
set -euo pipefail
test "$(uname -m)" = "${{ matrix.architecture }}"
mkdir -p "$RUNNER_TEMP/rabitq-baseline"
git log -1 --format='%H%n%T%n%P' > "$RUNNER_TEMP/rabitq-baseline/source.txt"
rustc --version --verbose > "$RUNNER_TEMP/rabitq-baseline/toolchain.txt"
uname -a > "$RUNNER_TEMP/rabitq-baseline/system.txt"
df -h "$RUNNER_TEMP" >> "$RUNNER_TEMP/rabitq-baseline/system.txt"
if [ "$(uname -s)" = "Darwin" ]; then
for key in machdep.cpu.brand_string hw.logicalcpu hw.physicalcpu hw.memsize hw.l1dcachesize hw.l2cachesize hw.l3cachesize; do
sysctl "$key" >> "$RUNNER_TEMP/rabitq-baseline/cpu.txt" 2>&1 || true
done
else
lscpu > "$RUNNER_TEMP/rabitq-baseline/cpu.txt"
cat /proc/meminfo >> "$RUNNER_TEMP/rabitq-baseline/system.txt"
fi
- name: Check the native benchmark code
run: cargo clippy --locked -p hawdb-vector-projection --all-targets --features storage-io -- -D warnings
- name: Record the complete scalar matrix
shell: bash
env:
HAWDB_RABITQ_BENCH_ARTIFACTS: ${{ runner.temp }}/rabitq-baseline/artifacts
HAWDB_RABITQ_BENCH_OUTPUT: ${{ runner.temp }}/rabitq-baseline/samples.jsonl
run: |
set -euo pipefail
cargo test --locked --release -p hawdb-vector-projection --features storage-io \
kernel::benchmark::candidate_scan_matrix -- --exact --ignored --nocapture --test-threads=1 \
2>&1 | tee "$RUNNER_TEMP/rabitq-baseline/run.log"
python3 scripts/summarize-rabitq-baseline.py \
"$HAWDB_RABITQ_BENCH_OUTPUT" "$RUNNER_TEMP/rabitq-baseline/audit.json"
- name: Preserve raw measurements and checksummed artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: rabitq-baseline-${{ matrix.os }}-${{ github.sha }}
path: ${{ runner.temp }}/rabitq-baseline
if-no-files-found: error
compression-level: 0
retention-days: 14
canonical-vector-lifecycle:
if: github.event_name == 'workflow_dispatch' && !inputs.windows_abandonment_qualification && inputs.canonical_vector_lifecycle
name: Manual canonical vector lifecycle (Linux, ${{ matrix.mode }}, rate${{ matrix.rate }})
runs-on: ubuntu-24.04
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
mode: [plain, lsg]
rate: [10, 100]
env:
CARGO_TARGET_DIR: target/canonical-vector-lifecycle
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@1.99.1
- name: Record exact source and compile with the repository profile
shell: bash
run: |
set -euo pipefail
evidence="$RUNNER_TEMP/canonical-vector-lifecycle"
mkdir -p "$evidence"
git log -1 --format='%H%n%T%n%P' > "$evidence/source.txt"
rustc --version --verbose > "$evidence/toolchain.txt"
cp .cargo/config.toml "$evidence/cargo-config.toml"
lscpu > "$evidence/cpu.txt"
cat /proc/meminfo > "$evidence/memory.txt"
/usr/bin/time -v -o "$evidence/compilation.time.txt" \
cargo build --locked --all-features --example filtered_diskann_qualification \
> "$evidence/compilation.log" 2>&1
sha256sum "$CARGO_TARGET_DIR/debug/examples/filtered_diskann_qualification" \
> "$evidence/binary.sha256"
- name: Qualify the complete canonical lifecycle
shell: bash
run: |
set -euo pipefail
evidence="$RUNNER_TEMP/canonical-vector-lifecycle"
mode="${{ matrix.mode }}"
rate="${{ matrix.rate }}"
status=0
name="canonical-100000-128-$mode-rate$rate"
if /usr/bin/time -v -o "$evidence/$name.time.txt" \
"$CARGO_TARGET_DIR/debug/examples/filtered_diskann_qualification" canonical \
"$RUNNER_TEMP/$name" 100000 128 320 "$mode" "$rate" 16 \
> "$evidence/$name.jsonl" 2> "$evidence/$name.stderr.txt"; then
printf '%s PASS\n' "$name" | tee -a "$evidence/status.txt"
else
printf '%s FAIL\n' "$name" | tee -a "$evidence/status.txt"
status=1
fi
exit "$status"
- name: Preserve complete or partial source-bound measurements
if: always()
uses: actions/upload-artifact@v7
with:
name: canonical-vector-lifecycle-${{ github.sha }}-${{ matrix.mode }}-rate${{ matrix.rate }}
path: ${{ runner.temp }}/canonical-vector-lifecycle
if-no-files-found: error
retention-days: 14