mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
* ci(folio): run gradle on jdk 21 for the metro plugin the metro gradle plugin folio builds with publishes org.gradle.jvm.version 21 and java 21 class files, so every leg failed at the folio build on a 17 runtime. local builds pass on jdk 25, which is why only ci saw it. * fix(build): clean pkg/spec/dist, not the dead spec-api path * chore: point stale spec-api comments at pkg/spec * fix(spec): publish src so an installed package carries the runtime entries * fix(testrun): alias the installed spec package so one module graph loads * fix(spec): export Direction, ScrollAction and LongPressAction from the entry * docs(spec): cut the package readme to a description and doc links * docs: say how the cli and spec package versions relate * fix(verifier): report whether the last action was confirmed applied Both hosts get applied: true when the runner saw the dispatch succeed and applied: null when it could not, so an unconfirmed action stops arriving at the spec as no action at all. * fix(runner): an apply error leaves the action's fate unknown, not undone A deadline that fires after the tap was dispatched leaves the effect committed. Reporting nil made the spec see an effect with no action to cause it, which is how the counting property convicts a healthy app. * fix(release): stage the sidecar jar at the renamed embed path * test(replay-ui): trace fixtures for the vacuity counts one real green run, one run that rendered nothing, one that judges every property at least once. * ci(replay-ui): count the steps each property judged the exit code says no property returned false; it does not say any property was ever evaluated. this reads the trace and reports judged vs declined per property, and fails when the step page never rendered. * test(replay-ui): cover the summary script from make test * ci(replay-ui): summarise through the vacuity script * docs(ci): explain the replay-ui judged/declined counts * fix(verifier): encode element-valued extractors into the trace An ax element exports with its find/findAll host functions attached, and json.Marshal refuses the whole value over them: json: unsupported type: func(goja.FunctionCall) goja.Value. The encoding failed, curr stayed nil, and the goja hosts (ios, android) recorded null for every element-valued extractor in both the per-step diff and the violation witness. Apply the web host's sanitize rule before marshaling, so one rule encodes an element on both hosts. * test(verifier): pin element encoding to one rule on both hosts * test(runner): assert an element reaches trace.jsonl and its witness * feat(spec): give state.lastAction an applied field Three states, not two: no action is a null lastAction, applied: true is an action the runner confirmed, applied: null is one it dispatched and never learned the fate of. * fix(folio): do not attribute an effect to an unconfirmed action submitChangesBalanceByTypedAmount and createdAccountHasNonZeroBalance both convict by pinning an effect on the last action, so both decline unless the runner saw it applied. The fixtures now say which fate they mean. * test(folio): an unconfirmed submit belongs in the window The count is an upper bound on the submits a window holds, so the tap that may have landed counts and committedTransactionsExceedSubmits has nothing to convict on. * test(runner): a tap that lands under a failed apply is not a double submit Drives the real folio counting predicates through the runner against a device that commits the tap and then times out. The double-submit case is the control: without it a green proves only that the property never fired. * test(verifier): pin the three lastAction states on both hosts The web page is handed the same applied field the goja object exposes, so a property cannot read one thing on native and another on web. * docs(spec-language): document the three lastAction states
175 lines
6.3 KiB
TypeScript
175 lines
6.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import {
|
|
committedTransactionsExceedSubmits,
|
|
countSubmitsInWindow,
|
|
isTxnSubmitTap,
|
|
readHomeTotalBalance,
|
|
} from "../../../examples/folio/sanderling/predicates.ts";
|
|
|
|
const submitOn = "testTag:AddTransactionScreen > testTag:TxnSubmit";
|
|
|
|
test("a tap on TxnSubmit is a commit", () => {
|
|
assert.equal(isTxnSubmitTap({ kind: "Tap", on: submitOn }), true);
|
|
});
|
|
|
|
test("a double-tap on TxnSubmit is ONE commit action, not two", () => {
|
|
const window = countSubmitsInWindow({
|
|
previousCount: 0,
|
|
lastAction: { kind: "DoubleTap", on: submitOn },
|
|
fresh: true,
|
|
});
|
|
assert.equal(window.reported, 1);
|
|
});
|
|
|
|
test("a selector object naming TxnSubmit is a commit", () => {
|
|
assert.equal(isTxnSubmitTap({ kind: "Tap", on: { testTag: "TxnSubmit" } }), true);
|
|
});
|
|
|
|
test("typing into the amount field is not a commit", () => {
|
|
assert.equal(isTxnSubmitTap({ kind: "InputText", on: submitOn }), false);
|
|
});
|
|
|
|
test("tapping some other button is not a commit", () => {
|
|
assert.equal(isTxnSubmitTap({ kind: "Tap", on: "testTag:AddAccountSubmit" }), false);
|
|
});
|
|
|
|
test("no action at all is not a commit", () => {
|
|
assert.equal(isTxnSubmitTap(null), false);
|
|
});
|
|
|
|
test("a fresh Home reading closes the window and the next one starts empty", () => {
|
|
assert.deepEqual(
|
|
countSubmitsInWindow({ previousCount: 0, lastAction: { kind: "Tap", on: submitOn }, fresh: true }),
|
|
{ reported: 1, next: 0 },
|
|
);
|
|
});
|
|
|
|
test("landing off Home keeps the submit in the window for the next step", () => {
|
|
assert.deepEqual(
|
|
countSubmitsInWindow({ previousCount: 0, lastAction: { kind: "Tap", on: submitOn }, fresh: false }),
|
|
{ reported: 1, next: 1 },
|
|
);
|
|
});
|
|
|
|
test("a non-submit step neither adds to nor forgets the window", () => {
|
|
assert.deepEqual(
|
|
countSubmitsInWindow({ previousCount: 1, lastAction: { kind: "Tap", on: "testTag:AccountCard" }, fresh: false }),
|
|
{ reported: 1, next: 1 },
|
|
);
|
|
});
|
|
|
|
test("a second submit with no Home reading between them counts two", () => {
|
|
assert.deepEqual(
|
|
countSubmitsInWindow({ previousCount: 1, lastAction: { kind: "DoubleTap", on: submitOn }, fresh: true }),
|
|
{ reported: 2, next: 0 },
|
|
);
|
|
});
|
|
|
|
// The two traces the freshness rule exists to tell apart, driven step by step
|
|
// through the same pair of carriers the spec holds.
|
|
function run(steps: { route: string | null; totalText?: string; lastAction: unknown }[]) {
|
|
let carrier: number | null = null;
|
|
let submits = 0;
|
|
const out: { total: number | null; submits: number }[] = [];
|
|
for (const step of steps) {
|
|
const reading = readHomeTotalBalance({
|
|
route: step.route,
|
|
totalText: step.totalText,
|
|
previousCarrier: carrier,
|
|
});
|
|
carrier = reading.carrier;
|
|
const window = countSubmitsInWindow({
|
|
previousCount: submits,
|
|
lastAction: step.lastAction as { kind?: string; on?: string } | null,
|
|
fresh: reading.fresh,
|
|
});
|
|
submits = window.next;
|
|
out.push({ total: reading.value, submits: window.reported });
|
|
}
|
|
return out;
|
|
}
|
|
|
|
const idle = { kind: "Tap", on: "testTag:AccountCard" };
|
|
const submit = { kind: "Tap", on: submitOn };
|
|
const doubleSubmit = { kind: "DoubleTap", on: submitOn };
|
|
|
|
// A double-submit pops the back stack twice (each Submit calls
|
|
// navigator.back), so unlike a healthy single submit it lands back on Home,
|
|
// which is why the property can see it at all.
|
|
test("clean double submit: one action in the window, delta is 2x", () => {
|
|
const trace = run([
|
|
{ route: "home", totalText: "$0.00", lastAction: null },
|
|
{ route: "ledger", lastAction: idle },
|
|
{ route: "ledger", lastAction: idle },
|
|
{ route: "home", totalText: "$100.00", lastAction: doubleSubmit },
|
|
]);
|
|
assert.equal(trace[3]?.submits, 1);
|
|
assert.equal(trace[0]?.total, 0);
|
|
assert.equal(trace[3]?.total, 10000);
|
|
});
|
|
|
|
// The contaminated window from the android run: an unrelated submit committed
|
|
// while we were off Home, then the double-submit landed. The delta spans three
|
|
// transactions, so it is not evidence about either typed amount.
|
|
test("two submits between Home visits: the window is not evidence", () => {
|
|
const trace = run([
|
|
{ route: "home", totalText: "$0.00", lastAction: null },
|
|
{ route: "ledger", lastAction: idle },
|
|
{ route: "ledger", lastAction: submit },
|
|
{ route: "ledger", lastAction: idle },
|
|
{ route: "home", totalText: "-$130.00", lastAction: doubleSubmit },
|
|
]);
|
|
assert.equal(trace[4]?.submits, 2);
|
|
});
|
|
|
|
// Freshness is restored by seeing Home, not by time passing.
|
|
test("a Home visit between two submits restores a one-action window", () => {
|
|
const trace = run([
|
|
{ route: "home", totalText: "$0.00", lastAction: null },
|
|
{ route: "ledger", lastAction: submit },
|
|
{ route: "home", totalText: "$262.00", lastAction: idle },
|
|
{ route: "ledger", lastAction: idle },
|
|
{ route: "home", totalText: "$66.00", lastAction: doubleSubmit },
|
|
]);
|
|
assert.equal(trace[1]?.submits, 1);
|
|
assert.equal(trace[2]?.submits, 1);
|
|
assert.equal(trace[4]?.submits, 1);
|
|
});
|
|
|
|
// An unreadable Home is not a Home reading: it must not close the window, or
|
|
// the count would go back to zero against a total nobody read.
|
|
test("an unreadable Home does not close the window", () => {
|
|
const trace = run([
|
|
{ route: "home", totalText: "$0.00", lastAction: null },
|
|
{ route: "ledger", lastAction: submit },
|
|
{ route: "home", totalText: undefined, lastAction: idle },
|
|
{ route: "home", totalText: "$66.00", lastAction: doubleSubmit },
|
|
]);
|
|
assert.equal(trace[2]?.total, null);
|
|
assert.equal(trace[3]?.submits, 2);
|
|
});
|
|
|
|
// The window is an upper bound on the submits it holds, so a submit whose
|
|
// dispatch the runner could not confirm belongs in it: the tap may well have
|
|
// landed, and a bound that leaves it out is one the transaction it committed
|
|
// exceeds. That is the false conviction, a rise of one against a window of
|
|
// zero, on the property carrying most of the detection on android.
|
|
test("a submit the runner could not confirm still counts toward the window", () => {
|
|
const window = countSubmitsInWindow({
|
|
previousCount: 0,
|
|
lastAction: { kind: "Tap", on: submitOn, applied: null },
|
|
fresh: true,
|
|
});
|
|
assert.equal(window.reported, 1);
|
|
assert.equal(
|
|
committedTransactionsExceedSubmits({
|
|
countsBefore: { Travel: 3 },
|
|
countsAfter: { Travel: 4 },
|
|
submitsInWindow: window.reported,
|
|
}),
|
|
false,
|
|
);
|
|
});
|