Skip to content

Build the Oddly Exact proof theater and strengthen numeric provenance - #29

Draft
copyleftdev wants to merge 10 commits into
mainfrom
agent/proof-theater-web
Draft

Build the Oddly Exact proof theater and strengthen numeric provenance#29
copyleftdev wants to merge 10 commits into
mainfrom
agent/proof-theater-web

Conversation

@copyleftdev

Copy link
Copy Markdown
Owner

What changed

  • adds the Oddly Exact browser proof theater and deployable WASM/site assets
  • caps automatic mutation concurrency to keep local validation usable
  • adds exact-rational discounted-cash-flow price modeling with explicit decimal rounding
  • adopts stronger compensated summation and reports regression rank/conditioning diagnostics
  • adds independent 256-bit reference tests for cancellation-heavy statistics and DCF pricing
  • adds a closed-form orthogonal-design regression test that exercises 24 scale/conditioning combinations
  • preserves the article source and visual asset alongside the implementation

Why

The article’s central claim is that a green test is evidence only when its oracle is independent and its assertions are capable of exposing the defect. This change makes that claim executable: the new regression test derives standard errors from a closed-form oracle, checks the complete vector, and deliberately includes a point where one component collides under the plausible r*q -> r+q mutant.

The pricing additions apply the same discipline to financial models by keeping decimal inputs and DCF calculations exact as rationals, then checking them against an independent 256-bit implementation.

Validation

The pre-commit gate passed:

  • cargo fmt
  • cargo check
  • cargo clippy
  • full cargo test suite (405 unit tests plus all integration suites)
  • cargo package
  • CLI smoke tests

Mutation replay was also performed locally: the exact standard-error * -> + mutant and the alternate (v/s) -> (v*s) mutant both turn the new closed-form test red, while the correct implementation remains green.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d3f7917-84ec-441d-b716-6c05d6fd4fa8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/proof-theater-web

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A solve costs 0.26ms. Spawning the CLI to perform it costs 1.36ms. The process
was five times the work, which is the entire argument for a server — not that
the arithmetic is slow, but that fork+exec around it is.

So the endpoint that matters is /v1/batch. A caller with 212 solves to do — one
stress test — asks once, and the calls fan out across cores. Measured here: 212
linear solves in 1.3ms of compute, against 84ms for the same work in
WebAssembly and 344ms through 212 CLI spawns.

Every request goes through execute_tool_json, the same function the CLI and the
wasm build call. Not a port of it — the same code, three transports. Feature
gated, so none of it reaches the default build or the wasm target.

AND A CONFORMANCE HARNESS, WHICH FOUND SOMETHING ON ITS FIRST RUN

3 of 36 cases diverge between the CLI binary and the calcd binary, in the last
bit or two of an f64. WASM matched the CLI on all 36; only the two native
binaries disagree.

Ruled out by measurement, in order: input encoding (byte-identical strings reach
the kernel, verified by echoing both); Cargo feature unification (no maths crate
changes features under --features server); the FPU control word (MXCSR 0x1f80 on
main and worker threads alike — no FTZ, no DAZ, round-to-nearest); and thread
identity (it reproduces on a single thread). What is left is codegen — the same
source in two binaries with different dependency graphs.

The size of the number is not the point. Everything bento displays is rounded to
dollars. The exposure is the seal: a signature over a hash of the figures, and a
hash has no bit that matters less than the others. The same model solved on the
server and verified against a browser solve would hash differently and read as
tampering. A sealed artifact must therefore be computed by one transport end to
end, and this harness has to gate deployment rather than run occasionally.

The corpus is every request shape bento actually issues across its four worlds,
because the shapes a real caller sends are the ones worth guaranteeing.
The first version blocked on any difference at all, which made it useless: 3 of
36 cases differ between the CLI and calcd binaries in the fifteenth significant
figure, nobody can fix that today, and a permanently red check is one everybody
learns to ignore.

So it now separates what a caller can act on from what they cannot. MUST covers
anything that changes a decision or a displayed figure — feasibility, a survivor
count, a dollar — and blocks. NOTE covers last-bit float drift below 1e-9
relative and is recorded. Measured in the product rather than assumed: routing a
121-cell survival map through calcd instead of the browser moved 13 cells in the
fifteenth figure and changed no feasibility, no survivor count and no edge.

And a correction to the previous commit message, which claimed this drift would
make a sealed pack read as tampering. It does not. Verification re-hashes the
claims carried inside the pack; it never re-solves the model, so the figures
travel with the signature and there is nothing to disagree with at verification
time. Checking that beat assuming it.
Two-stage: dependencies compile against the manifests alone so a change to src
does not rebuild nalgebra, then the real sources. Runtime is debian-slim with
the binary and nothing else, 136MB, running unprivileged.

It binds 0.0.0.0 because it is meant to be an internal service behind something
that checks entitlement — it solves whatever it is handed and asks nobody for
permission, which is exactly why it must not be routable from outside.

Verified in a clean container: 212 solves in 5.7ms, objective identical to the
host build.
A linear program with no solution was reported as status "error" with code
"invalid_input". That says the request was malformed. The request was perfectly
good — it was the plan that could not be made to work, which is the one fact the
caller needed and the only one the response did not contain.

Found by dogfooding: a construction startup's model went infeasible the moment
its 75-day payment terms were included, and the kernel's answer was that the
question had been asked wrongly.

So three outcomes are now three statuses, the way every real solver reports them:

  infeasible   the constraints admit no point. An answer.
  unbounded    the objective improves without limit. Also an answer, and almost
               always a missing constraint rather than a bad request.
  error        the request itself is wrong. Still invalid_input, still rejected.

Both solve paths were conflating them. The MILP returned Err for infeasibility,
and the continuous path flattened good_lp's ResolutionError — which already
separates Unbounded and Infeasible from everything else — into one string.

Branch and bound also pruned on any error at all, so a solver that misbehaved
mid-search would have been reported as a plan that cannot work: a wrong answer
wearing a right one's face. It now prunes the two that mean "nothing down here"
and surfaces the one that means the solver broke.

The existing test asserted the old behaviour, so its failure is what proved the
change landed; it now asserts the distinction instead. Four conformance cases
pin the statuses across all three transports, including the malformed request,
because a distinction only means something if both sides of it hold.

No published schema or contract text enumerated response statuses, so nothing
advertised is contradicted by adding two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant