Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
43d6b38
reorganize the repo to acutally make it maintainable
peterrrock2 Mar 12, 2026
8da732f
improve testing in ben
peterrrock2 Mar 12, 2026
a85511e
reorg the clis
peterrrock2 Mar 12, 2026
af2586b
add cli tests
peterrrock2 Mar 12, 2026
c46d18c
modernize the logging structure in ben
peterrrock2 Mar 12, 2026
6fdaa1c
small reorg and cleanup of pathologic cases in pyben
peterrrock2 Mar 12, 2026
8c11fc9
migrate to taskfile
peterrrock2 Mar 13, 2026
48bcd73
add tests and coverage for whole package
peterrrock2 Mar 13, 2026
aaf413e
rename internals so imports are use/import binary_ensemble
peterrrock2 Mar 13, 2026
80ef93b
More doc strings
peterrrock2 Mar 16, 2026
72fcaf1
Try to make relabeling faster
peterrrock2 Mar 16, 2026
34c3907
fix pben counting logic
peterrrock2 Mar 16, 2026
475c607
speed up pben conversoin logic
peterrrock2 Mar 16, 2026
34ead30
Add in spectral and Cuthill-McKee ordering to just see how well it does
peterrrock2 Mar 16, 2026
f737f33
swap spectral for nested dissection
peterrrock2 Mar 16, 2026
07750f0
swap nested for mla
peterrrock2 Mar 16, 2026
a1862b9
swap mla for mlc
peterrrock2 Mar 16, 2026
82ca34b
optimize mlc a bit
peterrrock2 Mar 16, 2026
bffa8df
Start of twodelta
peterrrock2 Mar 16, 2026
57e3cd9
more tests
peterrrock2 Mar 17, 2026
80f5eb6
Opitimize the checks for eqality to improve write speed
peterrrock2 Mar 17, 2026
a19fb26
add twodelta to reben
peterrrock2 Mar 17, 2026
e0054a1
add twodelta to xben
peterrrock2 Mar 17, 2026
b023278
move banners to their own section
peterrrock2 Mar 17, 2026
98b8541
add way to convert between ben versions
peterrrock2 Mar 17, 2026
5ca5e65
format
peterrrock2 Mar 17, 2026
befb641
fix read-all bug
peterrrock2 Mar 17, 2026
ed71980
update docs
peterrrock2 Mar 17, 2026
8dc1ce9
fix labelling issue
peterrrock2 Mar 17, 2026
3967b9a
Speed up conversion
peterrrock2 Mar 17, 2026
d1a85d0
optimize the twodelta case
peterrrock2 Mar 17, 2026
f2dd39b
fix header double-check bug
peterrrock2 Mar 17, 2026
9cc8efc
small opt for xben encoder
peterrrock2 Mar 17, 2026
392cf9c
opt decode
peterrrock2 Mar 17, 2026
4a06e29
get rid of extreneous copy
peterrrock2 Mar 17, 2026
69fabd9
possible xz compression improvement for twodelta
peterrrock2 Mar 17, 2026
c6bcfaf
remove mla
peterrrock2 Mar 17, 2026
762c8f6
Cleanup of twodelta method
peterrrock2 Mar 18, 2026
713d303
Start stubbing out bigger reorg
peterrrock2 Mar 19, 2026
7dd91fe
More reorg
peterrrock2 Mar 20, 2026
a0e8f73
Make a better error system
peterrrock2 Mar 20, 2026
2ce7fbf
Fix up twodelta so that the tests all work again
peterrrock2 Mar 20, 2026
a911ff6
More org
peterrrock2 Mar 20, 2026
1199d50
Modify responsibilities of the encoder
peterrrock2 Mar 20, 2026
d352036
Remove redundant code in io/writer/ben
peterrrock2 Mar 20, 2026
0f009b2
Reorg (I will figure out the design I like eventually)
peterrrock2 Mar 20, 2026
6078ab2
Centralized constructor impl for Ben-type frames
peterrrock2 Mar 20, 2026
cd0233a
Change BenEncoder -> AssignmentWriter
peterrrock2 Mar 20, 2026
8321f3e
Change XBenEncoder -> XZAssignmentWriter
peterrrock2 Mar 20, 2026
03da065
Change writer/ben.rs -> write/assignment_writer and make better use o…
peterrrock2 Mar 23, 2026
f8735dc
Update XZAssignment writer to be more parallel with the AssigmentWriter
peterrrock2 Mar 23, 2026
b126117
Rename twodelta.rs -> twodelta_encode.rs
peterrrock2 Mar 23, 2026
c8e2348
Update decoder and readers
peterrrock2 Mar 23, 2026
2433fa9
Update some tests
peterrrock2 Mar 31, 2026
9e8fa32
Add twodelta into cli
peterrrock2 Apr 7, 2026
edc9647
add twodelta to python side
peterrrock2 Apr 8, 2026
f53715e
improve docs for things that should not use twodelta
peterrrock2 Apr 8, 2026
b1c0813
Improve test suite
peterrrock2 Apr 8, 2026
0f8d0ff
add edge-case tests
peterrrock2 Apr 8, 2026
cc53e8a
change format spec for bendl
peterrrock2 Apr 8, 2026
f9224ae
move over to using petgraph internals
peterrrock2 Apr 10, 2026
027ba0d
try louvain
peterrrock2 Apr 10, 2026
266f11e
revert louvain
peterrrock2 Apr 11, 2026
612512e
add bendl
peterrrock2 Apr 11, 2026
5b5ba8b
better stess testing
peterrrock2 Apr 11, 2026
f933629
update pyben decoder
peterrrock2 Apr 11, 2026
cdfd7d8
fix warnings
peterrrock2 Apr 11, 2026
42e191a
allow multiple iterator passes
peterrrock2 Apr 11, 2026
cbcad0d
Lots more tests and remove PyBundleReader
peterrrock2 Apr 13, 2026
9ae12c2
More testing
peterrrock2 Apr 20, 2026
a43cf51
Get coverage to 98% on rust side
peterrrock2 Apr 30, 2026
d58276c
better json reader
peterrrock2 May 1, 2026
75049bf
we will continue testing until moral improves
peterrrock2 May 1, 2026
70912ca
move writer tests
peterrrock2 May 1, 2026
5b35451
reorganize bundle module
peterrrock2 May 1, 2026
092bdac
reorg cli module
peterrrock2 May 1, 2026
ae44ce5
reog pyben side to parallel ben side
peterrrock2 May 1, 2026
aa8ad81
reorg to make cli easier to test
peterrrock2 May 1, 2026
3c86805
fix twodelta inconsistency
peterrrock2 May 4, 2026
288045d
fix up some ambiguous / clashing terminology
peterrrock2 May 5, 2026
1c5255a
tweaks to cli behavior
peterrrock2 May 5, 2026
e6a98ee
change pyben -> ben-py
peterrrock2 May 5, 2026
d9b5a3b
change progress to spinner
peterrrock2 May 5, 2026
12aabce
get rid of frame duplicates
peterrrock2 May 6, 2026
6c1318d
Fix python tests
peterrrock2 May 6, 2026
143bf91
Increase size of xz block to improve ability to parallelize
peterrrock2 May 6, 2026
e71975b
Allow --n-cpus -1 to mean all cores
peterrrock2 May 6, 2026
860012f
Unify stream readers
peterrrock2 May 7, 2026
74d0dd5
small writer extraction
peterrrock2 May 7, 2026
c712179
consolodate relabel module
peterrrock2 May 9, 2026
46655eb
small dedupe in graph module
peterrrock2 May 9, 2026
ecc39df
Unify stream writers
peterrrock2 May 10, 2026
6c2a904
add known asset kind enum for bendl
peterrrock2 May 10, 2026
92f2b3e
add in an XBEN variant
peterrrock2 May 10, 2026
aa185d8
update pcompress translation to be more consistent
peterrrock2 May 10, 2026
2263240
Update bundle protocol
peterrrock2 May 10, 2026
899e270
clean up bendl stream api
peterrrock2 May 10, 2026
7a7ef6c
add in checksum logic
peterrrock2 May 18, 2026
1ce870c
formatting pass
peterrrock2 May 18, 2026
b76de04
checksum for the assignment streams
peterrrock2 May 21, 2026
f4d95e3
Add in some edge-case tests
peterrrock2 May 21, 2026
c2aac6e
add strict payload length enforcement
peterrrock2 May 22, 2026
18ad3ec
add some fixtures and stability tests
peterrrock2 May 22, 2026
c04cee7
enforce bit width consistency and add size guard
peterrrock2 May 22, 2026
7acb805
add adversarial tests
peterrrock2 May 22, 2026
f4a93f9
add more edge-case stress tests
peterrrock2 May 22, 2026
3cfee66
check twodelta boundary test
peterrrock2 May 22, 2026
f8986c8
more boundary tests
peterrrock2 May 22, 2026
24f8672
check label value 0 makes the round trip
peterrrock2 May 22, 2026
f146f52
add property tests for bendl
peterrrock2 May 22, 2026
5d84063
add property-based equivalence tests
peterrrock2 May 22, 2026
da50034
add some forward-compatibility tests
peterrrock2 May 22, 2026
8797434
add tests for multi-step decode
peterrrock2 May 22, 2026
aa00f83
test parallel reads
peterrrock2 May 22, 2026
4187b8c
test zero and one sample edge cases
peterrrock2 May 22, 2026
d6aef70
add cli tests
peterrrock2 May 22, 2026
107d880
better testing of the bendl write path
peterrrock2 May 22, 2026
d0c5b71
more cli path tests for bendl
peterrrock2 May 22, 2026
7b58410
remove redundant tests
peterrrock2 May 22, 2026
abac92d
formatting
peterrrock2 May 25, 2026
4f8c064
split bundle reader up
peterrrock2 May 30, 2026
ff2d3ec
create asset registry
peterrrock2 May 30, 2026
4de8883
Improve crash safety of BENDL and tighten verified stream APIs
peterrrock2 May 30, 2026
39a6ee8
Fix maximum number of directory entries
peterrrock2 May 31, 2026
e343f1f
remove repetition in verify
peterrrock2 May 31, 2026
841d16b
More consistent progress bar semantics
peterrrock2 May 31, 2026
d78b271
clean up fast path in relabel
peterrrock2 May 31, 2026
189b2d6
improve readability
peterrrock2 May 31, 2026
c53baf0
make clippy happy
peterrrock2 May 31, 2026
912e526
better recovery for dropped stream
peterrrock2 May 31, 2026
696038d
finish benpy rename
peterrrock2 Jun 1, 2026
b2a0a37
make two-delta work better on things like SB or arbitrary ensembles
peterrrock2 Jun 2, 2026
b13b0ed
fix clippy
peterrrock2 Jun 2, 2026
6475871
reorg python side and add bundle bindings
peterrrock2 Jun 3, 2026
2d32712
add relabel bundle helper and reformat
peterrrock2 Jun 4, 2026
3ca70d0
api change to add_graph on the python side
peterrrock2 Jun 4, 2026
70caba8
update cli to use dualgraph rather than shapefile
peterrrock2 Jun 5, 2026
1712c3b
major docs overhaul
peterrrock2 Jun 6, 2026
0ae330c
update docs
peterrrock2 Jun 9, 2026
aa038e4
a different color theme
peterrrock2 Jun 9, 2026
c4b616f
better contrast in color theme
peterrrock2 Jun 9, 2026
9dcaee7
better doc strings for the api section
peterrrock2 Jun 9, 2026
ec3c1f7
more docs!!
peterrrock2 Jun 9, 2026
3d20a76
reroute old methods through the ben stream reader
peterrrock2 Jun 10, 2026
6b8adde
format
peterrrock2 Jun 10, 2026
a4f5b39
harden against oversized assets
peterrrock2 Jun 10, 2026
add9fc3
harden against malicious assignment lengths and middle zero-byte corr…
peterrrock2 Jun 10, 2026
1fb97c2
better reader errors (propagate)
peterrrock2 Jun 10, 2026
4123e9a
fix some edge case issues in the pcompress translation
peterrrock2 Jun 10, 2026
7f7e998
handle duplicate index in remap and failed final flush edge cases
peterrrock2 Jun 10, 2026
cb41eec
better coverage harnass
peterrrock2 Jun 10, 2026
c557b11
get rid of the try_from_parts symantics and fix potential zero drop
peterrrock2 Jun 11, 2026
87cf6e6
fix issue with twodelta silently failing on a pathological 2 distrcit TX
peterrrock2 Jun 11, 2026
5593e37
Add in cross architecture tests
peterrrock2 Jun 11, 2026
7f6b0f8
remove the from_parts from twodelta
peterrrock2 Jun 11, 2026
38f9f43
convert panics into errors for better handling
peterrrock2 Jun 11, 2026
a33b35c
add rust linter into workflow
peterrrock2 Jun 11, 2026
5e76363
make sure interop with Pcompress still lives
peterrrock2 Jun 11, 2026
0fe0e4c
better ci
peterrrock2 Jun 11, 2026
b83148a
more fuzzing
peterrrock2 Jun 11, 2026
929ecc4
add soak test
peterrrock2 Jun 11, 2026
0611dc4
better ci / cd with a smoke test on wheels
peterrrock2 Jun 11, 2026
cedd613
autocompress larger assets in bundle
peterrrock2 Jun 12, 2026
72d0018
Note compression bomb risk (consequence of format and nothing to do h…
peterrrock2 Jun 12, 2026
a3b3400
tuning for fuzz tests
peterrrock2 Jun 12, 2026
1361ace
better api for asset payloads
peterrrock2 Jun 12, 2026
bf4179c
make sure python assets verify
peterrrock2 Jun 12, 2026
14304b8
enabling remove asset
peterrrock2 Jun 12, 2026
99c568e
Docs.....
peterrrock2 Jun 12, 2026
f26b2b1
naming fixes
peterrrock2 Jun 12, 2026
44dbe9b
make sure payload lengths do not overrun file size
peterrrock2 Jun 12, 2026
60f6bce
fix mid-write crash bug
peterrrock2 Jun 12, 2026
3e2fac4
unify remove and compact
peterrrock2 Jun 12, 2026
3ff79c2
remove large memory buffering of tail payloads
peterrrock2 Jun 12, 2026
33ce37c
power loss safety because I'm paranoid
peterrrock2 Jun 12, 2026
39c91d8
better file swap dicipline
peterrrock2 Jun 12, 2026
2020092
poison the encoder on failed stream finalize
peterrrock2 Jun 12, 2026
dc8d0ad
guard against mutations to underlying bendl (b/c jupyter)
peterrrock2 Jun 12, 2026
82dfbba
prevent custom assets from claiming known names
peterrrock2 Jun 12, 2026
a698eaa
deal with GIL
peterrrock2 Jun 13, 2026
1eebdf4
validate content type before writing
peterrrock2 Jun 13, 2026
23b8761
dedup pass
peterrrock2 Jun 13, 2026
35975b6
docs
peterrrock2 Jun 13, 2026
a70ac38
put fuzzing back in
peterrrock2 Jun 13, 2026
741bee9
give control over asset compression
peterrrock2 Jun 13, 2026
6c04ef4
cleanup comments
peterrrock2 Jun 13, 2026
0648dd8
more docs for me
peterrrock2 Jun 13, 2026
6e1faf5
better visited link color
peterrrock2 Jun 13, 2026
c17f410
phrasing sweep on docs
peterrrock2 Jun 13, 2026
0fb781e
docs org
peterrrock2 Jun 13, 2026
db2e62c
rename stream -> ben_stream
peterrrock2 Jun 13, 2026
e56ac50
prettify docs
peterrrock2 Jun 13, 2026
5a4a1b1
fix links
peterrrock2 Jun 13, 2026
bf211ba
fix links again
peterrrock2 Jun 13, 2026
75d42cc
increase timout for link check
peterrrock2 Jun 13, 2026
23f45b1
prettier
peterrrock2 Jun 13, 2026
5b7c23a
more link fixing
peterrrock2 Jun 13, 2026
979bb2d
you're killin me smalls
peterrrock2 Jun 13, 2026
967c2e3
link
peterrrock2 Jun 13, 2026
a2f378c
fix link ignore regex
peterrrock2 Jun 13, 2026
6c20a7c
remove landing page buttons
peterrrock2 Jun 13, 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
  •  
  •  
  •  
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

# Lightweight quality gates on every PR: formatting and lints for both languages. The heavier
# gates (full test suite, big-endian emulation) live in full-tests.yml and run on demand — either
# from the Actions tab or via a `/ci-full` / `/ci-endian` PR comment.
#
# These mirror `task format` / `task lint`; keep the two in sync.

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
format:
name: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt
run: cargo fmt --all -- --check
- uses: astral-sh/setup-uv@v5
- name: ruff format
working-directory: ben-py
run: uvx ruff format --check .

lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: cargo clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- uses: astral-sh/setup-uv@v5
- name: ruff check
working-directory: ben-py
run: uvx ruff check .
34 changes: 31 additions & 3 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & publish pyben wheels
name: Build & publish ben-py wheels

on:
push:
Expand All @@ -14,7 +14,7 @@ on:
# options: [testpypi, pypi]

env:
PKG_DIR: pyben
PKG_DIR: ben-py
OUT_DIR: dist

permissions:
Expand Down Expand Up @@ -42,6 +42,14 @@ jobs:
--release
--locked
--out ${{ env.OUT_DIR }}
# Smoke-test the built wheel in a clean venv before it can be published. aarch64 wheels are
# cross-built and cannot execute on this runner, so only the native target is smoked.
- name: Smoke test wheel
if: matrix.target == 'x86_64'
run: |
python3 -m venv /tmp/wheel-smoke
/tmp/wheel-smoke/bin/pip install ${{ env.PKG_DIR }}/${{ env.OUT_DIR }}/*.whl
/tmp/wheel-smoke/bin/python .github/workflows/wheel_smoke.py
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
Expand Down Expand Up @@ -75,6 +83,12 @@ jobs:
--target universal2-apple-darwin
--out ${{ env.OUT_DIR }}

- name: Smoke test wheel
run: |
python3 -m venv /tmp/wheel-smoke
/tmp/wheel-smoke/bin/pip install ${{ env.PKG_DIR }}/${{ env.OUT_DIR }}/*.whl
/tmp/wheel-smoke/bin/python .github/workflows/wheel_smoke.py

- uses: actions/upload-artifact@v4
with:
name: wheels-macos-universal2
Expand Down Expand Up @@ -103,6 +117,13 @@ jobs:
--release
--locked
--out ${{ env.OUT_DIR }}
- name: Smoke test wheel
shell: pwsh
run: |
python -m venv $env:TEMP\wheel-smoke
$wheel = Get-ChildItem "${{ env.PKG_DIR }}\${{ env.OUT_DIR }}\*.whl" | Select-Object -First 1
& "$env:TEMP\wheel-smoke\Scripts\pip" install $wheel.FullName
& "$env:TEMP\wheel-smoke\Scripts\python" .github\workflows\wheel_smoke.py
- uses: actions/upload-artifact@v4
with:
name: wheels-windows
Expand All @@ -112,7 +133,7 @@ jobs:
name: windows (ARM64, abi3)
runs-on: windows-11-arm
env:
PKG_DIR: pyben
PKG_DIR: ben-py
OUT_DIR: dist
steps:
- uses: actions/checkout@v4
Expand All @@ -131,6 +152,13 @@ jobs:
--locked
--out ${{ env.OUT_DIR }}
--target aarch64-pc-windows-msvc
- name: Smoke test wheel
shell: pwsh
run: |
python -m venv $env:TEMP\wheel-smoke
$wheel = Get-ChildItem "${{ env.PKG_DIR }}\${{ env.OUT_DIR }}\*.whl" | Select-Object -First 1
& "$env:TEMP\wheel-smoke\Scripts\pip" install $wheel.FullName
& "$env:TEMP\wheel-smoke\Scripts\python" .github\workflows\wheel_smoke.py
- uses: actions/upload-artifact@v4
with:
name: wheels-windows-arm64
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docs

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
build-docs:
name: Build & execute docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: ben-py
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.12

# Builds the PyO3 extension (so autodoc reads live docstrings) and installs the
# render + execution doc dependencies.
- name: Install docs dependencies
run: uv sync --no-dev --extra docs --extra docs-exec

# NB_EXECUTION_MODE=cache executes every tutorial notebook end to end; -W turns
# any Sphinx warning (including a notebook cell error) into a build failure, so
# the docs cannot drift from the live API without CI catching it.
- name: Build docs (execute notebooks, warnings as errors)
env:
NB_EXECUTION_MODE: cache
run: uv run sphinx-build -W -b dirhtml docs docs/_build

# Run every Python code block in the Markdown docs against the live API.
- name: Test documentation code snippets
run: uv run --with pytest pytest tests/test_docs_snippets.py -q

- name: Check documentation links
run: uv run sphinx-build -b linkcheck docs docs/_build/linkcheck

- name: Upload built site
uses: actions/upload-artifact@v4
with:
name: docs-html
path: ben-py/docs/_build
167 changes: 167 additions & 0 deletions .github/workflows/full-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Full tests (on demand)

# The heavy gates, run only when asked:
#
# - From the Actions tab via "Run workflow" (workflow_dispatch), picking any branch.
# - From a PR by commenting `/ci-full` (Rust + Python suites + big-endian), `/ci-endian`
# (big-endian only), or `/ci-fuzz` (time-boxed coverage-guided fuzzing). Comment triggers
# are restricted to the repo owner, members, and collaborators, because the jobs check out
# and execute the PR head.
#
# Note: GitHub only evaluates `issue_comment` triggers against the workflow file on the default
# branch, so the comment commands start working once this file lands on main.

on:
workflow_dispatch:
issue_comment:
types: [created]

permissions:
contents: read
issues: write # eyes-reaction acknowledgment on the triggering comment

jobs:
decide:
name: decide what to run
runs-on: ubuntu-latest
outputs:
run_full: ${{ steps.flags.outputs.run_full }}
run_endian: ${{ steps.flags.outputs.run_endian }}
run_fuzz: ${{ steps.flags.outputs.run_fuzz }}
ref: ${{ steps.flags.outputs.ref }}
steps:
- name: compute trigger flags
id: flags
# The comment body is passed through env rather than interpolated into the script, so a
# hostile comment cannot inject shell.
env:
EVENT_NAME: ${{ github.event_name }}
IS_PR_COMMENT: ${{ github.event.issue.pull_request != null }}
COMMENT_BODY: ${{ github.event.comment.body }}
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
PR_NUMBER: ${{ github.event.issue.number }}
DISPATCH_REF: ${{ github.ref }}
run: |
run_full=false
run_endian=false
run_fuzz=false
ref="$DISPATCH_REF"
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
run_full=true
run_endian=true
run_fuzz=true
elif [ "$IS_PR_COMMENT" = "true" ]; then
case "$AUTHOR_ASSOCIATION" in
OWNER|MEMBER|COLLABORATOR)
case "$COMMENT_BODY" in
*"/ci-full"*) run_full=true; run_endian=true ;;
esac
case "$COMMENT_BODY" in
*"/ci-endian"*) run_endian=true ;;
esac
case "$COMMENT_BODY" in
*"/ci-fuzz"*) run_fuzz=true ;;
esac
;;
esac
ref="refs/pull/$PR_NUMBER/head"
fi
{
echo "run_full=$run_full"
echo "run_endian=$run_endian"
echo "run_fuzz=$run_fuzz"
echo "ref=$ref"
} >> "$GITHUB_OUTPUT"
- name: acknowledge the triggering comment
if: github.event_name == 'issue_comment' && (steps.flags.outputs.run_full == 'true' || steps.flags.outputs.run_endian == 'true' || steps.flags.outputs.run_fuzz == 'true')
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh api
repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions
-f content=eyes

rust-tests:
name: rust tests
needs: decide
if: needs.decide.outputs.run_full == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.decide.outputs.ref }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: fast suite
run: cargo test
- name: ignored-gated stress suite
run: >-
cargo test -- --ignored
--skip generate_format_stability_fixtures
--skip regenerate_twodelta_fixtures
--skip generate_pcompress_interop_fixture

python-tests:
name: python tests
needs: decide
if: needs.decide.outputs.run_full == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.decide.outputs.ref }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v5
- name: sync environment
working-directory: ben-py
run: uv sync --all-groups
- name: build extension
working-directory: ben-py
run: uv run maturin develop
- name: pytest
working-directory: ben-py
run: uv run pytest tests/

big-endian:
name: big-endian suite (s390x under QEMU)
needs: decide
if: needs.decide.outputs.run_endian == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.decide.outputs.ref }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cross
- name: cross test on s390x
run: cross test -p binary-ensemble --target s390x-unknown-linux-gnu

fuzz:
name: coverage-guided fuzzing (time-boxed)
needs: decide
if: needs.decide.outputs.run_fuzz == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.decide.outputs.ref }}
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-fuzz
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: fuzz every read surface (120s per target)
run: task fuzz FUZZ_SECONDS=120
- name: upload crash artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-artifacts
path: fuzz/artifacts/
43 changes: 43 additions & 0 deletions .github/workflows/wheel_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Smoke test for a freshly built binary_ensemble wheel.

Run inside a clean venv that has the wheel (and nothing else from this repo) installed: imports
the extension module and round-trips a tiny ensemble through encode/decode. Catches wheels that
build but cannot load (bad abi3 configuration, missing symbols) or that load but cannot reach the
Rust core, before they are published.
"""

import json
import pathlib
import tempfile

import binary_ensemble as be

LINES = [
{"assignment": [1, 1, 2, 2], "sample": 1},
{"assignment": [2, 2, 1, 1], "sample": 2},
{"assignment": [2, 2, 1, 1], "sample": 3},
]


def main() -> None:
with tempfile.TemporaryDirectory() as tmp:
tmp_path = pathlib.Path(tmp)
src = tmp_path / "src.jsonl"
ben = tmp_path / "out.ben"
back = tmp_path / "round.jsonl"

src.write_text(
"".join(json.dumps(line, separators=(",", ":")) + "\n" for line in LINES)
)
be.encode_jsonl_to_ben(src, ben, overwrite=True, variant="standard")
be.decode_ben_to_jsonl(ben, back, overwrite=True)

assert src.read_bytes() == back.read_bytes(), (
f"wheel round-trip mismatch:\n{src.read_text()!r}\n!=\n{back.read_text()!r}"
)

print("wheel smoke test passed")


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dev_files
demo

__pycache__
*.so
*.so
/ben-py/docs/code-theme-preview.md
Loading
Loading