# Phaseline finite release contracts

An observable names a result with Boolean expressions for the approved and proposed version. Examples are in cafe.json. Strings refer to facts; expressions support true, false, all, any and not. Facts are scoped to a product, an issuing owner and an as-of version. An unreadable or conflicting latest record yields unknown.

revision.mjs compares two independent editions. An omitted commitment is a withdrawal. It reports a concrete affected history when one exists. The issued edition is retained until the owner chooses. shop-v1.json and shop-proposal.json are independent inputs.

Run from the extracted folder with Node 22+ and Python 3.10+.

    node self-check.mjs
    python3 release.py
    python3 verify_results.py results.json

To repeat the matched measurements, install a JDK (17+) and get the Alloy 6.2.0 all-in-one JAR from the AlloyTools release. Its expected SHA-256 is embedded in experiment.py.

    python3 experiment.py --alloy-jar /path/to/alloy.jar --out replay.json
    python3 verify_results.py replay.json
    python3 joint_experiment.py --alloy-jar /path/to/alloy.jar --out joint-replay.json

For an individual worker request, run node phaseline.mjs with a JSON object on standard input. Supply contract, bits, phase ("capture" or "review"), and inputs. Capture takes evidence packets; review takes state codes. The contract and fixed codec are public and independent of any sampled history. A capture returning null requests new evidence before admission. A valid code can also decode to unknown after a restart.

The retention assay uses independent fresh processes for capture and review. One logical B-bit symbol per admitted history crosses the boundary. Disk alignment uses one byte for each history. Only the examiner sees associations between histories and codes. The reader receives every code in canonical order. Context, identity and timing channels are outside the declared reader interface. The receiver, which the reader cannot access, seeds an issued version and observes the subsequent effects against a separate materialized delivery table. SQLite and the authority test fixture are shared across the three tools. This is a class-specific experiment, not a deployment of a business system.

The finite acquisition extension in frontier.py searches exact strategies over up to four declared evidence probes and eight distinct profiles. For each set of at most K−1 safe profiles, it reserves one unknown code. It also considers a code per profile when everything can be resolved. At each unresolved node it considers stopping or paying for any allowed split and selects the maximum safe coverage, breaking ties by total read cost. Positive prices and a strictly smaller possible-world set ensure termination. Every admissible deterministic decision tree either stops or takes one such first split. This gives a matching converse by induction for the declared fixed-probe family. No probabilistic guessing, hidden source, free migration or free training is included. Joint results report all search-state counts, actual read charges and synthesized decision trees. All three evaluators were run to establish the same input profiles; the joint planner itself is shared.

Receiver roles in the SQLite example are supplied by a trusted caller. The separate native-trace.json was captured against PostgreSQL and Open Policy Agent in a local VERIFY test deployment. Its decision IDs are real test evaluations. No customer data is included.

Included resources are the finite interpreter, independent Python semantics, actual Alloy adapter/Java driver, joint acquisition planner, runs, graph data and receiver examples. They do not include Alloy itself or the private VERIFY platform.

Real upstream replay with CPython 3.13 and 3.14 installed:

    python3 upstream.py --old-python python3.13 --next-python python3.14 --alloy-jar /path/to/alloy.jar --out upstream-replay.json

## Simulated shipping-policy change

The simulation runs Node, real Alloy 6.2.0 through its Java driver, and versioned Python. It freezes the implementations, then generates a shipping-rule change with a seed. Every implementation receives the same 40 evidence packets, three retained bits and 30 seconds for each complete batch. Three serial repetitions rotate the initial tool order. Setup includes workspace creation, copying the tool and dependencies, compiling the Alloy driver from scratch and initializing the receiving database. Stock Node, Python, Java and the downloaded JAR were already available. No people or paid models ran the releases. Human setup, environment installation, training, adapter authoring and operational labor have no measurement here.

The simulated owner authorizes the engine's review so an unwarranted answer can actually reach the local receiver. A fresh connection checks each served observation and each historic request. The examiner privately knows all eight worlds. If a relevant fact is missing, the reviewer must be right for every world consistent with its evidence. A lucky guess remains unsafe. On the four uncertain evidence treatments, a missing, conflicting, revoked or malformed fact may be irrelevant depending on the other promises. The test covers one dropped formal promise and two other observations. We supplied the old/new formulas. Discovery from a customer conversation remains outside this experiment.

Release quality compares unsafe issues first, safe deliveries second and correct holds third. The same 30-second deadline applies to all three. Machine-time medians and phase times are reported alongside quality. No labor or hosting rate is assumed. This workload measures machine setup through a local release, not delivery to a customer's system.

    python3.10 simulate_release.py --alloy-jar /path/to/alloy.jar --seed 1190518136 --out replay.json
    python3 verify_simulation.py

Start from an extracted kit. To replay the earlier tools, copy finite.py, phaseline.mjs, alloy.py and ReadProfiles.java into an empty folder, apply sim-earlier-engines.patch there with patch -p1, then pass that directory as --tools. Both measured runs include tool and input hashes, times and the 40 anonymized local readbacks per repetition. The Alloy arm uses the Python evidence reader and codec, but evaluates the rule relations in Alloy. All three use the same receiving service and simulated authority.

## Raw shop history and exact cents (#196)

Open /shared to run counter-refunds.phase. Phaseline's public text syntax accepts one named guarantee per line, a Boolean fact, literal or named guarantee (cycles are rejected), or an integer comparison against order_total using > or >= and USD_cents. The version editor also accepts JSON conditions ["at_least_cents","order_total",50000] and ["over_cents","order_total",50000]. The refund editor reads complete policies in that language or the supported shop wording. The release decision checks positive integer cents up to 999999999. Every supported threshold is constant on the intervals between its change points; the checker visits each interval's first cent, including the cent just above a strict threshold.

Run with Python 3.10+, Node 22+, and JDK 17+ on PATH. The Java archive is pinned in raw_shop_trial.py. Each command regenerates matching packet and result files in the output directory.

    python3 raw_shop_trial.py --alloy-jar /path/to/alloy.jar --out raw-shop-results.json
    python3 raw_shop_trial.py --alloy-jar /path/to/alloy.jar --transfer-seed 1106335817 --out raw-transfer-results.json

The formal reader gets only the raw packet on stdin. Oracle terms and diagnostic case names stay with the examiner. Simulated authority attributes come from the source fixture. Raw lookup checks shop, actor, issuance, effective sequence and grant. One case deliberately has two active entries with the same sequence. The transfer keeps the reader files frozen and tests approval timing with a generated amount and an unchanged control. This is an artifact-level holdout. Its protocol authors knew the accepted grammar.

The result files include every old and new order's version and observations after a database restart. Each observations string has two bits in order: issue receipt, require manager approval. An order placed before the change retains its original terms even when its first refund is requested after the change. The receiver issues only with simulated owner permission. Results include failed/held cases in the denominator. The cash expense, operator time advantage and customer production behavior were not measured.
