Ratchets before code: commit #1 · ioitiki/ratchets-before-code@db75b17 · GitHub
Skip to content

Commit db75b17

Browse files
ioitikiclaude
andcommitted
Ratchets before code: commit #1
Five ratchets, a self-test proving each can fail, and the CI that runs them first, landed before any crate exists. Includes the design spec, plan 01, its live-proof report and ADR 0001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0 parents  commit db75b17

40 files changed

Lines changed: 2544 additions & 0 deletions

‎.envrc‎

Lines changed: 1 addition & 0 deletions

‎.github/workflows/ci.yml‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
# First and cheapest. There is no toolchain install step: the runner already
13+
# has bash, jq, cargo and shellcheck, and a broken invariant should fail
14+
# before anyone waits on a compiler.
15+
ratchets:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: shellcheck the ratchets
20+
run: shellcheck scripts/ratchets/*.sh scripts/ratchets/fixtures/*.sh scripts/ratchets/fixtures/*/*.sh
21+
- name: the ratchets hold
22+
run: ./scripts/ratchets/all.sh
23+
- name: every ratchet can fail
24+
run: ./scripts/ratchets/test-ratchets.sh
25+
26+
build:
27+
needs: ratchets
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
# The workspace arrives with plan 02. Until then this job says so in the
32+
# run summary instead of looking like a build that passed.
33+
- id: gate
34+
run: |
35+
if [ -f Cargo.toml ]; then
36+
echo "ready=true" >> "$GITHUB_OUTPUT"
37+
else
38+
echo "::notice::No Cargo workspace yet. The build turns on when plan 02 adds one."
39+
fi
40+
- if: steps.gate.outputs.ready == 'true'
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
components: rustfmt, clippy
44+
- if: steps.gate.outputs.ready == 'true'
45+
run: cargo fmt --all -- --check
46+
- if: steps.gate.outputs.ready == 'true'
47+
run: cargo clippy --workspace --all-targets -- -D warnings
48+
- if: steps.gate.outputs.ready == 'true'
49+
run: cargo test --workspace
50+
51+
crash-recovery:
52+
needs: build
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
# Present from the first commit, so the crash test has a place waiting
57+
# for it. It turns on when plan 04 adds the test.
58+
- id: gate
59+
run: |
60+
if [ -f crates/ledgerd/tests/crash_recovery.rs ]; then
61+
echo "ready=true" >> "$GITHUB_OUTPUT"
62+
else
63+
echo "::notice::No crash test yet. This job turns on when plan 04 adds it."
64+
fi
65+
- if: steps.gate.outputs.ready == 'true'
66+
uses: dtolnay/rust-toolchain@stable
67+
- if: steps.gate.outputs.ready == 'true'
68+
run: cargo test -p ledgerd --test crash_recovery -- --ignored --nocapture

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
/.direnv

‎.shellcheckrc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Resolve `source` paths relative to the script that sources them.
2+
source-path=SCRIPTDIR

‎README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ratchets-before-code
2+
3+
This repository is being built by the method it will describe: architectural
4+
invariants enforced as failing builds and landed before the code they protect,
5+
plus a brief → spec → plan → live-proof pipeline run with AI coding agents.
6+
7+
The essay replaces this page when the build is done. Until then, the record is
8+
the point:
9+
10+
- [The design](docs/pipeline/specs/2026-10-14-ratchets-before-code-design.md)
11+
- [The first decision](docs/decisions/0001-ratchets-land-before-code.md)
12+
- [The ratchets](scripts/ratchets/), which exist before any crate does
Lines changed: 64 additions & 0 deletions

0 commit comments

Comments
 (0)