Skip to content

Commit aa230bf

Browse files
committed
ci: add invariant-checks lane to exercise opt-in commit checks
PAGEDB_INVARIANT_CHECKS is opt-in, so the default test job never runs a single line of the freed-page/reachability invariant. Add a dedicated Linux job that enables it and runs the suite so regressions there are caught in CI instead of only when someone flips it by hand.
1 parent 4aa5760 commit aa230bf

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# test — `cargo nextest run` on Linux / macOS / Windows. Crash tests
1212
# are serialised by `.config/nextest.toml`, which `cargo test`
1313
# ignores — that is why this workflow always uses nextest.
14+
# invariants — the same suite with PAGEDB_INVARIANT_CHECKS set, so the
15+
# opt-in commit-time structural checks are actually exercised.
1416
# cross — `cargo check` across every Tier-1/Tier-2 target the VFS
1517
# backend matrix in resource/architecture.md §8 covers, so a
1618
# platform-specific backend never regresses unnoticed.
@@ -122,6 +124,50 @@ jobs:
122124
path: target/nextest/default/junit.xml
123125
if-no-files-found: ignore
124126

127+
# ─────────────────────────────────────────────────────────────────────────
128+
# The commit-time freed-page / reachability invariant is opt-in: with
129+
# PAGEDB_INVARIANT_CHECKS unset, `WriteTxn::commit` probes the variable once
130+
# and does nothing else, so the `test` job above never runs a single line of
131+
# it. Without this lane a regression in the check — or a healthy commit that
132+
# it starts rejecting — is invisible until someone enables it by hand.
133+
#
134+
# Linux-only and single-config on purpose: the check is pure page-graph
135+
# traversal with no platform-specific or feature-gated code, so a second
136+
# runner would buy nothing. It is deliberately expensive (it walks the data,
137+
# catalog, and commit-history trees on every commit), which is why it stays
138+
# opt-in rather than becoming the default for the whole matrix.
139+
invariants:
140+
name: Invariant checks
141+
runs-on: ubuntu-latest
142+
env:
143+
# Only presence is checked, never the value.
144+
PAGEDB_INVARIANT_CHECKS: "1"
145+
steps:
146+
- uses: actions/checkout@v7
147+
148+
- name: Install Rust
149+
uses: dtolnay/rust-toolchain@stable
150+
151+
- uses: Swatinem/rust-cache@v2
152+
with:
153+
prefix-key: invariants
154+
155+
- name: Install cargo-nextest
156+
uses: taiki-e/install-action@v2
157+
with:
158+
tool: nextest
159+
160+
- name: Run tests with commit invariants enabled
161+
run: cargo nextest run -p pagedb --all-features --no-fail-fast
162+
163+
- name: Upload nextest report
164+
if: always()
165+
uses: actions/upload-artifact@v7
166+
with:
167+
name: nextest-invariants
168+
path: target/nextest/default/junit.xml
169+
if-no-files-found: ignore
170+
125171
# ─────────────────────────────────────────────────────────────────────────
126172
# Per-platform VFS backends (architecture.md §8) must each at least
127173
# type-check on every target they exist for. Compile-only — running on

0 commit comments

Comments
 (0)