Exit 8

Verify it yourself

Do not take this site's word for it. This page fetches a real run ledger and checks it on your machine, with the same rule the project's own verifier uses.

The rule

Each record carries the hash of the one before

A run writes one line per event: a task finished, an event sent, a flag snapshot. Each line's hash is made from the previous line's hash and its own content. Change or remove any line and every hash after it stops matching.

The Merkle root is one number built from the hashes of every finished task. It is published with the results, so anyone holding the ledger can rebuild it and compare.

Check the rollout ledger

runs/rollout/ledger.jsonl, as committed: 13 finished tasks. About 708 KB to fetch. Nothing is sent anywhere.

Nothing has run yet. Press the button.

  1. seq · kind · hash stored in the ledger · hash recomputed here

One task

Prove a single task is under the root

The root is one hash over every finished task. To show that one task is part of it you do not need the others: you need its hash and one neighbour per level of the tree. Pick a task, and this page climbs from its hash to the root in your browser.

Fetching the leaves…

    Pick a task on the left. Its record, its hash and its path to the root appear here.

    The full check

    The same thing, from a clone

    The browser check covers one small ledger. The repository's commands cover every run, and a second command recomputes every arm with Flagsmith's own flag-engine.

    shell
    git clone https://github.com/Prashant-thakur77/fork-in-the-bill.git && cd fork-in-the-bill && uv sync
    
    # hash chain and Merkle root of one run
    uv run python -m integrity.verify_ledger runs/rollout
    uv run python -m integrity.verify_ledger runs/exp1
    
    # every recorded arm, recomputed offline from the saved environment
    uv run python -m integrity.verify_assignment --run runs/exp1
    integrity/canonical.py:11Source: integrity/canonical.py
    def canonical_json(obj: object) -> bytes:
        """`json.dumps(sort_keys, compact separators, ensure_ascii=False)` encoded as UTF-8."""
        return json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8")
    
    
    def record_hash(prev_hash: str, payload: object) -> str:
        """`sha256(prev_hash_hex + canonical_json(payload))` as lowercase hex."""
        return hashlib.sha256(prev_hash.encode("ascii") + canonical_json(payload)).hexdigest()

    The browser code is board/web/src/site/ledger.ts. A test runs it against the Python verifier's output on this ledger. Numbers are re-printed the way Python prints them, so the bytes that are hashed are the same.

    The run receipt and every other check

    Part 2

    Proof the run was not edited

    The run leaves a receipt: hashes that would change if anything were edited afterwards. Every check below is a command you can run on a fresh clone.

    The receipt

    Filled from the repo when this site was built. Experiment 1 lines fill in when its run is committed.

    Fork in the BillRun receipt
    experiment-1.md44d715bd6bd7f8580e8bb1950a21ea852dfea4daaf040c84009f391bf56e19c2
    pilot-report.mdeb5b8c4c2aaa72c3a7e436fbdd8f9d10440db471d95ba411b80916ebb1dfc175
    experiment-1-amendment-1.mdf54a0cbbf415237a8c4fed55817e4d0d8055e6da8cde2bb2e146fb7bc1cc63c6
    experiment-2.mda04a2e207ed7780f66e9f766383e9c8ff207f156e8575e2f09670a18a2473bfb
    experiment-3.md76be18a040e5460a9969aa88287bcb8df25c8dd1a8eed2a88e6fbb42bf0c4119
    experiment-4.md2f964f357e3cd3aea0a9443b441ee680b7cdfa590ff6e38547d92e46f8fe6ab3
    pilot-control · 9 tasks4ab5f6046ba764909dd55a5b50125f48267b2d430a57d606db31bdcdf95f7e3f
    pilot-lanes_v1 · 10 tasksd1f87905aa3ee71c3bd3b850223b252b7254bff41f0fe25766a43ad365f73639
    exp1 Merkle root7ed364648c75…
    exp1 task records146
    Flag snapshots / distinct56 / 1
    flag-engine11.1.2

    Pilot roots recomputed from runs/pilot-*/ledger.jsonl at build time, with the same rule as integrity/merkle.py.

    Verify it yourself

    From a fresh clone, with Python and uv installed.

    shell
    git clone https://github.com/Prashant-thakur77/fork-in-the-bill.git
    cd fork-in-the-bill
    uv sync
    
    sha256sum -c prereg/HASHES.txt
    uv run python -m integrity.verify_ledger runs/pilot-control
    uv run python -m integrity.verify_ledger runs/pilot-lanes_v1
    make verify          # every committed run: ledgers, roots, assignments

    verify_ledger prints the Merkle root. For the pilot runs it must match the receipt above. make verify runs the same checks over every committed run, and CI runs them on every push:

    .github/workflows/ci.yml:54Source: .github/workflows/ci.yml
    - name: ledgers and assignments of committed runs
      uses: ./.github/actions/verify-run
      with:
        run-dir: runs/*/

    What each check proves

    And what it does not.

    Pre-registration hashes

    sha256sum -c prereg/HASHES.txt

    Proves: The registered files are byte for byte what was hashed and tagged before the run.

    Does not prove: Shows the files were not changed after the tag, not that the tag came first. The git tag dates show that.

    Ledger hash chain

    uv run python -m integrity.verify_ledger runs/exp1

    Proves: No finished task was edited, dropped or reordered after it was written.

    Does not prove: A ledger rewritten from scratch would chain too. The published Merkle root pins the version you compare against.

    Merkle root

    uv run python -m integrity.verify_ledger runs/exp1   # prints the root

    Proves: One hash stands for every task_done record. If it matches the receipt, you have the same tasks.

    Does not prove: Covers finished tasks, not the raw transcripts, which are published as a release asset.

    Every arm, recomputed

    uv run python -m integrity.verify_assignment --run runs/exp1

    Proves: Each task ran the arm Flagsmith's own engine gives for its identity. The runner did not pick.

    Does not prove: Needs the saved environment document, which the run commits under runs/exp1/env/.

    Flag snapshots

    ls runs/exp1/env/   # one distinct sha256 across the run

    Proves: The flag and the split stayed the same from the first snapshot to the last.

    Does not prove: Snapshots are taken at intervals. A change and revert between two would still show in the signed webhook history.

    Terraform drift

    make flags-drift

    Proves: The live flags match the code in infra/flagsmith/ exactly.

    Does not prove: Needs a Flagsmith key for the project, so only the owner can run it live. The result is written to the ledger.

    D21. Environment snapshots

    integrity/snapshot_env.py saves the Flagsmith environment document at the start of the run, every 15 minutes during it, and at the end. It removes the organisation and project names first, and it writes each snapshot's SHA-256 and a summary of the routing flags to the run's ledger. If the flag or the split changed mid-run, the snapshots would show it.

    D23. Flags as code are read-only during an experiment

    infra/flagsmith/ describes the flags, the lanes_v1 variant, the environment defaults and the experiment's segment override as Terraform, but it is only ever planned, never applied. An apply in the middle of a run would publish new feature-state versions on the flag the experiment is splitting, and could reset parts the provider cannot express (the variant key and the per-segment weights) that the CLI scripts set. So the scripts in flagsmith/ stay the only writers, and make flags-drift runs a read-only plan that must report no changes. Each check can be appended to the run's ledger as a config record with the plan's hash, so the ledger shows that the flag configuration matched the committed code during the run.

    The hashing rules

    Short enough to re-implement. This site does, to print the pilot roots.

    integrity/canonical.py:16Source: integrity/canonical.py
    def record_hash(prev_hash: str, payload: object) -> str:
        """`sha256(prev_hash_hex + canonical_json(payload))` as lowercase hex."""
        return hashlib.sha256(prev_hash.encode("ascii") + canonical_json(payload)).hexdigest()
    integrity/merkle.py:49Source: integrity/merkle.py
    level = list(leaves)
    while len(level) > 1:
        level = _parent_level(level)
    return level[0].hex()

    Full rule in docs/interfaces.md.