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
257 lines
7.6 KiB
TypeScript
257 lines
7.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import { createdAccountHasNonZeroBalance } from "../../../examples/folio/sanderling/predicates.ts";
|
|
|
|
const created = {
|
|
kind: "Tap",
|
|
on: "testTag:AddAccountScreen > testTag:AddAccountSubmit",
|
|
applied: true as const,
|
|
};
|
|
const idle = { kind: "Tap", on: "testTag:HomeScreen > testTag:AccountCard", applied: true as const };
|
|
|
|
const account = (name: string, balance: number | null) => ({ name, balance });
|
|
|
|
// The property still has teeth: the account the fuzzer just asked for, holding
|
|
// money on the step its creation landed on Home, is a real violation.
|
|
test("an account created holding money is a violation", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test("a double-tapped create is judged the same way", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: { kind: "DoubleTap", on: "id:AddAccountSubmit", applied: true },
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test("an account created empty is what the app is supposed to do", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 0)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("a balance that could not be read is not evidence", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", null)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
// The false positives this replaces. Home lists the accounts that fit the
|
|
// viewport, so an account arrives in a later reading for reasons that have
|
|
// nothing to do with being created: the list scrolled, a clipped card finished
|
|
// laying out, or (before the route fix) the earlier reading came off a
|
|
// half-rendered Home mid-transition. Measured on android: an existing Travel
|
|
// holding $24,112.00 and an existing Savings holding $429,585.00, convicted for
|
|
// coming into view.
|
|
test("an account scrolling into view is not an account being created", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: idle,
|
|
typedName: "Travel",
|
|
before: [account("Emergency Fund", 461012300), account("Checking", 0)],
|
|
after: [
|
|
account("Emergency Fund", 461012300),
|
|
account("Checking", 0),
|
|
account("Travel", 2411200),
|
|
account("Savings", 0),
|
|
],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("nor is one that appears with no action at all behind it", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: null,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 2411200)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
// Even on the creation step, the only card judged is the one that answers to
|
|
// the name the fuzzer typed. A card that came into view alongside it is still
|
|
// just a card that came into view.
|
|
test("a funded account arriving beside the created one is not judged", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Savings",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Savings", 0), account("Travel", 2411200)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("off Home there is no reading to judge", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "ledger",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("a transition frame names no route, so nothing is judged there either", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: null,
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("an unknown reading on either side is not evidence", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: null,
|
|
after: [account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: null,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
// defaultActions types edge-case text into the name field, and an empty name is
|
|
// not a name we can find a card by.
|
|
test("an empty typed name attributes nothing", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: " ",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: undefined,
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
// Web merges the card into one node whose text opens with the avatar initials,
|
|
// so the identity key carries them: "TRTravel" is the card for "Travel".
|
|
test("the merged web key still matches the name that was typed", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("CHChecking", 0)],
|
|
after: [account("CHChecking", 0), account("TRTravel", 5000)],
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
// Two cards answering to one typed name leave the appearance unattributable:
|
|
// the fuzzer creates duplicates from a five-name list, and the tree has been
|
|
// seen exposing the same card twice on a transition frame.
|
|
test("two cards matching the typed name are not attributable to the creation", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000), account("MyTravel", 900)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("a card that was already there is not a card that was just created", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: created,
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0), account("Travel", 2411200)],
|
|
after: [account("Checking", 0), account("Travel", 2411200)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
// The apply call failed with the gesture possibly already delivered, so nobody
|
|
// knows whether that account was created. The card carrying the typed name may
|
|
// be an older one that scrolled into view, and attributing it to a creation
|
|
// that may never have happened is a conviction built on a guess.
|
|
test("a create the runner could not confirm attributes nothing", () => {
|
|
assert.equal(
|
|
createdAccountHasNonZeroBalance({
|
|
route: "home",
|
|
lastAction: { ...created, applied: null },
|
|
typedName: "Travel",
|
|
before: [account("Checking", 0)],
|
|
after: [account("Checking", 0), account("Travel", 5000)],
|
|
}),
|
|
false,
|
|
);
|
|
});
|