Findings and operational memory
Spago 1.0.4 uses env-paths and opens a SQLite cache database under the real
user directory. The sandbox rejected that access. scripts/cache.mjs overrides
Node’s os.homedir in the Spago process only to .build/home; it does not modify
HOME or the installed tool. On this macOS host the normal cache at
~/Library/Caches/spago-nodejs was copied to
.build/home/Library/Caches/spago-nodejs to allow cached package resolution.
That cache is ignored and is not part of the deliverable. No reference source
was copied into this compiler. The adapter clears host
XDG_CACHE_HOME/APPDATA/LOCALAPPDATA settings in the
Spago process so env-paths uses the workspace home on other platforms too.
Only macOS execution has been verified.
PureScript 0.15.16, Spago 1.0.4, purs-tidy 0.11.1, Go 1.26.4, and Node
26.6.0 are installed here. Spago’s package set 81.0.0 declares a 0.15.15
baseline but compiles successfully under pinned 0.15.16. Strict builds caught
Prim.Type/Function name shadowing and a redundant tuples dependency; both
were fixed rather than suppressing warnings.
npm could not resolve registry.npmjs.org (ENOTFOUND) during a package-lock
attempt. Local npm dependencies were unnecessary: the pinned tools are PATH
prerequisites. No npm install is needed to verify this repository once tools
and PureScript caches are present. Online installation still needs a separate
network-capable validation; local issue F001 records this distinction.
Compiler traps worth retaining
Go typed constant addition can reject overflowing expressions even though
runtime int32 addition wraps. Emit sprigAdd with int32 arguments rather than
folding source addition to a Go constant. Range-check source literals first.
PureScript is eager. maybe’s computed fallback executes even for Just; use
maybe’ with a named fallback function when work should be conditional.
Use either for Either; use maybe/maybe’ for Maybe. Name record builders and
transformations in where, not just simple pass-through branches.
Resolved IDs are deterministic array indices. Local values shadow function
names in call position and are rejected as non-callable; no source names are
copied into Go identifiers. This avoids Go keyword and helper-name collisions.
Negative checks must validate the expected diagnostic, not any failure.
The mutant must compile before its rejection assertion is tested. Mutations
run in .build/regression and never change live sources or normal output.
PureScript 0.15.16 does not re-export an imported type by naming it in
the export list: module A (T(..)) where import B (T(..)) fails with
UnknownExport. Re-export through an alias, import B (T(..)) as Exports
and module Exports in the list; the compiled module then carries export
{ … } from "../B/index.js", so JavaScript that loads A still finds T’s
constructors (Waxwing-6: Domain.Recorded.Origin re-exports
Domain.Recorded.Rule’s RuleId(..) this way).
Waxwing-6 named rule E1 literalRule (recorder-rules.md §3); before
it, Strategy.Effects.RecordCompanions had a private literalRule for
E20, a handler literal. That module now uses the shared handlerRule
(and blockRule for its former deferRule); read an old diff’s
literalRule there as E20.
Reference documentation boundary
The user explicitly authorized a MileAhead guidance amendment. apply_patch
rejected /Users/ethan/Desktop/trailmapper/AGENTS.md with:
“writing outside of the project; rejected by user approval settings”.
Do not claim it was changed and do not bypass the sandbox. The proposed patch
is in docs/patches/mileahead-eliminators.patch.
Planning workflow
Plan, durable findings, and verification evidence must precede further broad
exploration. docs/plans/bootstrap.md owns task status; docs/progress.md owns
what actually ran; ADRs own decisions; BACKLOG.md owns future and unresolved
work. A future skill installation must not silently replace this convention.
purs-tidy 0.11.1 writes its version to stderr with success status. The version
gate checks the combined output exactly, rather than assuming stdout.
Skills migration prerequisites
Escalated bunx installation and GitHub access succeeded on 2026-10-07; the
earlier npm DNS failure remains historical, not a claim of current outage.
Fresh compiler prerequisite installation/cross-platform builds remain untested.
All 15 pinned skills plus helper files are installed in .agents/skills.
At migration, Git had no commits: git rev-parse –verify HEAD reported “Needed a
single
revision”. task-start/task-done require HEAD/BASE and review-package requires
commit ranges; do not invoke them until a real checkpoint exists (W001).
Sandboxed git status also emitted xcrun temporary-cache permission errors;
escalated Git inspection worked. Record this environment distinction (F003).
The reviewed pinned writing-plans uses self-review rather than a plan-review
subagent. At migration the audit plan was self-reviewed only; execution had not
begun. Existing docs stay durable even when scratch is cleaned.
Bootstrap audit findings
Computed record/error fallbacks in Lex.scan, Parse.Core.failAt,
Parse.Expression.integer, Resolve lookups, and Check.checkLocal used eager
maybe. They now use maybe’ with named fallback functions. Context-dependent
traverse/filter callbacks in checking/resolution are named in where. Resolver
globals moved from an independent do-let to where. Branch rendering/building
work was extracted and private Parse.Core plumbing is no longer exported.
Architecture prose overstated defensive E_INTERNAL coverage: Check checks
local/call indices during inference, but trusts the resolved entry/table
structure. Documentation now states that exact contract. The CLI respects an
existing GOCACHE; README now describes its default, rather than an override.
The ten-arm (now twelve; see BACKLOG E003) codeName mapping exceeds the
eight-branch review target; splitting
a short exhaustive ADT tag mapping would obscure its wire contract. E003
records it explicitly. Other declaration budgets were reviewed manually;
module/file limits remain automatically checked. The Spago no-files message
for test/*/.purs is informational: tests are Node .mjs files. Actual strict
build tables report zero warnings/errors; no message was suppressed.
A setup command accidentally ran an extra verification in the original root
after worktree creation. It passed but is not the worktree baseline evidence.
The separate clean-output worktree run compiled 269 modules and passed 19
tests plus the regression proof; .build/audit-baseline.log in the worktree
is the actual evidence. Both locations’ previous outputs were preserved.
Task 1 verification initially failed with ModuleNotFound for
Sprig.IResolved.Internal. A naive R.-to-Resolved. replacement also matched
the suffix of IR.; it corrupted the import and IR references in Check.purs.
The replacement is corrected, not retried unchanged. The original failure
is preserved in the execution workspace task-1-failed-alias.log. A copied
defective source tree independently failed purs compile with the same missing
module in .build/alias-regression/failure.log. The build itself detects this
edit failure; no gate or assertion was disabled.
The isolated reproduction helper incorrectly expected diagnostics only on
stderr, while purs wrote them on stdout. That helper assertion failed before
the live fix ran, and its trailing verify re-observed the still-broken build
in .build/audit-task-1-fixed.log. Inspected the combined saved output, confirmed
the expected missing module, then corrected live IR references. Those logs
remain evidence of the failed attempts, not successful fix evidence.
Execution setup resolved W001 with baseline 9624bec and the user-authorized
audit/bootstrap-docs worktree. Full verification from clean output passed
there, and Task 1 changes are committed at 4410609. Docs are handoff artifacts,
not evidence that unimplemented ADTs or hostile-IR validation exist.
The fresh whole-branch review found no blockers and one minor item: two test
titles overstate assertions (E004). The existing named-helper fixture uses
maybe 0, not a computed maybe’ fallback; the snapshot test makes one direct
compile, not repeated CLI invocations. Manual repeated CLI emissions now
independently agree. These titles are deferred per executor minor-finding
policy, without weakening the tests or overstating their automated coverage.
A001 closure observations (2026-10-07)
- F004 reproduced during Task 6: a promoted strict warning appears only on the
build that compiles the module. Clean-output verify is the workaround; the
fix is open in BACKLOG.md.
- Four
sprig-regression-* directories from earlier Task 3-era probe runs
remain in $TMPDIR; a clean verify did not add any. Tracked as F005.
- The nil-guard policy deliberately does not validate fields skipped by
wildcards or binders (ADR 003); this is a documented limit, not a defect.
E_USAGE, E_IO, E_TOOL are strings in Format.Wire (A005).
A001 final review fixes (2026-10-07)
- A function/constructor clash was reported at the constructor even when the
function came first, because constructors were checked before functions and
the program keeps the two in separate arrays. Source order is now recovered
from span offsets. Record: docs/plans/closed-adts-review.md.
- Random flat multi-arm matches are often redundant (an arm subsumed by an
earlier one), so the flat execution property uses a seed whose programs are
all accepted, asserted to reach a third arm and the
_ tail.
- The old coverage oracle passed a mutant that offers uninhabited
constructors; only the generated-type-system test catches it.
F004 fix (2026-10-07)
- purs recompiles a workspace module whose output directory is missing, so
deleting only workspace module outputs is enough; a full clean is not
needed. Each build now recompiles the 32 workspace modules (about 1 s).
- The strict-rebuild proof copies output and .spago (about 40 MB) into
.build/strict-rebuild and shares .build/home by symlink; verify takes
about 8 s longer. It deletes the copy only on success, leaving it for
inspection after a failure.
A003 observations (2026-10-07)
- Test time is dominated by
go build, one binary per executed program, not
by the JavaScript runtime (BACKLOG T001).
- A second quadratic resolver cost survived Task 3b:
uniqueTypes,
uniqueCtors and typeInfo (which filtered every constructor per type).
The final-review fix wave made them Repeated-based or linear.
- Go emission searched the type table per constructor (
tagOf) and every
constructor per type (Show), so 20,000 one-constructor types took 25.7 s
to compile; one constructor layout per program (Format.Go.Layout) brought
it to 0.2 s with byte-identical output. Many-declaration tests should cover
every declaration kind, not just functions.
- Go
== on generated structs would compare field pointers, so comparison
always goes through generated helpers (ADR 005).
- Printed values reproduce themselves under the same declarations: the
witness format minus
_ is valid source, which made the print round trip
a strong printer test. Re-reading is bounded by E002 (constructor nesting
overflows the parser at about 420 levels in a cold process).
- The coverage-oracle LCG used low bits that alternate, so seeds were
reselected in Task 3b with assertions unchanged.
G001 observations (2026-10-07)
- An applicative-only
Parser was enough for the whole grammar because
every choice is LL(1) on the next token (dispatch); the only sequencing
on parsed values is refine, which checks a value without consuming.
The style gate is syntactic, so it also bans run/initialState
imports outside Format.Parse: running a sub-parser and inspecting its
result would be Bind by another route.
- The combinator layers cost more stack per nesting level than the
hand-written parser (cold
Cons(1, capacity fell from about 419 to 313
levels in Task 2), so the limit was derived from a measured minimum
(304, ADR 006) rather than chosen first; 128 also bounds printed lists,
replacing the A003 note above about 420 levels.
- Breadth overflows hid in three more places once the parser stopped
crashing first: the resolver’s Array.foldM (about 1,700 arms or
arguments), Coverage.redundancy’s Array.foldM (about 1,929 arms) and
Usefulness’s two constructor searches (about 2,000 constructors).
Array.foldM over Either nests one bind per item;
traverse is balanced
and tailRecM loops, so both are safe.
- The G001 final review found two more that the breadth tests missed,
because those tests declared wide types but never matched on them:
usefulness and algorithm I recursed once per pattern column (a
1,600-field constructor pattern overflowed) and the inhabitation fixed
point recursed once per pass, one pass per link of a type chain (3,000
chained types overflowed). A per-item recursion hides wherever a test
only exercises declaration size; test each phase at width. Also,
Array.modifyAtIndices nests one ST bind per index and overflows between
6,000 and 8,000 indices, so the new worklist sets flags in chunks.
- Go’s inliner expands nested immediately invoked closures exponentially:
a match nested 24 deep took 34.6 s and 7.5 GB to build (BACKLOG E005).
Lowering each match to a named top-level function removed the blow-up
(128 nested matches build in 0.14 s); an emitter shape that is cheap in
PureScript can still be pathological for the target’s optimizer, so
depth tests must build and run, not only emit.
- A flat sum counts one level per operator, so 130 operands are E_NESTING
although the phases overflow only near 2,928 operands (ADR 006 table);
lifting it needs iterative chains in every later phase (BACKLOG O001).
Language-direction planning gap (2026-10-08)
Review of the direction document identified an untracked prerequisite:
the current IR has named Call but no function values/lambdas/closures.
FN001 now follows P001 before C001/R001/FX001. Joint class/record design
must consider a shared record-of-functions representation. Row-layout
specialization growth and polymorphic fields are distinct risks; a fallback
is an option, not an approved change to ADR 002. Default lowered-IR position
is after specialization and above layouts. D001 records text/numeric/
collection foundations alongside M001; FX001 compares ZIO/Koka families.
No P001 code or active worktree changed.
The source-language effect system was only a phrase in I001 and the
self-hosting roadmap; compiler Host ports do not implement it. Recorded
FX001 for a dedicated design coordinated with rows/classes/FFI. Current
discussion and unsettled choices are in
docs/plans/2026-10-08-language-direction.md. “Hostable” was clarified to
mean inspectable intermediate representations, so no embedding VM was
selected. Rows simplify service requirements but do not decide runtime
resource/cancellation semantics. Documentation only; no feature implemented.
P001 observations (2026-10-08)
- A source nesting limit does not bound inferred types. Composing generic
calls multiplies depth (
fn deep(x: a): L^127(a) nested 44 deep infers
about 5,600 levels within every source limit), and the unifier, resolve
and the occurs check recurse over type structure, so a legal program
crashed with a RangeError (Task 4). Ruling R7 added the inferred-type
bound (ADR 007), and it took three fix rounds to make it hold:
- Fix 1 checked each expression’s type when built, both operands
before each unification and each finished body. Review found that
metas bound earlier in the same unification chain into each other,
so two operands that were each within the bound unified as chains
about 1,780 deep and still overflowed. Fix 1 also stated a 5x margin
using resolve’s overflow figure; unify, the binding limit, gives
about 1.5x.
- Fix 2 threaded a level through unification (one per applied type
entered, which equals resolved depth) and failed past the limit.
Review then found six or more L^997 links bound in one unification
still overflowing, in
bindMeta.
- The cause:
bindMeta named resolved = resolve subst ty in a
where, guarded by an if exceedsLimit … then … else … in the body.
PureScript where (and let) bindings are strict: the compiled
JavaScript evaluates every binding before the body runs, so the
resolve ran before the guard that was meant to prevent it. Fix 3
moved the resolve into bindBounded, a function called only after
the bound, and audited the compiled output of Features.Check* for
other strict bindings that recurse over a type (all run on bounded
types).
Lesson: in PureScript, a where binding is not lazy; anything a guard
must protect belongs in a helper function called from the guarded
branch (AGENTS.md’s maybe' rule exists for the same reason). And a
bound is only as good as the deepest path that runs before it; review
each recursion, not each entry point.
- Whole-type keys hide quadratic and exponential costs: Task 6’s coverage
keys made a 3,000-type growing chain take 16.6 s, and argument-doubling
chains give exponentially large keys. Specialize therefore hash-conses
its keys (R15), numbering each ground application once; Expand still
uses whole-type keys (BACKLOG E008).
- Regression mutants must change one thing the probe can see. The
spec-key mutant keys only the data-type arguments of a type
application, without their identity, so List(List(Int)) and
List(List(Bool)) collide; the Go build then fails on mismatched
struct types. Removing the occurs check does not loop forever: the
cyclic binding is caught by the inferred-type bound (E_NESTING), so the
occurs probe requires the exact E_TYPE text rather than any
rejection.
- Binding direction is a complexity choice. Binding the older of two
unbound metas to the newer chains siblings into one long path that
every later walk follows (a 5,000-arm
Nothing match took 15.8 s);
binding newer to older keeps every sibling one link from the oldest
(1.55 s). Union-find’s rank heuristic is the general form; meta age is
a free approximation here.
- A timing bound’s headroom must survive the parallel test runner. A
2.9 s workload under a 5 s bound failed once in three reviewer runs and
every time with three suites at once; the fix was the workload (Expand’s
deep
Ord key comparisons), not the bound or a rerun.
- A single cold compile costs about 1.4× the steady-state sum of its
phases (JIT warm-up and GC), and the PureScript pipeline allocates
about 15 KB per source byte (2.8 GB for the 150 KB match ladder before
T003). Measure a timing test’s workload as the test runs it, in a
fresh process: T003’s steady-state per-phase sum fell 332 → 237 ms,
and the cold compile the test times 507 → 370 ms.
go build is superlinear in the size of one Go function or
expression even when the generated text is linear (FN001 Task 1,
design §13): an n-argument application chain in one function is
k ≈ 2 at n = 5,000 to 20,000, and a stage that unpacks n locals and
makes an n-argument call is the superlinear part of the linked
environment. Linear text is necessary, not sufficient; measure the Go
build at the largest size a test claims, and judge growth by the
exponent, not by a ratio bound (a “within 5 × 4” bound passed a 16.4×
quadratic build).
- Go’s own build cost is superlinear in the size of one function body
even when its signature is not (FN001 Task 1 round 2: a 20,000-
parameter signature is linear, k = 0.19; an ordinary body reading each
parameter twice is k = 2.24 under today’s n-ary convention). Linear
generated text did not give linear
go build for the tested large
bodies (this does not show that no representation could); bound Go
builds by measured times at stated sizes, and keep linearity claims
for Bumpus’s own phases.
- A mutant’s survival is a claim about the tests run, not about the
suite (FN001 Task 9): Task 8 recorded that derived
Eq/Ord on
Domain.Type.Ty “survives all Task 8 tests” after running five files,
and the gap was carried forward; test/type-order.test.mjs (Task 2)
fails on it with RangeError. Name the files a mutant was run against,
and run the whole parallel phase before calling a defect uncaught.
- A lowering mutant should still emit Go that builds, so its probe fails
on behavior (which body runs first, what prints), not on a Go type
error; when the built code no longer has the representation a plan
names (an uncurried value), restore the defect’s effect (an eta
adapter at the type’s arity) and say so.
FX001 Task 1: runtime shapes (2026-10-09)
Hand-written Go of effects design §4 (scripts/effect-probe.mjs; raw output
in .build/fx001-task1/, run3.log is the record). Host load averages 2.6-5.8
(uptime before and after each batch in the log), so timings are upper
bounds; five runs each, median (min-max), checksums matched everywhere.
| Configuration |
Median ms (min-max) |
| 10^6 shallow installs |
18.3 (16.3-36.2) |
| 10^6 performs, depth 1 |
1.65 (1.62-1.77) |
| 10^6 performs, depth 100 |
79.8 (79.4-79.9) |
| 10^6 performs, depth 10,000 |
11,770 (11,567-12,012) |
one abort across 1,000 unrelated handle frames |
34.9 (34.3-35.1) |
| one abort across 1,000 cleanup frames |
27.5 (27.1-27.8) |
| 100,000 caught aborts, depth 1 |
19.9 (19.3-20.5) |
go build, lifted helpers |
Median s (min-max) |
Ratio to previous |
| 1,000 |
0.83 (0.81-1.17) |
|
| 2,000 |
1.53 (1.51-1.56) |
1.84 |
| 4,000 |
2.91 (2.88-2.97) |
1.90 |
Observations, not a linearity proof: the ratios are close to 2 for 2x size.
Lookup is linear in depth (about 1.2 ns per link; 11.8 s at depth 10,000
justifies the cached-index follow-up for FX005, not a design change).
Installation is about 18 ns each (one heap allocation). A caught abort is
about 200 ns; an abort through 1,000 re-panicking frames costs about 35 us
per frame. Decision rule: every semantic check passed and the 4,000-helper
median 2.91 s is within 10 s, so the shapes are adopted. Pitfall recorded:
Go’s build cache makes identical regenerated sources look 8x faster; vary
the source per repetition when timing builds. Design reading to confirm in
FX001 review: a cleanup failure of any kind while a typed abort is pending
turns it into an uncatchable defect listing both causes. Superseded by the
user 2026-10-09: defer must not fail (spec §2, §3), so only defects can
fail cleanup and a pending typed abort is never converted by a typed
cleanup failure.
Waxwing migration baseline (2026-10-09)
The existing isolated FX001 worktree was clean at 3481468 (Tasks 1-3
committed), while main remained at 2084638 with its pre-existing editor
settings change. Rename work uses the FX001 checkpoint, not main.
Before production edits, npm run verify exited 1: 638/640 parallel tests
passed. fn-linear lambda took 1604.135291 ms against 1545 ms; mismatch
819.499333 ms against 525 ms. Serial tests and regression proofs were not
reached. Evidence .build/waxwing-baseline-verify.log; FN006 owns the
existing parallel-timing exposure and next action, with no bounds changed.
Historical findings and paths above remain unchanged by the rename.
Concurrent FX001 checker edits appeared during rename validation, outside
its source scope (Binding, Require, Subst, Unify, UnifyRow). Preserved their
diff/hashes under .build/waxwing-concurrent-*; do not revert or attribute
them to the rename. A later harvest smoke could not import Format.Parse
because output was absent; this is not evidence of a hook defect. Require a
paused worker and stable build before combined-tree validation. The rename
verify’s twenty-thousand-declaration timing failure is recorded in T004.
The user confirmed the FX001 worker paused. Its eight modified files are
preserved (the previous five plus Domain.Type.Parts, Features.Resolve and
Features.Specialize.Seeds). Combined-tree verification builds cleanly but
fails test/unify-row.test.mjs:57: deferred Fail now returns Subst rather
than the test’s RowMissing. R003 records the exact test and next action for
FX001; no assertion was changed by the rename. Five fn-linear timing
failures are recorded in FN006. An accidental extra combined-tree verify
ran from the wrong working directory; its separate failure log is
.build/waxwing-paused-extra-verify.log (636/640 pass). A subsequent log-move
command used that same wrong relative-path assumption and failed; the log
was then preserved at its correct path. These are execution mistakes, not
additional compiler defects. Isolated rename validation uses the original
3481468 versions of the eight worker files in a copy only, leaving live
files intact (.build/waxwing-validation-scope.json).
FX001 Task 3 fix continuation (2026-10-09)
The inherited matching-path postponement still immediately rejected a
left-over deferred right label in finish. New row-deferred regression ran
first: 9/10 passed; the left-over case failed with RowExtra
(.build/fx001-task3-fix-red.log). Guarding that path by the resolved key
now postpones the entire pair with rollback, just like the matching path.
Focused post-fix run passed 44/44 (.build/fx001-task3-fix-focused.log).
The eight inherited source edits were preserved and completed; no fresh
RED history is claimed for their already-implemented behavior. Isolated
source mutants supply regression proof for those inherited fixes.
Operational failures: an exploratory read requested nonexistent
scripts/test.mjs (verify is scripts/verify.mjs); no check was omitted.
After the user interruption, the former focused-run session identifier no
longer existed; its complete 44-test TAP summary confirmed completion.
No duplicate build/verification was started. FN006’s timing suite is
renamed to fn-linear-timing.serial.test.mjs with identical file contents,
under the user’s authorized existing serial-runner policy.
The continuation’s single clean-output full verify exited 1
(.build/fx001-task3-fix-verify.log): zero build warnings/errors, tidy,
strict-rebuild and structural gates passed; 643/644 parallel tests passed.
The sole failure was the existing match-lift ladder timing bound:
1670.670250 ms >1500. T003 records the exact evidence and next profiling
step; no bound/runner change or unchanged rerun hides it. Host load observed
afterward was 5.89/5.64/4.54, which does not establish causation. Serial
verification and regression proofs are run explicitly as the unreached
remainder, with separate logs and statuses.
Controller ruling after this reproduced T003 failure: apply the existing
fixed-bound scheduling policy by extracting only the deep/wide ladder
block into match-lift-timing.serial.test.mjs with its required imports.
All semantic match-lift tests remain parallel; the extracted block/source,
constants, assertion and 1500 ms bound are byte-identical
(.build/fx001-task3-fix-ladder-identity.txt). First serial continuation
passed 21/21 (.build/fx001-task3-fix-serial.log). A second clean-output full
verify follows the actual scheduling change, preserving the first failed
log; it is not an unchanged retry. No further scheduling iteration is
authorized blindly if another timing failure appears.
After the authorized scheduling extraction, the changed-tree clean-output
npm run verify exited 0: 643 parallel + 22 serial tests, no failures/skips,
zero build warnings/errors and all 22 existing regression proofs
(.build/fx001-task3-fix-verify-serial-scheduling.log). The ladder test took
410.995667 ms total against its unchanged 1500 ms timed-compilation bound.
The original failed log remains. No later-task effect syntax/runtime
behavior is claimed; deferred origin/provenance retention remains Task 9.
FX001 Task 4: omitted rows in lambda annotations cannot resolve as pure.
Resolve marks them with the signature’s unwriteable ambient variable;
Check substitutes only that row slot with the lambda’s fresh row. Named
row variables and type variables remain rigid. New Console callback and
legacy comparison diagnostics verify the distinction. Collecting signature
row variables must loop over long arrow spines, just as type collection
already did; a 20,000-arrow regression and restored-source mutant pin it.
Full verification: 672 parallel +22 serial tests, 22 existing proofs and
four new isolated source sensitivity checks (docs/progress.md).
FX001 Task 5: handler checking is complete through Check only. Rowless
Handler(Name) is ambiguous with an ADT application, so resolution prefers
a declared type named Handler and uses the effect interpretation only when
no such type exists. Explicit with makes the special type unambiguous.
Repeated duplicate scanning exposed a strictness trap: when predicate
(expensive Either) evaluates the diagnostic computation even when the
predicate is false. Guarded branches keep it limited to actual collisions;
one combined repeated-name pass preserves constructor/function namespace
checking. The 20,000-type duplicate test is 475 ms after the fix (same 5 s
bound); an isolated restored-strictness mutation fails that workload’s
timing assertion. Full Task 5 evidence and Task 9 deferred-row provenance
handoff: .superpowers/sdd/2026-10-09-effects-plan/task-5-report.md.
Module boundaries and explicit instances (2026-10-10)
C001 already called for several selectable instances per type without
mandatory newtypes. The new modules-and-instance-selection direction expands
that requirement to dictionary construction and composition, and coordinates
it with M001/R001. Explicit selection removes implicit-choice ambiguity but
not ordering consistency in collections or obligations for algebraic laws.
Rust restricts orphan implementations; Haskell permits orphan instances with
GHC warnings. No compiler behavior changed or runtime guarantee established.
Set-aside constraints must be judged, never dropped (FX009, 2026-10-10)
The scoped-label unifier sets aside a Fail pair whose key is not yet
known, and settleRows retries it. A pair that is never decided must
become a diagnostic. Before FX009 it was dropped, and a failure could
escape to run time. Any constraint deferred “until more is known” needs
an explicit final judgement. Rejecting malformed labels where they are
written (no family key) keeps the final guard a backstop rather than the
primary diagnostic.
Schema and parsing boundaries (2026-10-10)
The roadmap mentioned schema ingress only as research, not a first-party
requirement. SCH001 now records the user’s explicit direction. Effect and
schemata-ts connect parsing/encoding with test-data generation; schemata-ts’s
Schemable interpretation is relevant to selectable class dictionaries. Derived
generators do not derive business properties, prove laws or independently
validate a parser generated from the same description. Arbitrary predicates
and lossy transforms need explicit support and codec-specific laws.
SCH001 precedent comparison (2026-10-10): the interpreter-parametric idea
has a direct io-ts precedent and broader tagless-final literature. ZIO
Schema supports the multi-interpretation goal through a different encoding.
Effect also has an AST and interpreter customization. Library-specific
conveniences do not establish architectural superiority; io-ts’s relevant
API is explicitly experimental. Details/sources in schema-direction.
Shared checkouts need explicit staging (2026-10-10)
Two sessions edited one checkout concurrently. A git commit -a in one of
them swept the other’s uncommitted SCH001 edits into an unrelated commit.
It was split before publication. Independently, a second session recorded
the FX008 hole as a new BACKLOG row on its own branch, duplicating this
branch’s record. In a shared checkout, stage explicit paths. Before adding
a BACKLOG row, check the other active branches for one.
Requirement inference must include both error boundaries (2026-10-11)
INF001 records the user’s service-assembly and business-logic error
composition requirement. Dependency provision does not remove operation
errors; effectful assembly adds its own reachable setup errors. Handling
errors must account for recovery’s own errors and requirements. Local lambda
inference does not establish named-function inference: today’s rigid ambient
signatures deliberately reject undeclared own effects. Generic Fail(a) and
same-family payload keys are additional parity questions. See
the milestone.
A defer can run under a handler that fails (FX008, 2026-10-12)
The hole. FX001 rejected a defer that performs Fail, but allowed one
that performs another effect such as Log. If the handler of that effect
had a clause that fails, the cleanup ended in a typed abort, with a
fail(E): E run-time error where the type system promised none. Neither
rows nor the label check could see it: a row says which operations a
computation performs, not whether the frame that handles them can abort.
Its cause. The type of a handler value (Handler(Log with R)) records what
the clauses perform, and with unified R with the context, so a clause’s
failure reached the context only as a Fail label, and only when the
handler was installed in view. A function’s signature said Log, and
nothing said which Log handler it would meet.
The rule. A label occurrence carries a mark (nofail or plain). A defer
may perform an operation only if every frame it can meet is fail-free;
each installation has its own frame mark, constrained by the handler’s
own-abort mark and by the outer frames its clauses reach; consumption
imposes context mark <= stage mark; and the constraints are solved as a
path check over a two-point lattice with rigid mark variables. Programs
without defer keep their acceptance, by a one-way hook that keeps R in
step with the clauses. Sound but imprecise cases are recorded as
limitations (L1 with P5, L4, L6, and handlers passed through generic
functions).
Lessons from building it. Every simpler design failed on a probe: sharing
marks through R, equating marks when R unified, consuming R, an R-to-R
link, and an alias of R as the clause row all rejected safe programs or
depended on the order of bindings. Letting C carry label arguments doubled
the work at each level of literal nesting (30 chained literals timed out).
A closed result C failed to merge with a C that had more labels. Each
became a regression row with a named mutant; the one-way soundness
differential (compiler acceptance implies the oracle never reports
typed abort escaped cleanup) found no unsound acceptance.
FX001 Task 11: callback rows (2026-10-12)
Found while writing the acceptance scenario’s effect-free baseline
(test/fx-services-programs.mjs); both are existing behavior, not changed.
- A callback parameter with a written closed row (
q: Int -> Int with L)
is unified into its caller’s body row, not subsumed by it. A function
with L + M that calls q is rejected at the call: a performs M,
which its signature does not allow. The same happens with L + Fail(E).
A written callback row must equal the caller’s row label for label.
FX017 (2026-10-12) gave it its own diagnostic, q must allow every
effect of a (L + M), but its row is L, with the caller’s label, the
callback’s row and both written rows named; whether the callback’s row
should instead be subsumed by the caller’s stays open (FX007).
- A callback whose row is ambient or
with Console cannot be deferred:
defer must not fail, but it may perform any effect of .... A written
with Console on a parameter keeps a rigid tail, and no closed Console
row can be written on a callback, so only with pure callbacks defer.
Together these forced the baseline’s callbacks to with pure, and its log
lambda cannot print, so the baseline is compared with the scenario by keys,
not output, and the scenario carries no Fail. For item 2, FX007 (BACKLOG)
is the relaxation that would let cleanup call effect-polymorphic callbacks;
item 1 is FX017.
FX001 Task 12: regression proofs (2026-10-12)
Learned while retargeting mutants for the fifteen new rows
(scripts/regression-fx.mjs, scripts/regression-fx-go.mjs):
fx-cleanup-context has no single-line restoration. The cleanup
closure captures its block’s own ctx, so the exit-time context cannot
be restored by editing one expression. The mutant makes waxwingInstall
mutate the caller’s context in place, which gives cleanup the context at
exit. It also leaks installs past their with; the probe observes only
the cleanup operation (1,9 healthy, 101,9 mutant).
fx-ctx-reachable is an entry-body-only stand-in. Effect layouts exist
for any operation an unused function uses, so the needle must remove the
program.effects test together with the function scan; the row then
restores “mode by what the entry function contains”, not literally “by
reachability from main”.
- A mutant must sit where the defect is raised.
fx-closed-opened first
targeted UnifyRow absent, which the probe never reached: the
rejection of a Console lambda given to a with pure parameter arises
in RowFinish. fx-layout-edges needs the mutually recursive pair A/B;
the self-recursive Grow is rejected without the dropped edge.
fx-defer-fail and fx-defer-unified overlap: both accept a late
Fail (a closure whose Fail arrives after the defer) when either
defect is restored. The rows differ in which line of Check.Defer is
restored (the Fail refusal, or checking against the current row).
- The regression runner leaves about 2 GB under
.build/regression per
run; delete it afterwards (see the disk-hygiene rule).
- FN006 (1): the zero-argument call gap in the oracle parsers is closed
for
f() but not for make()(x), which still has no oracle row
(BACKLOG FN006).
ctl and resume are reserved everywhere, but the dedicated E_SYNTAX
General control (ctl/resume) is not supported yet appears only in
expression position (Format/Parse/Expression.purs). Probed with the CLI:
resume(1) gives that message; effect E { ctl op(): Int; }; gives
Expected '}'; with handler E { ctl op() => 1, } {...} gives
Expected an identifier. Spec §1 asks for a dedicated diagnostic; the
code falls short in the two declaration positions (BACKLOG FX006).
FX020: effect namespaces (2026-10-14)
node scripts/width.mjs checks git-tracked files only. A new, unstaged
file passes the gate silently; run it after git add. The Task 5b commit
claimed a clean width gate and had an 81-column line for that reason.
- A
where helper without a type signature is monomorphic: one used at two
record types (Unbound’s built-in and user effects) fails to unify. Lift it
to a top level function with a row-polymorphic signature.
- A regression probe that only asserts “program was rejected” hides which
rejection a mutant produces; print the code and message
(test/regression-fx020.mjs
prints).
- The unbound-name hint is not narrowed by the row, by design: resolution
never depends on rows, so it also offers the import form inside lambdas and
for effects that cannot be imported; FX022 (done) made the import
form write
Fail(E) { fail }.
- V8 warm-up changes the stack depth available to the first
compile of a
near-limit source (BACKLOG G006); paired comparisons of old and new trees
need node --stack-size=3000, never a retry.
R001: records (2026-10-14)
- A regression row’s
message must pin the restored defect’s symptom (the
Go error or the wrong output), not just the probe’s own failure label:
the five Task-10 rows matched only the label, so any mutant failure,
such as a checker crash, would have satisfied the proof (tightened in
Task 11).
- Sort inference over declarations needs both directions, alternated until
nothing changes, and one check of every use afterwards. A one-way fixed
point, then one pass each way, each accepted contradictory programs or
rejected valid ones (Task 3, four review rounds; ADR 013 “Row sorts”).
Reading only the previous round’s sorts (Jacobi rounds) removes the
dependence on declaration order.
- Unifying a record’s shared fields can bind the record’s own tail
(
{ a: { ...r }, ...r }); deciding the tails from rows flattened before
that overwrote the binding (Task 4 review). Flatten again after the
fields unify.
- The depth probe’s boundary is noisy by one: parens-in-call-in-constructor
read 325 once and 326 otherwise on the same tree (Tasks 4 and 5). Sample
the boundary repeatedly before calling a margin lost. Moving hot helpers
(
resolve*, the Subst constructors) out of Features.Check.Subst cost a
unit of margin and was reverted (Task 1).
- A new field in a phase’s output (IR
records, checked sorts) makes
every program differ in the differential; normalise it in the digest
only where a baseline without it agrees, and say so (Tasks 7 and 8).
- Field access through a nil declared-type pointer inside a record is a
raw Go nil dereference; only foreign code can make one, and comparison
and printing are nil-guarded (Task 7 review; BACKLOG I001 note).
- The instantiation rule does not see record-row arguments: a recursive
call that grows a record row reaches the 10,000-specialization limit
instead of the rule’s diagnostic (found while writing ADR 013; BACKLOG
R010).
- Seeding lacks only at signatures, constructors and operations left
every type written in a body unchecked against its signature’s rigid
tails; the hole reached
go build (a field declared twice), so it was
not latent (final review C1). Treat every written type as a seeding
site, and keep a lowering-time guard so a checker hole is an internal
error, never a Go failure.
- The ambient row is a function’s own row tail as well as its callbacks’
row; any type that shares it outside a callback position (a label’s
argument, FX024) must equal the caller’s whole row at each call. Give
such positions no ambient row.
- A declared type’s arguments are numbered two ways: by written
position, and by variable place (type and record parameters first).
Resolve.Lacking read one as the other, which only an effect row
parameter before a record one exposes (R012,
r012-slot-position).
Convert in one named helper (RecordArguments slotOf).
- Making a form writable widens every rule that assumed it was not: once
a record row argument could hold fields, the declarations’
instantiation rule, which skipped row arguments, admitted rows growing
through recursion and the checker overflowed its stack (R012). Audit
each rule that says “stands for no type” when a form becomes writable.
R005 Tranche B: case 2g (2026-10-19)
- A classification rule run at the end hides order differences an
earlier rule causes. The 2g proposal was measured only with H on and
reported “no order difference”; before H, its wait on a missing atom
kept case 3 from refusing, and refusals became order dependent
(
kindDiff 4 in each shaped family; the compiler’s judge, which runs
before H, caught it in “program-shaped, shared”). Measure a new solver
rule with and without any later classification, on every generated
family the judge runs (research/row-merge-qt node qt-2g.mjs).
- A precondition that only limits where a rule applies must make the
rule step aside, not return “no progress”: a no-progress answer stops
the cases after it. Case 2’s wait on a missing label is PureScript’s
and kept; 2g’s makes no claim (rules file §3a, “The amendment”).
- A research prototype’s options object is copied field by field
(qt-facts.mjs
makeState): a new option passed in but not copied is
silently off, and a variant run with it measured nothing new until
the field was added. Check that a new option changes some verdict
before reading its measurements.
- Once H classifies at the end of a body, a regression that only turns
a refusal into a wait (the superseded 2g) is refused anyway, so a
test of the refusal’s class no longer catches it. Keep a check with
H off (the entry’s
finishWithoutH) wherever an earlier rule’s
refusal is what is being protected; at the check phase, compare the
location, since H refuses at the predicate’s site (B4,
r005b-case2g-claim).
- scripts/width.mjs reads
git ls-files, so a new file is not checked
until it is added; B3 and B4 both met this (lines over 80 in new
files reported clean). Run git add -N <path> on new files before
checking widths; verify, which runs on a committed tree, is not
affected.
readdirSync(...).sort() orders diag-06-fix.json before
diag-06.json (- sorts before .), so lists of fixture names in
tests follow that order, not the names’ own.
R005 Tranche B Task 7: stopped for the foundation assessment (2026-10-20)
- A behaviour-preserving split can break a test that names files: the
structural metadata test (test/r005b-render.test.mjs) listed the
modules that write metadata by file name, so RowMerge/Chain, split
from Desugar in 22d3631, read as a solving module and the test
failed. The split was committed after a build and the formatter
only, with no test run; the differential’s harvest, which runs the
suite in the frozen copy, caught it. Run the suite on a split commit’s
own tree before committing it. Fixed in 43b3a28.
- A differential run reads the candidate’s output/ while it runs:
rebuilding output/ in the working tree mid-run invalidated one run
(module not found). Run the candidate from a frozen copy
(
git archive of the commit, built there).
- The approved provenance precedence (written lacks, written disjoint,
implied, spread) hides D2’ found late when a solving case binds
between the two items’ arguments: the case’s binding states the
second part’s lack as
Implied (a row the checker made), which ranks
before Spread, so f({ a: 1 }, { a: 2 }) through fn(p, q) => {
...p, ...q } reads Tranche A’s shape text. D2’ late is reached when
one unification binds both parts (a callback whose parameter types
are given; one argument holding both). On r005b-task7-wip, pinned
as d2-late and a control; the precedence is the author’s to change.
- B5’s case-bound blame (Check/Fault, R10.1 as amended by decision 22)
took any field of either failing record that a case-bound part cannot
take:
.x on a removal’s rest after drop({ y: 2 }, { x: 1 }) read
so s cannot have field y, though y is on the record that is fine
and x was removed. On r005b-task7-wip, blame is limited to a label
one record holds and the other cannot take, on a part the lacking
record is (built through it, or equal to its row); design-removal-
right and diag-17 then read as approved. Not merged; it changes an
accepted B5 behaviour and needs the author’s review with Task 7.
- On the Task 7 checkpoint (
r005b-task7-wip), a literal of two
spreads whose rows are all known passes checking and emits Go that
does not build (undefined: waxwingBasewaxwingLocal0;
research/composition-assessment/programs/shared-type-*.wxw). Task 8’s
placeholder P4 guards rows of several tails, not literals of several
spreads, so lowering takes the one-spread path. To fix with Task 7
(a placeholder at the literal’s lowering until Task 8) if it resumes.
R010 and composed rows: the walk probe (2026-10-21)
Narrow probe authorized in dossier §18.62 item 2, run against a scratch
copy of today’s compiler (src identical to main at 6ee4144; nothing
in the repository changed). Program: fn walk(whole: { ...u, ...v },
left: { ...s }, n: Int): Int where u disjoint s = if n == 0 then 0 else
walk(whole, left, n + -1); (the language has no binary minus).
walk as written is refused at check with E_TYPE “Cannot tell
whether walk’s u or v holds walk’s u; no annotation can decide u and
v, which belong to this call of walk”, at the recursive call’s
whole; the same with or without a caller and with or without the
where clause. The one annotation form tested, a lambda parameter
annotated { ...u, ...v }, does not decide the split (same
diagnostic); the probe does not show that every annotation fails.
It is a refusal, not a selection of the identity split; it is
E_TYPE, not E_SPECIALIZATION.
- Pinning the split needs a changed signature (an extra
uonly: {
...u } parameter). Pinned to the identity split, or to u' = {},
v' = { ...u, ...v }, check passes; with no caller both build and
run (print 0), which does not validate specializing or running a
called walk; with a caller both stop at specialize with
E_INTERNAL “R005B placeholder: rows with several tails are lowered in
Task 8”, as does a non-recursive two-tail function (not tied to
recursion).
- The
u' = {}, v' = { ...u, ...v } recursion is not refused by
R010. Cause, read from the code: bareRow
(src/Features/Check/NestedArguments.purs:78-81) accepts a composed
row with no fields, while docs/language.md describes the rule as the
calling function’s bare { ...r } and dossier §18.18 says a composed
witness is refused. Which is intended is open; BACKLOG R019. So
“the identity split is the only admissible split” holds under the
documented single-tail rule only, not for today’s compiler.
- docs/language.md’s Tranche B paragraph (“stops at E_INTERNAL R005B
placeholder” for a
disjoint clause) is stale: such functions now
pass check, and the placeholder appears at specialization of several
tails. Recorded here; the language doc is not changed in this
research tranche.
R019 compatibility probe (2026-10-22)
Task 0.1 of the first R0 shadow tranche. Characterization only: no
source changed. test/r0-r019-probe.test.mjs pins, for seven shapes
named in T-R0e §1.4 (each with a caller and without), the stage that
stops today’s compiler, its code and its exact text; fixtures are in
test/fixtures/r0/r019/, run through phaseOf
(test/r0-probe-support.mjs), which calls parse, resolve, check,
specializationKeys and compile directly.
| Shape |
Without a caller |
With a caller |
walk as written ({ ...u, ...v }, where u disjoint s) |
stops at check, E_TYPE “Cannot tell whether walk’s u or v holds walk’s u; …” |
the same |
walk, identity split via uonly |
compiled |
stops at specialize, E_INTERNAL “R005B placeholder: rows with several tails are lowered in Task 8” |
walk, u' = {} via uonly |
compiled |
the placeholder |
mixed { ...r, ...h }, non-recursive |
compiled |
the placeholder |
| mixed with a named field before the tails |
compiled |
the placeholder |
| mixed, self-recursive |
compiled |
the placeholder |
| recursive component called from another recursive component |
compiled |
the placeholder |
Reading, for the probed sources only:
- Every case that compiled is one in which the function is never
called, so specialization never reaches it. No probed program that
calls a multi-tail function compiled; all stopped at the Task 8
placeholder (or, for
walk as written, earlier at check).
- So over these shapes, option 1 of T-R0e §1.4 narrows nothing that
compiles when called. It would narrow the uncalled definitions,
which compile today. This is evidence about seven sources, not about
the language; it does not show that no multi-tail program compiles.
- A spread literal
{ ...u, ...h } is not a shape here: Resolve
refuses it first (E_TYPE “A record literal accepts at most one
spread”), so the shapes use { ...r, ...h } in types only.
- No decision is taken. G-R019 stays open; no default is built.
Exhausted is not a budget (2026-10-22)
Task 0.2 of the first R0 shadow tranche (dossier §18.69 Q1: genuine
budget exhaustion is a limit, an invariant violation a fault). The
re-examination bound, P · (|Λ| + 1) + 1 passes
(Features/Check/RowMerge/Improve.purs bound), is the theorem of
docs/plans/2026-10-19-row-merge-rules.md §5 (L1): a lineage moves at
most |Λ| labels and is removed once, so a rescan makes at most
P · (|Λ| + 1) passes that change the state. The rule, fixed before
running: if no run of the domain below reaches the bound, and the
argument, re-read, is not refuted, Exhausted is a broken invariant;
if one reaches it, the author decides and no mapping is chosen.
How it was measured: test/r0-exhausted-support.mjs copies output/ and
reassigns the copy’s module-level pass (stream 7b’s copy-and-patch,
patchedCopy in
research/division-campaign/integration/measure/instrument.mjs) to
report, at each pass, the rescan’s own counter found.passes
(changing passes so far) and bound(found.start). The theorem allows
at most P · (|Λ| + 1) = bound − 1 changing passes, so its maximum is
found.passes = bound − 1 and the ratio found.passes / bound stays
below 1; at found.passes = bound the theorem is broken. The
compiler raises Exhausted at found.passes = bound + 1 (its check
is found.passes > bound, and also past its cheap count): one pass
after the theorem breaks, two after its maximum. The domain, every run
counted, valid or not: the five families of test/row-merge-gen.mjs,
the same generators and orders as test/row-merge.test.mjs but one seed
per problem, seeds 1-2000, each problem in its five orders (10,000
runs each, through test/row-merge-entry.mjs on the copy), and the
1,006 programs of the pinned R0 corpus (test/r0-corpus.mjs), compiled
through the copy’s compile.
| Domain |
Runs |
Rescans |
Passes |
Largest ratio |
| raw (perm.mjs) |
10,000 |
11,985 |
12,367 |
1/2 (seed 27) |
| dense (perm.mjs DENSE=1) |
10,000 |
44,822 |
44,822 |
0 |
| raw (programs-gen.mjs) |
10,000 |
6,499 |
6,611 |
1/2 (seed 300) |
| program-shaped |
10,000 |
53,798 |
62,169 |
2/3 (seed 142) |
| program-shaped, shared |
10,000 |
53,352 |
60,899 |
2/3 (seed 411) |
| R0 corpus, compiled |
1,006 |
289 |
366 |
1/2 |
No run reached the bound. The theorem’s maximum was attained exactly,
though: the worst rescans have found.passes = bound − 1 (1 at bound
2, 2 at bound 3), so they made P · (|Λ| + 1) + 1 passes in all, the
whole bound, in every family except dense and in the corpus. The
largest ratio, 2/3, is the theorem’s limit at those bounds, not slack
below it; the bound is tight there and was not exceeded. The argument,
re-read (premises P1-P3, the lemma that a lineage’s moved label sets
are disjoint, the theorem), is not refuted: the runs agree with it and
the re-reading found no step wrong. So Exhausted is a broken
invariant: Task 2.1 maps it to AsFault (BrokenInvariant …). The
evidence is bounded: no counterexample within this grammar and corpus,
plus the argument; it is not a proof.
Amendment (labelled): the measured quantity. The first run
measured passes made, found.passes + 1, against the bound and
asserted that ratio below 1. It failed at once, for example
{"made":2,"bound":2} at program-shaped seed 24, program-shaped
shared seed 16 and the corpus’s
research/division-campaign/r0/probes/b02-mayhold-forced.wxw (the
output kept showed those three; the rest scrolled off): each a
rescan that made exactly the bound’s passes, which the theorem
allows. The measure was then changed to found.passes before
any result was read as a verdict, for two reasons. It is the brief’s
quantity (“records found.passes and bound(found.start)”). It is
also the only reading under which reaching the bound refutes §5: the
theorem allows found.passes up to bound − 1, so a ratio of 1 breaks
it, while passes made equal to the bound is the theorem’s own
maximum. The domain and the rule were not changed.
For the author: the rule’s wording. “If a run reaches the bound”
admits two readings: total passes made reach P · (|Λ| + 1) + 1 (which
happened, within the theorem), or changing passes reach it,
found.passes ≥ bound (which did not happen, and which alone breaks
the theorem). This entry applies the second. If the author meant the
first, the rule as worded would have stopped the task on runs that
the theorem permits, and the mapping waits for a ruling.
Checks: test/r0-exhausted.serial.test.mjs asserts the ratio stays below
1 and that some pass was recorded (a changed output cannot measure
nothing; the support also fails if pass or bound is no longer
declared). Shown failing on a scratch copy of output/ with the
r005b-quiet defect (every pass counts as a change): the corpus run
reached ratio 16.5 (33 passes, bound 2, on
research/division-campaign/r0/probes/b02-mayhold-forced.wxw) and the
family run stopped with Limit. The source-level guard stays
r005b-quiet (scripts/regression-r005b-end.mjs), proved again.
The brief cites docs/plans/2026-10-17-open-row-merge-rules.md §5 for the
argument; that section is the sum rule. Improve.purs’s “Rules §5” and
the theorem are in docs/plans/2026-10-19-row-merge-rules.md §5, which
is the one re-read here.
ValidR sketch and today’s printability (2026-10-22)
Evidence: test/r0-requirements-probe.test.mjs (Task 0.4, 16 tests, one
per case, in eight groups numbered in draft §2); the draft is
docs/plans/r0-validr-draft.md. Three findings for G-ValidR, none a
defect in today’s compiler:
- VR-sub fails under T-R0b §5.4’s literal sketch. With
Q empty
and every finite θR quantified, pr a at a rigid a fails at
θR(a) = Int -> Int, so fn p(item: a): Text = show(item) has
¬ ValidR; yet it compiles, and only its instances are judged after
specialization (probe group 5). No verdict is wrong today (the plan
keeps such atoms Unsupported), but the meaning that CX-PR consumes
is. The draft’s recommended reading adds an implicit printable
hypothesis at every rigid variable (Pr-1), a policy point for the
author.
- The ground rule needs the holder set. Today a declared type
whose constructors hold a function (
Box(Int) for type Box(a) =
Box(a -> a)) is neither printable nor comparable whatever its
arguments, and a phantom argument counts (Tag(Int -> Int) for
type Tag(a) = Tag(Int) is refused). The sketch’s “through record
fields and app arguments” alone would accept Box(Int) (mutant 1
below compiles show(Box(inc))). ReqG therefore reads the
program’s holder set, which the recorded problem must carry for
VR-independent (draft §3.5).
- VR-CX’s encoding lands outside
ValidOpen’s base set. Encoding
app values injectively as fresh bases gives solutions over an
extension B₂ ⊋ B₁, while ValidOpen at B₁ needs them over B₁.
A non-injective collapse (every app node to one fixed value)
suffices, since CX §4.1 condition 4 makes each occurrence its own
variable (argued; draft §5.3). CX §4.1 condition 4 needs the same
edit as T-R0b after the gate.
Status of each: finding 2 is checked (the probe, plus mutant 1).
Finding 1’s “today” half (p compiles; its instances fail at
specialize) is checked; its ¬ ValidR half is argued from the
definition. Finding 3 is argued and waits for a Lean rendering of
GA (§18.69 item 10). Foreign base types cannot be written today
(docs/language.md:182), so fresh bases reach ReqG only as rigid
variables’ instances.
Mutant runs (recorded, fix round 1). Each on a fresh copy of
output/ (cp -cR output <scratch>/output, with the probe and
test/r0-probe-support.mjs copied to <scratch>/test/), patching only
output/Features.Check.Functional/index.js, then
cd <scratch> && node --test test/r0-requirements-probe.test.mjs;
the copy was deleted afterwards. The unpatched probe passes 16/16.
- Mutant 1, holders ignored (
TData judged by arguments only):
return member(v.value0)(found) || Data_Array.any(...) became
return Data_Array.any(...). Exit 1; 8 pass, 8 fail: “a holder
type at a function-free argument, Box(Int)”, “a holder type of no
parameters, F”, “a holder through the fixed point, Outer”, “a type
that stores its argument, Wrap, at each argument”, “a phantom
argument counts, Tag”, “main returning each: E_ENTRY exactly where
show is refused”, “print at a rigid variable: accepted at check,
judged per key”, “print at a declared type over a rigid variable”.
First failing rows: show(Box(inc)), show(F(inc)),
show(Outer(Box(inc))), show(Wrap(Box(inc))), show(t()) at
Tag(Box(Int)), main(): Box(Int), p(Box(inc)), show of a
Box(a) parameter, each with actual { phase: 'compiled', code:
null, text: null }.
- Mutant 2, a rigid variable or rigid record tail counts as a
function: three lines added at the top of
containsFunction
(TVar holding a Rigid → true; TRecord with a Rigid tail →
true). Exit 1; 11 pass, 5 fail: “print at a rigid variable:
accepted at check, judged per key” (row fn p(item: a): Text =
show(item); fn main(): Int = 1;), “an uncalled caller of p(inc):
non-generic judged, generic not”, “print reaching a rigid variable
through a lambda or a reference”, “print at a declared type over a
rigid variable” (s(Wrap(1))) and “print at an open record: judged
per key”, each with actual phase check, E_TYPE, Expected a
printable value, found a (or Wrap(a), { a: Int, ...r }). The
compare-at-rigid cases still pass: today refuses them already.
Effect and coverage audit (2026-10-22)
Task 0.5 of the first R0 shadow tranche, for gates G-effects (Q-c2)
and G-coverage (Q-c1), with fix round 1 (task review and the gate’s
re-derivation). The criterion is the author’s (dossier §18.69 Q4): a
check that depends on a solver-selected type is semantic. Q3 sets the
default for effects: an effect refusal is class a only where it is
shown not to consume record metas the online solver bound, otherwise
class f (ClassF). In the fixtures and the test, semantic is class
f for an effect refusal and structural is class a. Nothing in the
compiler changed.
Method. Each row cites the raise site and the lines that say what
the check reads. Each fixture in test/fixtures/r0/audit/ is one
variant of a program, by role: inferred (the record part is a
lambda parameter r the solver binds), pinned (annotated with some
type), pinned-selection (annotated with exactly the type the solver
selects), selected (the refusal site unchanged, something outside
it changed so that the solver selects another type), control,
written or resolve. A selected or pinned-selection variant
names its base (against) and the text it changes (changes; the
test recomputes it). test/r0-audit.test.mjs records each outcome
(stage, code, text, covered text, notes) and checks the class rules
on today’s outcomes.
Amended in fix round 1 (reason: the task review found the first
rule nearly vacuous). Pinned against inferred alone is not evidence
when the pinned type differs from the solver’s selection: two
different texts differ in text, span or notes anyway, and a lambda
annotation with L means L plus the ambient row, so most pinned
forms failed first for a new reason. A semantic row is now
“checked” only when a selected or pinned-selection variant
differs from its base, which check refuses, in stage or code. The
first round’s pinned fixtures are kept as records. Every effect row
that was “checked” on a pinned difference now has a selected
variant that compiles, so no row was downgraded; HandlerMayFail and
Require.purs:123, argued in the first round, are now checked.
Evidence still holds only for these programs; the class itself is
derived from the cited lines.
| Refusal |
Raise site |
Reads (cited) |
Decisive fixtures |
What they show |
Class |
| EffectNotAllowed |
Check/Reject.purs:69 |
a consumption’s RowMissing/RowExtra under state.subst (Reject.purs:41-48, 75-77; Consume.purs:182-194) |
effect-not-allowed inferred, selected |
the same lambda; refused when the argument h performs Log, compiles when it does not |
f, checked |
| EffectNotAllowed |
Check/Require.purs:123 |
unify under state.subst (Require.purs:86-99), RowMissing with a non-pure row (121-123); at the top level ArgumentRow.purs:62 rewrites it into CallbackRowLacks (FX018) |
effect-not-allowed-require inferred, selected (and written) |
a nested record argument { f: g }: This function performs Log…; with the lambda’s first argument { f: h } changed to { f: g } (outside the refused { f: g }), compiles |
f, checked |
| MustBePure |
Check/Require.purs:122 |
as above |
must-be-pure inferred, selected, pinned-selection |
refused, and refused the same with r pinned to the selected type; compiles with a pure h |
f, checked |
| RowEquality |
Check/Argument.purs:70 |
the conflict re-derived for its tail: unify state.subst (Argument.purs:65) and resolveRow state.subst (:111) |
row-equality inferred, selected |
r carries p’s row to q; compiles when q’s row is p’s (the change is in both’s q, not in the lambda) |
f, checked |
| RowEquality |
Check/RowName.purs:96 |
RowSharedTail from unify under state.subst (Require.purs:100; RowMismatch there, :101, is TypeMismatch) and RowSharedTail/RowMismatch from a consumption (Reject.purs:45-46, 78) |
none decisive; raised in the pinned forms of effect-not-allowed, callback-row-lacks, unhandled-effect |
reads state.subst |
f, argued |
| CallbackRowLacks |
Check/CallbackParts.purs:63 |
a consumption’s RowExtra (Reject.purs:63-64 → Callback.purs:85; ArgumentRow.purs:107) |
callback-row-lacks inferred, selected |
compiles when q’s row is Log + M |
f, checked |
| UnhandledEffect |
Check/Entry.purs:54 |
main’s row under the settled state.subst (Entry.purs:46, finalEntries; Function.purs:88-90, 98) |
unhandled-effect inferred, selected |
compiles with a pure h; mutant M5 |
f, checked |
| DeferMayFail |
Check/Defer.purs:165 |
the deferred row after settling (Defer.purs:125; Function.purs:91), and at the item (Defer.purs:60-61) |
defer-may-fail inferred, selected |
compiles when the stored function does not fail |
f, checked |
| DeferMayPerform |
Check/Defer.purs:134 |
the settled deferred row’s rigid tail (Defer.purs:123-136) |
defer-may-perform inferred, selected |
compiles when g is with pure |
f, checked |
| DeferHandlerMayFail |
Check/MarkReport.purs:49 |
the mark graph from settled rows (Frames.purs:28-34), edges added by unification (UnifyMark.purs:132), searched in Subst.marks (Function.purs:92-94) |
defer-handler-may-fail inferred, selected |
compiles when the stored function performs nothing |
f, checked |
| DeferHandlerVariable |
Check/MarkReport.purs:48 |
as above |
defer-handler-variable inferred, selected |
as above |
f, checked |
| ExpectedNofail |
Check/MarkReport.purs:74 |
as above |
expected-nofail inferred, selected |
compiles when work is plain Log |
f, checked |
| HandlerMayFail |
Check/MarkReport.purs:61 |
as above |
handler-may-fail inferred, selected |
compiles when the lambda no longer passes r to use (outside the refused handler literal); the pinned form is kept |
f, checked |
| ExpectedHandler |
Check/Handler.purs:75 |
headOf handlerValue.state (Handler.purs:61-63) |
expected-handler inferred, pinned-selection |
with r.h at a meta is refused; pinned to exactly the selected Handler(Log), compiles |
f, checked |
| FailNeedsConcrete |
Check/Failure.purs:102 |
typeHead (resolved subst ty) of each payload, settled (Failure.purs:73-79, 214) |
fail-needs-concrete-check inferred, applied |
refused while r is unbound; compiles once applied to { e: E } |
f, checked |
| FailNeedsConcrete |
Resolve/Row.purs:82 |
the written payload (Row.purs:79-93) |
fail-needs-concrete-resolve |
raised in Resolve |
a, checked |
| NofailOnFail |
Resolve/Row.purs:71 |
the written label |
nofail-on-fail |
raised in Resolve |
a, checked |
| MarkVariableOutsideSignature |
Resolve/Marks.purs:67 |
written mark variables |
mark-variable-outside-signature |
raised in Resolve |
a, checked |
| HandlerMissing |
Resolve/Handler.purs:161 |
declared operations against clause names (Handler.purs:148-163) |
handler-missing |
raised in Resolve |
a, checked |
| HandlerDuplicate |
Resolve/Handler.purs:142 |
clause names (Handler.purs:133-146) |
handler-duplicate |
raised in Resolve |
a, checked |
| HandlerOperation |
Resolve/Handler.purs:90, Imports.purs:131, Qualified.purs:152 |
a name against declared operations |
handler-operation-{clause,import,qualified} |
raised in Resolve |
a, checked |
| NonExhaustive |
Check/Coverage.purs:112 |
the scrutinee’s settled type (Coverage.purs:83; Function.purs:95, 107), inhabitedness per type application (Signature.purs buildSignature; Matrix.purs:59-63), record patterns widened by their settled type (Matrix.purs:139-149) |
non-exhaustive selected-int, selected-v |
the same match: refused when the argument is Opt(Int), compiles at Opt(V); mutant M2 |
semantic, checked |
| RedundantArm |
Check/Coverage.purs:101 |
pattern types (Usefulness.purs:60; Matrix.purs:59-63, 137) |
redundant-arm inferred, selected-int |
_ redundant at Opt(V), not at Opt(Int); mutant M2 |
semantic, checked |
| AmbiguousType |
Check/Comparable.purs:78 |
holes left in the settled operand type (Comparable.purs:76-84; Function.purs:95-96) |
ambiguous-type inferred, applied |
ambiguous while e is never applied; compiles once applied |
semantic, checked |
| Arity (pipe) |
Check/Pipe.purs:36 |
functionLike: headOf state, the type solved so far (Apply.purs:147-151; Scheme.purs:161-164) |
arity-pipe-function-like inferred, order |
E_ARITY once an earlier r.f + 1 binds f to Int; otherwise a hole passes and E_TYPE comes later; mutant M1 |
semantic, checked |
| Arity (call) |
Check/Call.purs:148 |
functionLike at the call’s result, after the arguments |
arity-call-function-like inferred, order, selected-fn |
as for the pipe; compiles with inc |
semantic, checked |
| Arity (call) |
Check/Call.purs:144 |
functionLike at the callee’s freshly instantiated declared result, before any argument: a fixed head is never a function, a variable is an unbound hole |
arity-call-fixed-result |
E_ARITY at size(r, 1) pinned or inferred, before r.x is read (control: E_TYPE); mutant R3 |
a, checked |
| Arity (pipe) |
Check/Pipe.purs:33 |
the callee’s declared result and the argument count (Call.purs:83-106); no State |
arity-pipe-fixed-result |
as for Call.purs:144 |
a, checked |
Other arity sites, cited and not probed: Call.purs:123 (a count
against declared fields), Show.purs:27 and Operation.purs:64, 104
(one argument): structural by the code, class a (argued). FieldArity,
FunctionNeedsCall and TypeArguments were not examined.
Q-c2 (G-effects). Every effect refusal raised by check is class f,
ExpectedHandler included: each reads the online solver’s state, and
each row but RowName.purs:96 has a decisive selected variant. Q3
speaks of record metas; Reject.purs:69 is also reached with none
(fn k(): Unit = h(1), the gate’s probe ena-direct, not recorded
here), which is consistent with a per-site class f. The class-a
refusals are those raised in Resolve: HandlerMissing,
HandlerDuplicate, HandlerOperation (three sites), NofailOnFail,
MarkVariableOutsideSignature and the Resolve-time FailNeedsConcrete.
Every E_HANDLER refusal is raised in Resolve.
Q-c1 (G-coverage). Today’s coverage has no structural part at a
raise site: RedundantArm and NonExhaustive read settled types on
every path (cited above), and the selected fixtures show both
verdicts following the type the solver selects. Some matches read
only written types (a parameter typed Bool), but telling them
apart needs a predicate today’s code does not compute (“no column
type has a solver-bound part”). Task 2.3 classifies at each check’s
raise site (plan Task 2.3 “Interfaces”: “applied at each check’s
raise site”; plan review rows S5 and N5), so it cannot split one
site without that predicate, which would be new machinery and is not
proposed. Recommendation (argued): both coverage refusals are
semantic, and Task 2.3 adds no coverage StaticRule rows. Arity has
two structural sites (Pipe.purs:33, Call.purs:144) and two semantic
ones (Pipe.purs:36, Call.purs:148). Open: semantic coverage runs on
the accepted witness after admit (plan Task 6.1); what a semantic
coverage refusal becomes when it is reached only through an unforced
choice of the solver is not decided here.
AmbiguousType’s reason (for the author; for Task 2.2). Derived
through T-R0a §5.3 rule 3 (generation-interface.md:815-828) with G0’s
guard and check as plan Task 4.2 specifies them (argued). f02’s atom
is cmp α at a flexible α. g0Guard declines only atoms that stay
non-ground after entailedGround and mention a rigid variable, or lie
outside the unitary fragment, so it admits this one. online then
produces a candidate that keeps the hole, and G0’s check either
refuses it with the RequirementUnjudged backstop (a guard/check
disagreement, which RT8 counts as a defect) or accepts it (Solved,
which conflicts with the decided Unresolved of §18.69 Q4, since cmp
at an unconstrained variable is satisfiable, T-R0b C8). No specified
path gives a reason today. Options, not chosen:
Unsupported RequirementAtoms. Needs a new mechanism: for example a
check refusal for a requirement at an unbound flexible variable that
rule 3 reads as Unsupported RequirementAtoms, as it reads
RequirementOpen. The guard cannot do it, because it cannot tell
f02’s α from AT19’s second case (an atom σ grounds, which must
reach check). Novel machinery; needs the author’s approval.
Consequence: f02 is reported as outside the supported model, beside
pr a at a rigid a.
Inference NoAcceptedCertificate. What rule 3 gives if G0’s check
refuses the candidate. Consequence: the online candidate is
ClaimsComplete, so the refusal is also a CandidateRefused
search fault, and the RequirementUnjudged backstop that RT8
counts as a defect becomes an expected path unless the check’s
refusal is given its own kind.
Inference NoCandidate: rejected. It says the search found
nothing, but the online search finds a solution that keeps the hole.
Defect found (live checker; recorded, not fixed).
fx010-record-payload/pinned is a user program that ends in E_INTERNAL
Effect row consumption failed, the catch-all at Check/Reject.purs:54.
The same program with the record part inferred gets the user
diagnostic k performs Log, which its signature does not allow. This
is a new, smaller reproducer for BACKLOG FX010. Which Failure
constructor reaches the catch-all was not investigated. Two
diagnostic problems found by the gate are in BACKLOG FX030
(must-be-pure/clock-row, effect-not-allowed-require/written).
Mutant runs (recorded, first round, against the first round’s
test and 52 fixtures). Each run used one isolated copy in the
session scratchpad: output/, src/, test/r0-audit.test.mjs,
test/r0-probe-support.mjs, test/fixtures/r0/audit/ and
scripts/structure.mjs, copied to the same paths. The copy was
patched, run with node --test test/r0-audit.test.mjs, restored
after each mutant and deleted at the end. Unpatched, 7 of 7 tests
pass.
- M1,
functionLike ignores the substitution
(output/Features.Check.Apply/index.js line 44: var v =
Features_Check_Scheme.headOf(state)(ty); became var v = ty;).
1 test failed, “every audit fixture gives its recorded refusal”, at
arity-call-function-like/pinned. Both pinned arity forms became
E_TYPE Expected a function, found Int at 1, so their E_ARITY
needs the solved binding of get’s a.
- M2, every constructor is inhabited
(output/Features.Check.Signature/index.js line 162:
inhabited:
inhabited became inhabited: inhabited.map(function () { return
true; })). 2 tests failed: “every audit fixture gives its recorded
refusal” (non-exhaustive/selected-v is refused) and “a semantic row
has variants that differ” (redundant-arm: all three forms compile).
- M3, redundant-arm’s three fixtures relabelled
"class":
"structural". 1 test failed: “a structural row is resolve-time or
agrees across variants” (redundant-arm/pinned).
- M4,
import Features.Check.Scheme (State) added to
src/Features/Resolve/Lacking.purs. 1 test failed: “Features.Resolve
imports none of the online solver”.
- M5,
main’s row read without the substitution
(output/Features.Check.Entry/index.js line 38:
resolve(state.subst) became resolve(Features_Check_Subst.empty)).
1 test failed, “every audit fixture gives its recorded refusal”:
unhandled-effect/inferred compiles, because Log is in main’s row
only through the solved binding of r.
Fix-round runs (recorded). Same method, on a fresh copy of the
fix-round test and its 78 fixtures; 8 of 8 pass unpatched. The copy
was deleted afterwards.
- R1, must-be-pure.selected.json removed. 2 tests failed: “every
audit fixture gives its recorded refusal” (the count pin) and “a
checked semantic row has a decisive selected variant”
(must-be-pure/inferred): its pinned and pinned-selection forms
alone do not pass the rule.
- R2, M5’s patch (Entry line 38, the empty substitution). 2 tests
failed: the recorded-refusal test and the decisive-variant test,
both at unhandled-effect/inferred, which compiles.
- R3, Call.purs:144 given an empty substitution
(output/Features.Check.Call/index.js:
functionLike(usable) became
functionLike(Object.assign({}, usable, { subst:
Features_Check_Subst_M.empty })), with that module imported). 8 of
8 pass: the structural Call.purs:144 fixtures do not depend on the
substitution (bounded evidence on these programs).
- must-be-pure/clock-row, the 79th fixture (BACKLOG FX030), was added
after these runs; the test then passed 8 of 8 with it.
Fix round 2 (re-review N1). Two selected variants changed text
inside their base’s refusal span, against the definition above:
effect-not-allowed-require/selected (g to h inside { f: g })
and handler-may-fail/selected (the handler literal itself). The first
now changes the lambda’s other argument ({ f: h } to { f: g });
the second is the former control (use(r) to 0), now
role: "selected", and the in-span variant is removed. Both compile,
and both rows stay checked. 78 fixtures.
Limit of the tests (argued). The class tests check that the
evidence is consistent with each class; they do not derive it, and
they cannot check that a selected change lies outside the refusal
site (the changes field records it for the reviewer). The gate’s
reviewer re-derives each class from the cited lines.
Erased effect rows (2026-10-22)
Task 0.7 of the first R0 shadow tranche, for gate G-erased. The design
note is docs/plans/r0-erased-rows.md; this section records its runs.
Nothing in the compiler changed.
Probe (checked). test/r0-erased.test.mjs runs the fixtures in
test/fixtures/r0/erased/ (23 in the first round, 27 after fix round
1) through refusalOf and pins each outcome (phase, code, text,
covered text). node --test test/r0-erased.test.mjs: 4 of 4 pass.
First-round results:
- obligation-record/refused,
apply(h, { y: 1 }) where apply’s
a is fixed only by the State label argument of h’s row:
check, E_TYPE Expected { x: Int }, found { y: Int } at
{ y: 1 }. The control apply(h, { x: 1 }) compiles. No T-R0b
marker applies (argued), and the recorded problem is satisfiable by
hand translation (argued), so a strategy solving only the recorded
atoms would call it Solved.
- obligation-annotation/refused, the same obligation through a
lambda annotation’s shared row: E_TYPE
Expected Unit -> Unit,
found Unit -> Unit at h; the control compiles.
- obligation-ground/refused,
State(Int) against State(Bool) with
no record or variable: the same text at h; the control compiles.
- The 17
form fixtures (one per operation, handler and fail form,
signature, annotation and constructor source) all compile, and
each declaration g contains its resolved form (checked by walking
the resolved program).
Mutant runs (recorded). One isolated copy in the session
scratchpad: output/, package.json, test/r0-erased.test.mjs,
test/r0-probe-support.mjs and test/fixtures/r0/erased/, at the same
paths. Unpatched: 4 of 4 pass. Each mutant was restored before the
next; the copy was deleted at the end.
- M1, label arguments never unified
(output/Features.Check.UnifyRow/index.js line 74:
bind(foldM(unifyPair)(pending.subst)(Data_Array.zip(entry.label.value1)(found.other.label.value1)))(marked)
became bind(new Data_Either.Right(pending.subst))(marked)).
1 test failed, “every erased-row fixture gives its recorded
outcome”. Listing every fixture’s outcome under M1: exactly
obligation-record/refused, obligation-annotation/refused and
obligation-ground/refused changed, each to compiled. So the three
refusals come from label-argument unification
(Check/UnifyRow.purs:159-163).
- M2, form/fail-written relabelled
"family": "unwritten". 1 test
failed, “each form fixture writes its resolved form in g”, at
form/fail-written.
- M3, form/reference-plain’s
node changed from OperationRef to
Perform. The same test failed at form/reference-plain.
- M4, form/print relabelled
"marked": true with no source. 1 test
failed, “predictions use the criterion vocabulary”, at form/print.
Diagnostic found (live checker; recorded, not fixed). Two of the
refused programs report Expected Unit -> Unit, found Unit -> Unit:
the types differ only in their rows, which the text omits, so it
names two equal-looking types as a mismatch. BACKLOG FX031.
Limits (first round). The fixtures’ sources and marked were
the criterion’s predictions, unchecked, and data types with row
parameters had no fixture. Fix round 1 removes both limits (below).
Fix round 1 (task review Important 1-2; G-erased gate findings
1-7). Amended after the first round’s runs (reason: the task
review found the operation source ambiguous and the prediction test
tautological). The operation source is split into perform
(OperationRef and Perform: the performed label and the operation’s
declared types) and clause (handler clauses: the declared types
only); types are read as declared; a Fail node contributes to
fail only. Every fixture’s sources was re-derived by hand from the
revised table, and a new field inferredRow records the part (ii)
predicate P-ii (note §7), also by hand. test/r0-erased-criterion.mjs
is a reference reading of both tables over resolved syntax; the test
“each fixture has the criterion’s answers for g” compares it with the
hand-derived fields of all 27 fixtures and replaces the vocabulary
test (M4 above tested the replaced test). The hand derivation and the
reference reading agreed on the first run.
New fixtures (checked, node --test test/r0-erased.test.mjs, 4 of 4
pass):
- obligation-rowvar/refused (gate P1):
link(h, k) with h: Unit ->
Unit with Reg(Unit -> Unit with Log + ...e) and k: Unit -> Unit
with Clock + ...e against link(h: … Reg(Unit -> Unit with ...r),
k: Unit -> Unit with ...r): check, E_EFFECT k must allow every
effect of link's parameter k (Log), but its row is Clock; a
function value passed as an argument must have its parameter's row
(FX018). Control (k with Log + ...e): compiled. Unmarked.
- obligation-data/refused (gate P2):
type Job(...e) = Job(Unit ->
Unit with ...e), apply(j: Job(State(a)), x: a), g(j:
Job(State({ x: Int }))) = apply(j, { y: 1 }): check, E_TYPE
Expected { x: Int }, found { y: Int }. Control: compiled. Marked
by own and callee.
Mutant runs (recorded; same method as above, on a fresh isolated
copy that also held test/r0-erased-criterion.mjs; 4 of 4 pass
unpatched; deleted afterwards):
- M1 again (the UnifyRow patch above) on the 27 fixtures. 1 test
failed, “every erased-row fixture gives its recorded outcome”.
Listing every outcome: exactly the five refused obligation fixtures
(record, annotation, data, ground, rowvar) changed, each to
compiled.
- M5, the performed label ignores the effect’s parameters
(test/r0-erased-criterion.mjs:
program.effects[node.value1]
.parameters.length > 0 || fires(…) became fires(…)). 1 test
failed, “each fixture has the criterion’s answers for g”, at
form/perform-parameterized.
- M6, P-ii ignores row tails (
row.value1.constructor.name ===
'Just' || removed from openRows). The same test failed at
obligation-ground/control.
- M7, variables do not make a label argument record-capable (the
TVar disjunct removed from recordOrVariable). The same test
failed at form/callee-signature.
Gate probe P6 re-run (checked by a scratch script, not a test): with
effect Op { fn op(): Int with State({ x: Int }); }, fn g(): Int
with Op = Op.op() compiles, and so does the same with with Log.
An operation’s own row is dropped at Resolve (Resolve/Effect.purs:
47-58). Recorded as BACKLOG FX032, an observation for the author; not
fixed.
Fix round 2 (re-review N1; gate finding 2). Amended after fix
round 1’s runs (reason: the re-review found two fresh-row sites
reaching the checked IR that P-ii missed: bare show and applying a
meta-typed value). The fresh effect-row sites of src/Features/Check
were enumerated mechanically (note §2.1: grep -rn "openRow (Hole\|Hole
(state.next\|Hole state.next\|(Just (Hole\|Just (Meta\|Meta fresh"
and grep -rn "TFun [a-z(]" over src/Features/Check, with the helpers
they call). The enumeration found a third missed site: a partial
application’s remaining stages (Stages.purs:23 via Call.purs:191),
and a fourth trigger, constructor patterns (Match.purs:110).
Probes (checked; a scratch script ran parse, resolve and check on the
worktree’s output/ and printed g’s checked body and its count of
rows with a Hole tail; node ir.mjs "<source>"; deleted after):
fn k(x: a): Int = 0; fn g(): Int = k(show);: 2 hole rows;
Call(0 [TFun(TVar(Hole(0)) Row([] Just(Hole(1))) TText)] [Lambda …]).
type Opt(a) = None | Some(a); fn g(): Int = { let n = None; match
n { Some(f) => f(1), None => 0 } };: 0 hole rows, but
Construct(0 [TFun(TInt Row([] Just(Rigid(0))) TInt)] []) and the
same arrow in the pattern and local types; no row is written. The
same with 1 |> f.
fn add(x: Int, y: Int): Int = x + y; fn g(): Int = { let f =
add(1); 0 };: 1 hole row, TFun(TInt Row([] Just(Hole(0))) TInt).
Likewise type P = P(Int, Int) with P(1), and effect Two { fn
two(a: Int, b: Int): Unit; } with Two.two(1) (row Two plus a
hole tail).
type Job(...e) = Job(Unit -> Unit with ...e); fn g(j: Job(Log)):
Int = match j { Job(f) => 0 };: the pattern types hold the
instantiated row parameter, solved to Log with g’s rigid tail.
- defer-plain,
fn g(): Int = { defer (); 0 }; and the nofail Log
form with defer Log.log(1): no row in the IR
(Block([Defer(Expr(… UnitValue))] …)).
fn g(): Text = show(1); and fn g(): Int = crash(1);: no row
(Show(…), Crash(…)); only the bare references make one.
P-ii and the reference reading’s inferredRow gained ShowRef, any
Apply or Pipe, partial applications and constructor patterns.
Seven form fixtures were added (show-reference, apply-meta, pipe-meta,
partial-call, partial-construct, partial-perform, pattern-row; each
compiles, sources [], inferredRow true by hand, and each
triggers P-ii by its own disjunct only). Re-derived by hand:
form/own-signature’s inferredRow becomes true (h(()) is an
Apply); the reference reading agreed with every other fixture.
node --test test/r0-erased.test.mjs: 4 of 4 pass on 34 fixtures.
Mutant runs (recorded; isolated copy as before; 4 of 4 pass
unpatched; deleted afterwards). Each drops one site from
test/r0-erased-criterion.mjs inferredRow, and each failed “each
fixture has the criterion’s answers for g” at that site’s fixture:
- M8,
'ShowRef' removed from the made list: form/show-reference.
- M9,
'Apply' removed: form/apply-meta.
- M10,
'Pipe' removed: form/pipe-meta.
- M11, partiality ignored (
partial || removed): form/partial-call.
- M12, the constructor-pattern line removed: form/pattern-row.
The verdict token boundary (2026-10-22)
Task 1.1 of the first R0 shadow tranche: Domain.Verdict (with
Verdict/Admission, Verdict/Open and Verdict/Internal) and the opaque
RecordedProblem (Domain.Recorded, Recorded/Internal). Nothing in
the compile path imports them (test/r0-verdict.test.mjs, last test).
Compile probes (checked; purs 0.15.16). Each probe module was
compiled with purs compile 'src/Domain/**/*.purs'
'.spago/p/*/src/**/*.purs' <probe> -o <scratch>, one per run, and
deleted afterwards. A client importing Domain.Verdict (Valid,
Refuted, NonForced, ForcednessEvidence, Solution) and
Domain.Recorded (RecordedProblem) and naming each type compiled
(exit 0). So did a trusted module importing Domain.Verdict.Internal
(Valid(..), Refuted(..), CX, NonForced(..), ForcednessEvidence(..))
and building each. Each of these failed (exit 1):
| Probe |
purs error |
import Domain.Verdict (Valid(..)), then Valid |
Unknown data constructor Valid |
import Domain.Verdict as V, then V.Valid |
Unknown data constructor V.Valid |
V.ForcednessEvidence from Domain.Verdict |
Unknown data constructor V.ForcednessEvidence |
coerce ∷ CX → Refuted |
No type class instance for Coercible { body, rho } Refuted |
coerce ∷ Array CX → Array Refuted |
the same instance |
coerce ∷ {} → RecordedProblem |
No type class instance for Coercible (Record ()) RecordedProblem; needs the newtype constructor in scope |
import Domain.Recorded (RecordedProblem(..)), then RecordedProblem {} |
Unknown data constructor RecordedProblem |
CheckRefusal from Domain.Verdict.Open as a value |
Unknown data constructor CheckRefusal (uninhabited) |
purs accepts a leak, so the source rule is needed (checked). With
Domain.Verdict’s import changed to Valid(..) inside as Exports,
node scripts/build.mjs succeeded (exit 0). Two gates caught it:
test/r0-verdict.test.mjs “public modules export no token or problem
constructor” failed with Domain.Verdict exports Valid, and
checkStructure() reported src/Domain/Verdict.purs: imports
Domain.Verdict.Internal beyond bare type names. Source restored and
rebuilt.
RED runs (checked). Before the source existed, node --test
test/structure-r0.test.mjs failed with SyntaxError: The requested
module '../scripts/structure.mjs' does not provide an export named
'exportFindings', and node scripts/build.mjs && node --test
test/r0-verdict.test.mjs failed with ERR_MODULE_NOT_FOUND for
output/Domain.Verdict/index.js.
Mutant runs (checked) on scripts/structure.mjs, each restored
afterwards; node --test test/structure-r0.test.mjs passes 5 of 5
unpatched:
- A, the Domain.Verdict.Internal entry deleted from
internalModules: “only the trusted checkers import
Domain.Verdict.Internal” fails.
- B, the Recorded rule’s
Generate(\.|$) replaced by Generate:
“only Generate* and Domain.Recorded import Domain.Recorded.Internal”
fails (Features.Check.GenerateX admitted).
- C, the trailing
$ dropped from the Verdict rule: the trusted-checker
test fails (Features.Check.Refute.Rules.X admitted).
- D,
bareTypes replaced by /^\(.*\)(\s+as\s+\w+)?$/s: both
re-export-form tests fail.
- E, other modules’ re-exports no longer reported: “no other module
re-exports a token Internal module” fails.
Fix round 1 (review I1; checked). The review compiled three shapes
that purs 0.15.16 accepts, that re-export a token constructor, and that
the first exportFindings passed: a dotted alias (as T.I, module
T.I), a trailing -- comment on the import, and a comment containing
) where inside the export list. Against the old check, a throwaway
script gave 0 findings for each of these six: (a) the dotted alias,
(b) the trailing comment, (c) a line comment in the export list, (c2)
a block comment {- ) where -} there, (c3) a comment before module
Domain.Verdict.Internal in the export list, and (d) an aliased import
that is not re-exported. It also gave 1, a false positive, for a
public module whose bare-types import ends in a comment. node --test
test/structure-r0.test.mjs failed “no other module re-exports a
token Internal module” (first at module T.I) and “comments do not
hide or invent a public-module finding”. The new check removes
comments first, and outside the public module it reports any alias on
an import of a restricted Internal module and any export of the
Internal module by its own name. After the change the script gave 1
for each of (a)-(d) and 0 for the commented public import, and the
file passes 6 of 6. Mutants, each restored: M-F (comments not
removed) fails both tests above; M-G (aliases never reported) fails
“no other module re-exports a token Internal module”.
Fix round 2 (re-review 1, I1; checked). Re-review 1 compiled eight
more forms that purs 0.15.16 accepts and the round-1 source check
passed: P1 and P7 (a {- inside a line comment, which the stripper
read as a block comment), P9 and P10 (--> and --|, which purs reads
as comments), P2 and P11 (an indented top-level block), P3 (an
indented module header) and P4 (CRLF). Ruling: check the compiler’s
output instead of source. Probes, each compiled with `purs compile
‘src/Domain//.purs’ ‘.spago/p//src//*.purs’ -o
/out` (exit 0) together with a client module that imports the
constructor through the probe module and builds it (exit 0 for P0-P11):
every one of P0 (a plain alias), P1, P2, P3, P4, P7, P9, P10, P11 and
N0 (an alias named `Exports` outside the public module) emitted the
same statement, `export { Valid } from
"../Domain.Verdict.Internal/index.js"` (`RecordedProblem` from
Domain.Recorded.Internal for P11, `Refuted` for N0). T0, a type-only
`module X` re-export, emitted no export at all, as does the real
Domain.Verdict. The sources and emitted index.js files are kept
verbatim in test/fixtures/r0/reexport/probes.json. Against them the
round-1 `exportFindings` gave 1 finding for P0 and N0, 0 for P1-P11,
and 1 for the harmless T0. `reexportFindings` gives exactly one
finding for each of P0-P11 and N0, none for T0 and none over the real
output/. Mutants, each restored: M-H (`export *` not matched, which
also shifts the capture group) fails both fixture tests; M-I (public
modules exempted by name) fails "type-only re-exports and other
modules pass; export * does not"; M-J (matching a wrong target) fails
both fixture tests.
**Fix round 3 (re-review 2; checked).** Re-review 2 found a route with
no re-export: in an allowed importer, `infix 4 Valid as <!>` exported
as `((<!>))`. Probe (purs 0.15.16, as before, exit 0): Rules declares
`infix 4 Valid as <!>` and `infix 4 NonForcedness as ~~` and exports
both; a client builds `v = (<!>)` and `n e = (~~) e`. Rules' index.js
has no import and no export at all; the client's has `import * as
Domain_Verdict_Internal from "../Domain.Verdict.Internal/index.js"`,
`Domain_Verdict_Internal.Valid.value` and `new
Domain_Verdict_Internal.NonForcedness(e)`. A second probe compiled a
client of P0's plain re-export (`import Features.Check.Refute.Rules
(Valid(..))`, `v = Valid`): it too imports Domain.Verdict.Internal's
JS directly, not the re-exporter's. So the import check alone would
catch any client of a re-export, but not a re-export nobody uses yet;
`reexportFindings` stays, to report the re-exporter itself. The three
emitted files are in probes.json under `inlined`. RED: under the
round-2 scripts/structure.mjs, `reexportFindings` gives 0 for all
three, there is no import check, and the new test file fails to load
(`does not provide an export named 'importFindings'`); re-review 2
recorded `graphFindings` giving `[]` (the client's source names only
Domain.Verdict, Domain.Verdict.Open and Rules). `importFindings`
gives one finding for each client, none for the same JS under an
allowed importer's name, and none over the real output/, where only
Domain.Verdict and Domain.Recorded import a token module. Mutants,
each restored: M-K (allowed importers not exempted) fails "a
disallowed module importing a token module's JS is a finding" and the
real-output test; M-L (only `import { … } from` matched, not `import *
as`) fails the first.
**Fix round 4 (re-review 3; checked).** Controller ruling ("threat
model"): allowed importers are trusted, so their export surface is
pinned and reviewed; other modules are held off by the graph rule, the
two output checks, the compiler, and a scan of FFI JS. Probes, each
compiled with `purs compile 'src/Domain/**/*.purs'
'.spago/p/*/src/**/*.purs' '/*.purs' -o /out` (exit 0)
in a scratch directory, deleted afterwards, kept verbatim with their
index.js (and foreign.js) in test/fixtures/r0/trusted-surface/
probes.json. Adaptation, labelled: re-review 3's I, K and J export
only the alias or `module X`; each here also exports one reviewed type
(`RuleSpec`, `Spec`) so that a baseline pin exists, because purs
rejects an empty export list (`module … () where`: "Unable to parse
module: Unexpected token ')'"). Baselines: Rules `(RuleSpec)` (A's
Rules without the instance) and Generate `(Spec)`; both emit no
`export`. I: Rules `(RuleSpec, (~~))` with `infix 4 Refuted as ~~`;
its client's index.js is `var r2 = function (cx) { return cx; };` with
no import. K: Generate `(Spec, (##))`; Decide's index.js is `var
forged = {};`. J: Rules `(RuleSpec, module X)` emits `export { Refuted
} from "../Domain.Verdict.Internal/index.js"`; its client imports
nothing. A: Rules `(RuleSpec)` with `instance mintRuleSpec`; it emits
`export { mintRuleSpec }`, and the client calls
`Features_Check_Mintable.mint(Features_Check_Refute_Rules.mintRuleSpec)`.
E: Runtime.Mint's foreign.js imports `Valid` from
"../Domain.Verdict.Internal/index.js"; Program.Use re-exports it. At
run time A's `v` and E's `v` are `instanceof` the compiled `Valid`,
and I's `r2({rho: 1})` returns the record unchanged.
RED: under HEAD f786078's scripts/structure.mjs, a throwaway script
ran `reexportFindings`, `importFindings` and `graphFindings` (purs
graph of src/Domain plus the probe, probe paths rewritten to src/)
over each probe: I, K, A and E gave `[]` from all three; J gave only
`Features.Check.Refute.Rules re-exports { Refuted } from
Domain.Verdict.Internal`, nothing for its client. The new
test/structure-surface.test.mjs failed to load there
(`ERR_MODULE_NOT_FOUND` for scripts/trusted-surface.mjs). GREEN: it
passes 7 of 7. With each baseline pinned, `surfaceFindings` reports
I `source … added (~~)`, K `source … added (##)`, J `source … added
module X` and `compiled … added Refuted from
../Domain.Verdict.Internal/index.js`, A `compiled … added
mintRuleSpec`; `foreignFindings` reports E's foreign.js under
src/Runtime/Mint.js and output/Runtime.Mint/foreign.js. Ten header
variants the parser does not accept (block or line comment in the
header, CR, tab, `(-->)`, `(<--)`, no export list, wrong module name,
a leading `{- -}`, non-ASCII) each give one fails-closed finding.
End to end: exporting a new `probe ∷ Int` from Domain.Recorded and
rebuilding made `checkStructure()` report `Domain.Recorded: source
exports differ from the pin, added probe` and the same for compiled
exports; restored and rebuilt, it gave `[]`.
Mutants (patches applied by a scratch script, each restored; `node
--test test/structure-surface.test.mjs`): M1, compare only `source`:
"an allowed importer's surface beyond its pin is a finding" fails.
M2, compare only `compiled`: the same test fails. M3, an unpinned
importer returns `[]`: "an unpinned allowed importer and a stale pin
are findings" fails. M4, the `op` containing `--` rejection removed:
survived at first (`(-->)` is already refused as a comment), so the
`(<--)` variant was added (amendment, after the run); then "a surface
the parsers cannot read fails closed" fails. M5, allowed importers not
exempted from the FFI scan: "FFI naming a token Internal module is a
finding (probe E)" fails. M6, output//foreign.js not collected:
"the real tree matches its pin and its FFI names no token module"
fails. M7, the FFI pattern matching only `Domain/…/Internal`: the
probe E test fails.
**Fix round 5 (re-review 4; checked).** Re-review 4 found two routes
outside the round-4 model. Repurposed surface (a pinned name whose
body, type or instance class changes) passes the pin by design
(controller ruling); docs/engineering.md, AGENTS.md and
scripts/trusted-surface.mjs now say the pin catches new surface only
and every diff to an allowed importer needs token review. No check
covers it (argued). Forgery: probe Runtime.Forge (`foreign import
forge ∷ CX → Refuted` with foreign.js `export const forge = x => x;`,
and `forge2 = unsafeCoerce`), compiled with `purs compile
'src/Domain/**/*.purs' '.spago/p/*/src/**/*.purs' /Forge.purs`
(exit 0), and graphed with `purs graph` over the same files (depends
`["Domain.Verdict","Unsafe.Coerce"]`). At run time both `forge(cx)`
and `forge2(cx)` return `cx` itself, a `Refuted` once erased. Source,
graph entry, index.js and foreign.js are under `forge` in
test/fixtures/r0/trusted-surface/probes.json. RED: under HEAD
e773573's scripts, a throwaway script gave `[]` from
`reexportFindings`, `importFindings`, `foreignFindings` (src and
output paths) and `graphFindings` (path rewritten to src/Runtime/);
the new test file failed to load (`does not provide an export named
'forgeryFindings'`). GREEN: `forgeryFindings` reports `Runtime.Forge
depends on Domain.Verdict and on Unsafe.Coerce (forgery by
unsafeCoerce)` and `… and has a foreign module (forgery by FFI)`,
each route alone, none for an allowed importer or a module not
depending on a public token module; test/structure-surface.test.mjs
passes 8 of 8. Real tree: `[]`; only Domain.Verdict,
Domain.Verdict.Admission and Domain.Verdict.Internal depend on a
public token module, and no src module depends on Unsafe.Coerce.
Mutants (each restored; the Forge test fails under each): N1, the
Unsafe.Coerce route dropped; N2, the foreign-module route dropped; N3,
allowed importers not exempted. That rule was bypassed (re-review 5)
and is replaced by the rule on the primitives below.
**Forgery by the primitives (Task 1.1 breaker ruling, carried into
Task 1.2's first commit; checked).** Re-review 5 found the round-5
rule keyed on a direct dependency on Domain.Verdict or
Domain.Recorded, so three routes pass it: a type re-export or synonym
(Runtime.Types and Runtime.ForgeA; Runtime.Syn and Runtime.ForgeB), a
polymorphic helper (Runtime.Cast, `cast = unsafeCoerce`, used by
Program.UseC, which imports Domain.Verdict but no unsafe module), and
Record.Unsafe (Program.UseD, `unsafeGet "x" { x: cx }`). Reproduced:
the seven probes compiled with `purs compile -o /out
'src/Domain/**/*.purs' '.spago/p/*/src/**/*.purs' '/*.purs'`
(purs 0.15.16, exit 0) and graphed with `purs graph` over the same
files; at run time `forgeA`, `forgeA2`, `forgeB`, `forgeC` and
`forgeD` each return their argument (`=== cx`). Source, graph entry,
index.js and foreign.js are in
test/fixtures/r0/trusted-surface/forgery.json. RED: under HEAD
f170e91's scripts, `forgeryFindings` (paths rewritten to src/,
ForgeA given a foreign module) and `graphFindings` both returned `[]`
on the probe graph; test/structure-forgery.test.mjs failed to load
(`Cannot find module … scripts/forgery.mjs`). The textual
partial-escape rule (`textFindings`) does flag the four probe
sources that name `unsafe…`, but it is a word scan, not a dependency
check, and misses an FFI-only forger.
Survey (checked by reading the export lists of the installed
packages, listed in
test/fixtures/r0/trusted-surface/surveyed-packages.json; corrected
after the carry review, see below): the library modules using
`unsafeCoerce` are Data.Array.NonEmpty, Data.Exists,
Control.Monad.Free, Data.Functor.App, Partial.Unsafe, Data.Reflectable,
Data.Symbol, Safe.Coerce, Control.Monad.ST.Global,
Data.String.NonEmpty.CodeUnits, Data.String.NonEmpty.Internal and
PureScript.CST. Free, Data.Symbol and Data.Reflectable do not export
their `unsafeCoerce*` helpers; the others export only parametric types
(`mkExists`, `runExists`, `hoistLiftApp`, `coerce` under `Coercible`,
`toEffect`, `toRecovered`) or keep the coercion local. Of the
polymorphic foreign imports, Unsafe.Coerce's `unsafeCoerce ∷ ∀ a b. a
→ b` and Record.Unsafe's `unsafeGet`, `unsafeSet` and `unsafeDelete`
return an unconstrained type; Partial's `_crashWith` and
Partial.Unsafe's `_unsafePartial` are unexported, and `crash`,
`crashWith` and `unsafeCrashWith` throw.
GREEN (scripts/forgery.mjs): `coercionFindings` reports Runtime.ForgeA,
Runtime.ForgeB and Runtime.Cast (`depends on Unsafe.Coerce, which can
produce a value of any type`) and Program.UseD (Record.Unsafe);
`foreignSurfaceFindings` reports Runtime.ForgeA's unpinned foreign
module. Runtime.Types, Runtime.Syn and Program.UseC pass: each forges
nothing without one of those. The real tree gives `[]`; the pin holds
Runtime.Node's nine signatures. End to end: adding `import
Record.Unsafe (unsafeGet)` and `foreign import cast ∷ ∀ a b. a → b` to
src/Runtime/Node.purs made `checkStructure()` report `Runtime.Node
depends on Record.Unsafe, …` and `Runtime.Node: foreign imports differ
from the pin, added foreign import cast ∷ ∀ a b. a → b; …` (and the
partial-escape finding); restored, `[]`. Mutants (each applied to
scripts/forgery.mjs by a scratch script and restored; `node --test
test/structure-forgery.test.mjs test/structure-surface.test.mjs`): M1
Record.Unsafe dropped from the set, M2 allowlist ignored, M3 src filter
dropped, M4 foreign JS without a foreign import ignored, M5 comments
inside a declaration accepted, M6 a `foreign` not at column 0 ignored,
M7 signatures not compared, M8 stale pin ignored, M9 unpinned module
passes: each killed (M1 the routes and survey tests; M2 the routes
test; M3 the routes and real-tree tests; M4, M7 and M8 the signature
test; M5 and M6 the fails-closed test; M9 the routes, signature and
Forge tests). Limits (argued, superseded below): the JS body behind a
pinned signature and a type synonym it names were left to review; the
carry review's fix pins both files' hashes. A repurposed body in an
allowed importer stays with review.
## The collecting driver (2026-10-22)
R0 Task 1.2 (T-R0a §7, G-hide). `checkProgram` (Features.Check.Outcomes)
checks every body whatever happened to the others and returns a
`Report`: the entry judgement, one `DeclReport` per declaration in
declaration order (`name`, `today`, the shadow phase's legacy slot
holding today's `recheck` result, and `problem`, `Nothing` until
generation exists; ruling R2), and `program`, every diagnostic in
order or the checked program. The order is today's: `main`'s
printability, then bodies in declaration order, then the program-wide
stages (instantiation rule, then coverage), which still run only when
the entry and every body passed. `check` and `compile` are now the
first of `checkProgram` and `compileReport`; relocation through a
callee (`explained`) reads the callee's report instead of re-checking
it. The CLI is unchanged (its step is held back, §18.71).
Snapshot (checked): test/fixtures/r0/first-diagnostic.json is
`compile`'s output over the pinned corpus (1117 programs, 374
rejected), written at the parent commit 5d6b1cb from a fresh build
before any source change, by a scratch script equal to the test's
`outcome` (SHA-256 of the Go text, or the wired diagnostic).
test/r0-first-diagnostic.serial.test.mjs compares both `compile` and
the first of `compileReport` with it: no program moved, so acceptance,
emitted Go, codes, texts, spans and notes are unchanged. No fixture
changed. RED: test/r0-driver.test.mjs failed to load (`Cannot find
module … Features.Check.Outcomes`), the snapshot test with `does not
provide an export named 'compileReport'`. GREEN: both pass (5 tests).
Corpus compile time 5.1 s before, 5.4 s after (one run each): every
body is now checked when one fails.
Mutants (each applied to Features/Check/Outcomes.purs by a scratch
script, rebuilt, then restored; `node --test test/r0-driver.test.mjs
test/r0-first-diagnostic.serial.test.mjs`): D1, bodies after the first
failing one dropped (today's `traverse`): the three driver tests that
see two diagnostics fail. D2, the entry's diagnostic after the bodies':
the order test fails (no corpus program fails both, so the snapshot
does not see it). D3, the callee's report not found by `explained`:
the snapshot test fails on three programs (p10-neg.wxw,
p9-neg-alone.wxw, fx-services-programs.mjs:dropped#1), whose notes are
relocated through a callee. D4, coverage before the instantiation
rule: the order test fails. Regression row `r0-first-left-hides`
(scripts/regression-r0.mjs, D1 in a clone): the healthy compiler
passes its probe, the restored defect fails with `second broken
declaration hidden: E_TYPE Expected Int, found Bool`.
Task 1.1's check that compile reaches no R0 module is narrowed
(test/r0-verdict.test.mjs): from Program.Main exactly Domain.Verdict,
Domain.Recorded, their Internal modules and Domain.Verdict.Open are
reachable; only Features.Check.Outcomes imports them, and only the two
public modules; no Features.Check Strategy, Refute, Admit, Decide,
Generate or Checking module is reachable (ruling R6).
**Carry review of the forgery rule (final ruling; checked).** Threat
model, now stated in docs/engineering.md and AGENTS.md: the rules stop
accidental construction of a trusted verdict outside the trusted
modules; deliberate use of library partiality is out of scope and left
to review. Two corrections. The earlier survey sentence ("the only
modules whose exports produce a value of any type") was false, and
`unsafeIndex` does not give bottom: out of bounds it returns
`undefined` without throwing, as does `Data.Array.NonEmpty.foldl1` on
an empty array. C1: Program.UseE (`forgeE ∷ Valid; forgeE = foldl1
const (NonEmptyArray [])`, the same for `Refuted`), compiled with
`purs compile -o /out 'src/Domain/**/*.purs'
'.spago/p/*/src/**/*.purs' '/*.purs'` (exit 0); both values are
`undefined` at run time; depends on Prelude, Data.Array.NonEmpty,
Data.Array.NonEmpty.Internal and Domain.Verdict; added verbatim to
test/fixtures/r0/trusted-surface/forgery.json. Survey of the library
`*.Internal` modules: Data.Array.NonEmpty.Internal exports
`NonEmptyArray(..)` (an empty one), Data.String.NonEmpty.Internal
exports `NonEmptyString`'s constructor (an empty one) and
Data.Map.Internal exports `Map(..)` (an unordered or unbalanced tree):
each added to `forgingModules`. Data.List.Internal exports `Set`
abstractly, Control.Monad.ST.Internal exports `ST`, `STRef` and
`Region` without constructors, and Data.Traversable.Accum.Internal's
`StateL`/`StateR` wrap functions with no invariant: not added. No src
module imports any of the five. C2: Runtime.Node's pinned signatures
name local synonyms, so `type ReadAttempt = ∀ a. Effect (Either
ReadFailure a)` retargeted `readSourceWith` with the signature text
unchanged. scripts/foreign-surface.json now pins, in addition to the
signatures, the SHA-256 of each pinned module's whole .purs and .js;
any edit fails until a reviewed re-pin. The probe test now also checks
the JS-only route (ForgeA's source with its foreign import removed,
its JS kept); the fixture's `foreign` key was present, so ForgeA had
been flagged, but only through its `foreign import` line. RED (old
scripts/forgery.mjs plus a stub `foreignPin`; `node --test
test/structure-forgery.test.mjs`): UseE not reported, the forging set
test failed, and the synonym edit gave `[]` where a SHA-256 finding was
expected. GREEN: 28 structure tests pass; the real tree gives `[]`.
Mutants (each restored): MC1, Data.Array.NonEmpty.Internal dropped:
the routes and survey tests fail; MC2, the .purs hash not compared:
the signature and whole-module tests fail.
## No catch-all at the end of a body (2026-10-23)
R0 shadow tranche, Task 2.1 (AT16's first half; rulings R3, R11).
**`classify`.** Features.Check.Classify maps each `Failure` to
`AsHint | AsLimit | AsPlaceholder | AsFault | AsMismatch`. It is built
on RowOutcome's `classified`, the one match over `Failure` by name
(no catch-all), whose stops give the limit, fault and placeholder
classes. Its contradictions are refined by a fact `classified` now
keeps, `caused` (the cause and inner failure of a `FromMerge`): a
predicate's contradiction is a hint (T-R0a §10, D6 → a hint), the rest
a mismatch. `Stop`'s `Limit` now carries its `LimitReached`.
`Exhausted` is a fault (`Internal` stop, `AsFault (BrokenInvariant …)`)
by Task 0.2's result. Checked: test/r0-classify.test.mjs injects all
15 constructors directly, the payloads, a predicate's failure around
each stop, and agreement with `classified` on every arm. RED: before
the module existed, `node --test test/r0-classify.test.mjs` failed
with ERR_MODULE_NOT_FOUND for output/Features.Check.Classify. Regression
row `r0-classify-catchall` (deletes `classified`'s `Exhausted` arm, adds
`_ → contradiction`): `node scripts/regression.mjs
r0-classify-catchall` proves it (the fixed compiler passes; the
restored defect's probe fails with `Exhausted classed as AsMismatch,
not a fault`).
**`Exhausted` and compile.** RowOutcome is reached only through
Features.Check.RowEntry, the labels-only test driver; compile's
renderers already reported `Exhausted` as E_INTERNAL with its text. So
the mapping changes no compile output (argued from the import graph;
the corpus snapshot test/r0-first-diagnostic.serial.test.mjs is green,
checked). One test expectation moved: test/r005b-outcome.test.mjs's
injected `Exhausted` is now the `Internal` stop, not `Limit`.
**Today's renderers are not routed through `Classified`.** The plan
said EndReport, Require, Record and Reject render from `Classified`.
They still match `Failure` by name, now with one arm per constructor
and no catch-all, for two reasons (argued). They read payloads no
class keeps (a mismatch's types, a refusal's reason). And a
`FromMerge` around a stop goes to the predicate's renderer today
(`mergedAt`), where `classify` gives the stop's class, so routing
through it could change a text, which ruling R11 forbids. Nothing
makes such a `FromMerge` today (`located` and `attributed` never wrap
a stop), but that is an argument, not a check.
**`Internal`'s kinds (ruling R3).** `Internal InternalKind String`,
the kind never rendered: every kind renders as its text with
E_INTERNAL (checked, test/r0-classify.test.mjs). The kinds, derived
from the 82 places that now name one (each call of Specialize's
`internal` helper counted), each reviewed:
- `LaterWork`: Check/Placeholder.purs and Specialize/Record.purs's
several-tail placeholder.
- `RuleBroken`: the four renderers' `Unexpected`, EndReport's failure
outside its predicates, a bare `Homeless` in Require and Reject.
- `BoundPassed`: the four renderers' `Exhausted`.
- `BodyState`: Settle (two), Filing, TailPass, MarkReport, Removal.
- `Unrendered`: Reject's consumption fallback (`TooDeep`, `Occurs`,
`RowOccurs`) and EndReport's unexplained predicate refusal.
- `TableLookup`: every lookup of an id or index in a table an earlier
phase built (Resolve, Check and Specialize; the "Invalid … id",
"Invalid resolved …", "No such function", "Unnamed type variable",
"Inhabitation index out of range", "Invalid type argument" sites).
- `InputShape`: an earlier phase's output of a shape it excludes
(Arms, Extension, Handle, Signature (two), Matrix's field count,
Match's arity, Nested's and Lower's syntax mismatches, Resolve's
handler effect, Specialize's family and duplicate label).
- `PassInvariant`: a whole-program pass's own computation (Matrix's
vector length, Missing (two), Coverage, Expand (two), Components,
Go's families).
Routing for Task 4.3 (fixed now, while the assignment is fresh):
`LaterWork`, `RuleBroken`, `BoundPassed`, `BodyState` and `Unrendered`
are confined to one body's checking (`SearchBroke`, the run goes on);
`TableLookup`, `InputShape` and `PassInvariant` stop it. R3's context
mismatch (input an earlier phase built that does not fit) is
`InputShape`, or `TableLookup` when it is a missed lookup; 4.3's own
declaration-not-found is made by 4.3, not by a site here. Ambiguous:
`PassInvariant`'s coverage faults. Coverage runs per match but today
outside the body check (Features.Check.Outcomes, after every body), so
they stop; if a search ever runs coverage itself, they are confined.
Checked per kind at one site each, the failure injected directly
(Reject for `RuleBroken`, `BoundPassed`, `Unrendered`; placeholderAt,
Filing.missing, Tables.typeInfo, Signature.fieldTypes, Matrix.column).
Mutant: Reject's `Unexpected` kind set to `BoundPassed`; `node --test
test/r0-classify.test.mjs` failed "the renderers' stops: a rule
broken, a bound passed, no text" (7 pass, 1 fail); restored.
**`_` arms reviewed.** EndReport:43, Reject:54 and Record:166 became
named arms with the same results. UnifyRecord's `open` blames an open
failure on a predicate, a semantic claim, so its `_ → true` became
named arms (same booleans). RowMerge/End's `stop` sends a non-stop to
`Unexpected`, a fault, not a semantic claim: unchanged. Seen but
outside the task's files, not changed: RowMerge/Improve's `located`
(`_ → caused failure`, the same blame shape as `open`), Merged's
`mergedAt`, Contradicted's `rendered` and RowOutcome's `reasonOf`.
**A live defect (BACKLOG R020), recorded, not fixed.** Record.purs's
former catch-all sent every contradiction to `notSelected`, which
reports a missing field. With `fn pair(a: { ...r }, b: { ...s }): Int
where r disjoint s = 0;`, the body `let f = fn(p, q) => { let v = q.x;
let u = pair(p, q); p.x };` gives E_TYPE `x is not a field of { ..._
}` at `p.x`: `p`'s row is open, and what rules `x` out is the
disjointness with `q`, which the text does not name. A call that
breaks the same fact, `first({ x: 1 }, { x: 2 })` with `first`
returning its first argument under `r disjoint s`, gets D2's `Field x
is in both records: r disjoint s`. The failure is `Refused (Overlap
…)`: checked by adding `console.error('SELECT-FAILURE',
v.constructor.name, v.value0.constructor.name)` at the top of
`failed` in output/Features.Check.Record/index.js, compiling the
program (`Refused Overlap`), then restoring the file. Pinned by
test/r0-classify.test.mjs ("pinned R020"); the named arm `Refused _ →
unselected unit` keeps it.
Fixed 2026-11-28 (owner ruling, option (a); branch `r020-selection`):
`select` renders `Refused` with `refusedAt` at the label, so the program
gives D2's `Field x is in both records: r disjoint s` at the `x` of
`p.x`, noted `first written here` at the `q` of `pair(p, q)` and
`required here` at `r disjoint s`; a lacked label gives D1's `x is not
allowed here: r lacks { x }`, and update and removal give the same texts.
**FX010's constructor.** The same instrumentation at
output/Features.Check.Reject/index.js `rejected` shows the pinned
test/fixtures/r0/audit/fx010-record-payload.pinned.json reaches the
consumption fallback with `RowOccurs`.
**Fixtures.** 20 audit fixtures under test/fixtures/r0/audit/ had
their `site` line number moved to follow the edited files (MarkReport,
Reject, Resolve/Handler); source, code and text are unchanged, so no
corpus re-pin. No diagnostic fixture changed.
**Fix round 1 (review of Task 2.1).** A bare `Homeless` was a
contradiction in `classified`, so `classify` called it a mismatch,
while Require and EndReport report it as a broken invariant (it is
made only inside `FromMerge`). Now a bare `Homeless` is the `Internal`
stop (`AsFault (BrokenInvariant "H's refusal outside a predicate")`),
and inside `FromMerge` it stays a contradiction (`AsHint`): the
`FromMerge` arm decides a `Homeless` inner itself and sends anything
else back to `classified`. Reject's bare `Homeless` now has kind
`RuleBroken` (was `Unrendered`); kinds are unrendered, so its text is
unchanged. Checked in test/r0-classify.test.mjs. The regression row's
needle follows the edited lines.
**Regression rows.** Two older rows restore a defect that builds an
`Internal` (`deferred-fail-effect`, `fx025-unbound-row`); their
replacements now name a kind and import it (a second edit each). The
first full verify failed on the first of them (the clone did not
compile); after the fix `node scripts/regression.mjs
deferred-fail-effect fx025-unbound-row r0-classify-catchall` proves all
three.
## Static rules beside the verdict (2026-10-23)
R0 shadow tranche, Task 2.3 (AT10; rulings R5, R8; plan review S5,
N5). Features.Check.Generate.Static classifies each raise site of the
refusals below, where today's code raises it: `Rule StaticCode` (class
a), `ByPolicy PolicyCode` (class b′) or `Semantic` (left to the
verdict). `staticRefusal at site` gives the `StaticRefusal` at a node,
or none for a semantic site. The sites are constructors of
Features.Check.Generate.Static.Site, grouped by what they read; each
group's classifier names every constructor, with no wildcard arm. No
raise site was edited and no check moved. `staticRules ∷ Tables → …`
is Task 3.2's (`Tables` does not exist yet).
**Ordering rule.** Every check keeps the position where today's code
raises it, so the first diagnostic is unchanged (checked: the
first-diagnostic snapshot, test/r0-first-diagnostic.serial.test.mjs,
passes in the full verify). A separate pass before generation takes
effect only with Task 4.6. `SameDisjoint` (Resolve/Requirements.purs:72)
and `RepeatedTail` (Resolve/Apart.purs:88, RecordFields.purs:53) stay
in Resolve, classified `Policy`; moving them to per-declaration
refusals is left to a later ruling (plan §8.1).
**Classes.** The site table, with file:line, token and evidence per
site, is test/r0-static-sites.mjs (48 sites). In summary:
| Sites | Class | Evidence |
| --- | --- | --- |
| Arity at Pipe.purs:33 (`fixedResult`), Call.purs:144 | StaticRule | checked (audit) |
| Arity at Pipe.purs:36, Call.purs:148 (`functionLike`) | Semantic | checked (audit) |
| Arity at Call.purs:123, Show.purs:27, Operation.purs:64, 104 | StaticRule | argued: a count against declared fields, or one argument, before inference |
| Arity in Resolve: Handler.purs:102, Qualified.purs:168 | StaticRule | checked (probe) |
| EntryProblem in Resolve: Entry.purs:30, 43 | StaticRule | checked (probe) |
| EntryProblem at Check/Outcomes.purs:136 (`printableEntry`) | StaticRule | argued: reads `main`'s resolved result and the declared types' function holders, no `State` |
| FieldArity (Pattern.purs:90), FunctionNeedsCall (Qualified.purs:97, Name.purs:47), TypeArguments (Row.purs:47, TypeArguments.purs:49, HandlerType.purs:27) | StaticRule | checked (probe) |
| HandlerMissing, HandlerDuplicate, HandlerOperation (3), FailNeedsConcrete (Resolve/Row.purs:82), NofailOnFail, MarkVariableOutsideSignature | StaticRule | checked (audit) |
| SameDisjoint, RepeatedTail (2) | Policy | checked (probe) |
| Every effect refusal raised by check (14 sites), FailNeedsConcrete at Check/Failure.purs:102 | Semantic | checked (audit); RowName.purs:96 argued |
| RedundantArm, NonExhaustive, AmbiguousType | Semantic | checked (audit) |
No coverage site is a static rule (the audit's recommendation).
FieldArity, FunctionNeedsCall and TypeArguments, unexamined by the
audit, were examined by its method for Resolve rows: every raise site
is in Resolve (the completeness test below finds no other), Resolve
reaches none of the online solver (r0-audit.test.mjs), and a probe of
each site's refusal stops in Resolve with today's code and text. The
probes do not show which of two Resolve sites of one refusal a program
reaches; the class does not depend on it.
**Tests (checked).** test/r0-static.test.mjs, 8 tests: every site and
family constructor of the compiled Site module is in the table, once;
each, injected directly, has its class and refusal (at a stand-in
site, since `Site` is uninhabited); the classifier's source has no
wildcard arm; every cited line holds its token; every line of
src/Features naming a classified refusal is a cited site, a match, or
the arity helpers, whose callers are pinned (Pipe.purs:33, 36;
Call.purs:123, 144, 149); every audit fixture's class agrees with its
site's (structural is a StaticRule, semantic is Semantic); the Resolve
probes; and AT10: d03 (`r disjoint r`) stops in Resolve with E_TYPE
and its site gives `Policy PolicySameDisjoint`, a fixed-result arity
program stops in check with E_ARITY and its site gives `StaticRule
StaticArity`. `StaticRefusal` is not `Verdict`: a scratch module
`bad ∷ Site → Verdict; bad at = StaticRule StaticArity at` fails purs
0.15.16 with `Could not match type StaticRefusal with type Verdict`; a
positive module using `staticRefusal` compiles (probes deleted).
**RED and mutant runs (recorded).** RED: before the module existed,
`node --test test/r0-static.test.mjs` failed with ERR_MODULE_NOT_FOUND
for output/Features.Check.Generate.Static. Mutants ran in one isolated
copy in the session scratchpad (output/, src/, scripts/, the test, its
support, the audit fixtures), each restored after its run, the copy
deleted; unpatched, 8 of 8 pass.
- S1, output/Features.Check.Generate.Static/index.js line 176,
`PipeFunctionLike` returns `new Rule(Domain_Verdict.StaticArity.value)`
for `Semantic.value`: fails "each site injected directly has its class
and refusal".
- S2, same file line 68, `DisjointSame` gives `PolicyRepeatedTail`:
fails that test and "AT10: d03 is a Policy, a fixed-result arity a
StaticRule".
- S3, src/Features/Check/Generate/Static.purs, `settledClass`'s arms
replaced by `_ → Semantic` (the same behaviour): fails "the
classification has no wildcard arm".
- S4, src/Features/Check/Operation.purs, a second line `again _ = Left
(problemAt Arity span)` after line 64: fails "every raise site of a
classified refusal is classified" (and "every cited site holds its
token", since line 104 moved).
- S5, an exported nullary constructor `ExtraSite` appended to
output/Features.Check.Generate.Static.Site/index.js: fails "every
site and family constructor is injected once". (Its first run read the
constructors through Static's re-exports and passed, so the test now
reads them from the Site module; S1-S4 were re-run on that version
with the same results.) After these runs Static stopped re-exporting
the Site types (amendment: callers import Site); the compiled arms
S1 and S2 patch are at the same lines, and 8 of 8 still pass.
**Fix round 1 (review Important 1; amendment).** The first wildcard
test read lines with a regex, and three forms passed it while behaving
the same: `settledClass _ = Semantic`, `markClass = const Semantic`,
and `ArityAt _ → Semantic` with `arityClass` deleted. It is replaced
by "the classification names every constructor, with no catch-all",
which reads the syntax tree: a new tools/style/src/Style/Arms.purs
parses a module with language-cst-parser (as Style.Check does; a parse
error is refused) and reports its `_` binders, the constructor each
case-arm pattern starts with, arm patterns that start with none, the
constructors its data types declare, the declarations whose equations
bind arguments, and the identifiers it uses. The test requires no `_`
binder and no arm without a constructor in Static.purs; its arm
constructors equal, once each, the 56 Site declares (48 sites, 8
families) and StaticClass's 3 (staticRefusal's match); only
staticRefusal binds arguments; no `const`. An arm that binds a family's
site and ignores it (`ArityAt site → Semantic`, helper kept) passes
this test, but purs warns UnusedName (Static.purs:61) and
UnusedDeclaration (`arityClass`), which the build's `spago build
--strict` makes errors (scripts/build.mjs; checked by running `purs
compile` on the mutant, warnings shown).
Mutant runs (recorded): one isolated copy in the session scratchpad
(output/, src/, tools/, scripts/, the test and its support, the audit
fixtures), Static.purs patched and restored for each, the copy deleted;
unpatched, 8 of 8 pass. Command each time: `node --test
test/r0-static.test.mjs`. Each of the four fails exactly "the
classification names every constructor, with no catch-all":
- S3, `settledClass`'s four arms replaced by `_ → Semantic`.
- S3-equation, `settledClass` defined as `settledClass _ = Semantic`.
- S3-const, `markClass = const Semantic` (with `import Prelude
(const)`).
- S3-nested, `ArityAt site → arityClass site` replaced by `ArityAt _ →
Semantic`, `arityClass` deleted.
## The recorded problem's fields (2026-10-23)
R0 shadow tranche, Task 3.1 (ruling R4; T-R0b §2.3, §3.5, §5.2, §6,
§10; D1 spec §6.2). `RecordedProblem` wraps `Fields`, T-R0b §10's
record verbatim, and derives `Eq`; `decl ∷ FunctionId` is carried
unconditionally. Domain.Recorded exports the type names and `fields ∷
RecordedProblem → Fields`; it imports the constructor to define the
view, as an allowed importer of Domain.Recorded.Internal.
**Representation choices (argued).** `Var` is `RigidVar VarId |
FreshVar Path Role`: §2.3 names fresh variables `⟨p, role⟩` and §6
identifies a rigid one by its `VarId`, while §10's `rigidTy` holds
`Var`s. `Path` is a newtype over `{ root, steps }`, the root being the
body or one of §6's four signature fields, each step a name or an
index. `RuleId` and `SpecRow` are typed (`ExprRule 11`, `SpecRow RowB
1`), not strings. **Amendment** to §5.2: `VarInfo.origin.role` is
`Maybe Role`, `Nothing` for a rigid variable, which §2.3 gives no role.
`CheckedName` keeps T-R0b's eight constructors; the D1 spec's proposed
`ClauseParamType` (§12.2) is not added.
**Boundary probes (checked; purs 0.15.16, scratch modules compiled
with src and .spago packages, then deleted).** A module named
Features.Check.Decide.Probe reading `(fields p).outside` and
`(fields p).decl` compiles. In the same module, `Recorded.RecordedProblem
record` fails with `Unknown data constructor Recorded.RecordedProblem`;
importing `RecordedProblem(..)` from Domain.Recorded and applying it
fails with `Unknown data constructor RecordedProblem`; `coerce ∷ Fields
→ RecordedProblem` (Safe.Coerce) fails with `No type class instance
… Coercible … Solving this instance requires the newtype constructor
RecordedProblem to be in scope`. Features.Check.Generate.Probe
importing `RecordedProblem(..)` from the Internal module compiles.
**Tests (checked).** test/r0-recorded.test.mjs, 5 tests: the view has
exactly the 14 fields and reads them back; two problems built alike
are equal, and changing any one field makes them unequal; `decl` alone
tells two atom-free problems apart; every constructor of Atom and
Origin has its arity; Domain.Recorded exports `fields` and no
`RecordedProblem`. RED: before the modules existed, `node --test
test/r0-recorded.test.mjs` failed with ERR_MODULE_NOT_FOUND for
output/Domain.Recorded.Atom. A first GREEN run failed "problems built
alike compare equal": the test passed a bare role where `Maybe Role` is
expected; the test was corrected. test/r0-verdict.test.mjs's
reachability list gains Domain.Recorded.Atom and .Origin.
**Mutant runs (recorded).** In one copy of output/ and the test in the
session scratchpad (deleted afterwards); unpatched, 5 of 5 pass.
- M1, output/Domain.Recorded.Internal/index.js, ` && eq6(x.types)
(y.types)` deleted from `eqRecordedProblem`: fails "problems built
alike compare equal; a change in any field does not".
- M2, same file, `eq3(x.decl)(y.decl) && ` deleted: fails that test and
"decl alone distinguishes two otherwise empty problems".
- M3, output/Domain.Recorded/index.js, `export { RecordedProblem } from
"../Domain.Recorded.Internal/index.js";` appended: fails "Domain.Recorded
exports the view, not the constructor".
**Fix round 1: equality on long spines (checked).** The paragraph
first here argued that derived `Eq` on `RTExpr`, recursing once per
arrow, was safe because depth is bounded by nesting. That was wrong:
an arrow spine is as long as a declaration's parameter list
(Type/Core.purs:46-48), the repo compiles 80,000-parameter forms
(test/fn-linear.serial.test.mjs, value reference `g(f)`), and D1's
`elaborate` compares problems. The reviewer's run: derived `eqRTExpr`
true at 5,000 arrows, `RangeError` at 20,000. `Eq RTExpr` is now hand
written: `sameSpine` walks the spine by a self tail call, which purs
compiles to a loop (`$copy_left` in output/Domain.Recorded.Atom), and
recurses only into parameters and record or application arguments; no
wildcard arm. No other new instance walks a spine (`Var`, `Role`,
`Path` and the rest hold no `RTExpr` chain; `Atom`'s and `Fields`'
derived `Eq` call `eqRTExpr`). Test "RTExpr equality walks an
80,000-arrow spine without overflow": equal spines, spines unequal at
the end, and two problems holding one in `types`. RED: in a scratch
copy of src/ and output/ with `derive instance eqRTExpr ∷ Eq RTExpr`
restored and recompiled (purs 0.15.16), that test failed with
`RangeError: Maximum call stack size exceeded`; the other 5 passed
(copy deleted). Also in this round: `OriginKind`'s `Inst` is now
`InstOrigin`, so a module importing `Atom(..)` and `Origin(..)`
unqualified meets no ambiguity with the role `Inst`.
## RT1's translator (2026-10-23)
R0 shadow tranche, Task 3.3 steps 1-3 (T-R0b §9 item 1; ruling R9).
A second implementation of T-R0b §3, written from
research/division-campaign/r0/recorder-rules.md and Task 3.1's types
before any generator code exists (Task 3.2 has no commit). It is
test-only: test/r0-translator.mjs and six helper modules read resolved
syntax from the compiled output and return canonical problems. The
canonical serialization, test/r0-canonical.mjs (decoder in
r0-canonical-decode.mjs), is ruling R9's single one: plain JSON with
sorted object keys, arrow spines flattened (`{ fun: { params, result
} }`, a loop for long spines), entry arrays in recorded order, `vars`
and `types` as pairs in Data.Map's key order. `canonicalOf` keeps
`flexTy`/`flexRow` in recorded order; the translator emits them by
`compareVar`, so a comparison sorts both. Canonical order, stated
there: record fields by label (code units, PureScript's `Ord String`),
tails by the derived `Ord Var` (`compareVar`; RigidVar before
FreshVar, then path root, steps with `Named` before `Index`, then role
in constructor order). `entryMultiset` gives RT1's multiset of `[list,
Origin.atom, value]`; the comparison itself (steps 4-5) waits for Task
3.2.
**Readings T-R0b leaves open (argued; each a finding for RT1's
comparison to settle by T-R0b's text).** The translator implements the
most literal reading and states it in test/r0-translator.mjs.
1. Path steps (§6) are examples only (`Call/args/2`). Read as
constructor, field, index; the field names are this translator's
(listed in the module header). Task 3.1's report already left the
vocabulary to Task 3.2, so the two will differ unless one adopts the
other's.
2. §6 gives no path to Sig1 (rigid variables) or to `f.row`. Rigid
variables: `parameters/[variables, i]`; effect-row label arguments:
`result/[row]`. Sig3's atom sits at ε, "at path ε" in its row.
3. `AtomId` is not unique. Several rules emit at one path (Sig3 and the
body's root rule at ε; Sig6, Sig8 and Sig8's markers at a
parameter), and the index counts per rule. `Origin.rule` tells them
apart. RT1's pair `(Origin.atom, entry)` still compares as a
multiset.
4. Index order: a rule's listed entries in order, then §2.2's markers
in pre-order of the types translated. §3 does not place markers in
the order. The rule is uniform: E5's and E6's listed entries
include E3's or E4's block and then the argument equations and the
over-application atom, so their markers come after all of these
(E6 over-applied: F1 at index 0, B1 at 1, the marker at 2). Sig8's
markers follow Sig8's `lacks` at the same path; E20's follow its
HandlerType; E17's follow its equations and EffectArgument.
5. Marker granularity: one marker per `app` built. DataOverRecords
when the declared type has a record-row parameter, else
DataApplication. A `TData` whose only arguments are effect rows is
`app t []`, marked DataApplication. Markers of f's own parameter and
result types are Sig8's, whatever the kind.
6. **Conflict with Task 3.1's types:** `Handler(Console)` (a builtin
effect's handler type, §2.2) has no `Head`: `HandlerHead` takes an
`EffectId`. Three corpus programs write one
(test/fx008-probes/rev6/con2.wxw, test/fx-run-programs.mjs:cases#17,
test/fx-task7-programs.mjs:checkedRuns#3). The translator writes
`{ handler: 'Console' }` (or `'Fail'`); Task 3.2 must extend `Head`
or state another form.
7. Rows (§6 "Row"). Rows are not part of RT1's multiset; the
translator's choices, exactly: Sig3 B1, Sig4 A1, Sig5 A2, Sig6 A3,
Sig7 A4, Sig8's `lacks` A5, Sig10 C5. E3/E5: written clauses of
θ(D_g) F2, implied F3, `adm` F7, `split` H2; E5/E6 argument
equations F1, the over-application atom B1; E4/E6 joined pairs F8.
E7-E9, E11, E12, E14, E15 and E10's `eq` B1, E10's `cmp` C6; E13
B14; E16 `eq` B1 and Deferred O6; E17 equations B1 and
EffectArgument O2; E18, E19 `pr` C1; E20, E21 HandlerType O3; E22
and E23 equations B1 and FailFamily O4; E25 B2, E26 B4, E27 B7, E28
B8; P3, P4 B1, P5 B12, P6 B11, P7 B10. §2.2's markers, under every
rule: DataOverRecords O5, DataApplication F8, HandlerType O3. Where
these differ from the rule's rows column (B1 for E6, E17, E22, E23;
F1 for E6; F8 outside E4/E6/P4), the text ties the entry to the
row: B1 is recorder-spec's "every typed agreement the body states",
F1 its argument row, F8 its row for `app` with arguments (§7).
8. E4's "implied of c.joined" read as `disjoint` per joined pair only;
the constructor's fields' implied `lacks` are not added.
9. E6 with more arguments than fields: τ, `⟨p, res⟩` and the
over-application atom as E5, although E6's Fresh column says "as
E4".
10. E20 types the handler by fresh `inst` variables only, as written;
the label's written arguments (`State(Int)`) are not equated;
HandlerType marks the gap.
11. E23's "translates to a type with no record and no variable" is read
on the translation: a declared family (`Err`) is `base`, so no
marker even when its constructors hold records; a written record
family is marked.
12. `spread j` counts from 1 (E25 writes `spread 1 … spread k`).
13. `adm` slots: every `inst` variable; `split` slots: the record-row
ones (§10 "RecordSort slots").
14. A variable's origin span: the label's for `field l`, `upd l`,
`updrest l`; the spread item's for `spread j`; the parameter's for
E13's `param k`; the node's otherwise; the declaration's for a
rigid one.
15. Effect parameters are taken as types: resolved `EffectInfo` has no
sorts, and BACKLOG R009 says effects take type parameters only.
16. E22's clause local is bound at the label's single argument; a
clause label with another count binds nothing (none in the corpus).
17. Sig6 and Sig8 split Implied.purs's facts: a record's own labels are
Sig6, a declared type's record argument Sig8, its labels by
`declared` (reimplemented, not imported).
18. RT1's "§5.3 normalization" is recorder-spec §5.3's
definedness-preserving one (T-R0b §5.3 is the site table). It
belongs to the comparison, so steps 1-3 do not apply it.
19. E16's `defer` entries (`eq τ_e Unit`, then Outside Deferred) sit at
the item's path, `Block/items/i`, with the item's span, not at the
Block node's path; the deferred expression is at
`Block/items/i/Defer/value`.
20. **T-R0b gap:** §5.2 assigns every `inst i` to `Slot p i`, and the
translator does so for P4's too, but `Slot` lists only Call,
FunctionRef, Construct, CtorRef, OperationRef, Perform and Handler:
a checked `Ctor` pattern (Checked/Internal.purs:129) has no
Instantiation, so P4's `Slot` names no checked-IR position. Task
3.2 should decide between this literal reading and `Auxiliary`
(which would then need a defining atom, §5.3).
21. Origin kinds: Sig4, Sig5, Sig10 contract; Sig6-Sig8 types; Sig3
body. θ(D_g), `adm` and `split` (E3, E5) and E4/E6's joined pairs
inst; E13's definedness atom types; every other atom body. Markers
of §2.2 take the translating rule's kind: types for f's own types
(Sig8) and written types in the body (E13, E22, E23), inst for
θ-instantiated ones (E3-E6, E17, E20, P4). Explicit markers
(Deferred, EffectArgument, E20's and E21's HandlerType, FailFamily)
are body.
B13 is not settled here: its evidence is RT1's comparison (step 4).
LocalGeneralization is produced by no resolved construct (§3.5), so it
is exempt from the per-kind check (ruling R11).
**Tests (checked).** `node --test test/r0-canonical.test.mjs
test/r0-translator-signature.test.mjs test/r0-translator-calls.test.mjs
test/r0-translator-forms.test.mjs test/r0-translator-records.test.mjs`:
40 pass. Each rule's expected entries are written by hand from §3's
tables. G-total: the translator's constructor lists equal those parsed
from src/Domain/Resolved.purs (36 Expr) and Resolved/Core.purs (6
Pattern). r0-canonical decodes every constructor of Domain.Recorded's
vocabulary, each injected in its fixture (fix round 1 added SortType,
RowGroups A, B, C, D, H, O and kinds Contract, Types, InstOrigin),
sorts as the compiled `ordVar` does, and decodes an
80,000-arrow spine. `node --test
test/r0-translator-total.serial.test.mjs`: 5 pass. Over the pinned
corpus (973 resolving programs, 2,958 declarations) it checks that
translation returns, that every variable an entry or type mentions is
in `vars`, that canonical order holds, that every rule but the
entry-free ones (Sig1, Sig2, Sig9, E1, E2, E24, P1, P2) emits, and
that every marker kind but LocalGeneralization occurs. No RED run
exists: the modules were written before their tests. The mutants
below stand in for it.
**Mutant runs (recorded).** Each mutant was run on a copy of the new
test modules in the session scratchpad, with output/ and src/ linked,
over the five rule-level files; the copy was then deleted. Unpatched:
40 of 40 pass.
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 | calls.mjs `arrow(args.slice(n), res)` → `slice(n + 1)` | E5, E6 |
| M2 | records.mjs `{ spread: spreads.length + 1 }` → `spreads.length` | E25 |
| M3 | records.mjs P6's rest positioned `restType` (`rule !== 'P5'`) | P5-P7 |
| M4 | types.mjs `rowsOf(type).forEach(row` → `[].forEach(row` | Sig6 depth |
| M5 | canonical.mjs `compareVar` puts FreshVar first | compareVar, outOfOrder |
| M6 | exprs.mjs E10's `cmp` of `Bool` instead of the left operand | E7-E11 |
| M7 | context.mjs index counter keyed by path only | Sig3, Sig6/7, Sig8 |
| M8 | calls.mjs `split` only when `rows.length > 1` | E3 |
| M9 | effects.mjs `pr` when `types.length >= 1` | E19 |
| M10 | effects.mjs FailFamily only when no family is written | E23 |
M4 and M10 survived a first run. The Sig6 test gained an arrow's
effect row and E23 a record family, and both then failed as listed.
**Fix round 1 (task review, 2026-10-23).** The reading list above is
the shared spec reading Task 3.2 receives, so it now states what the
code does. E5/E6 emitted their markers before the argument equations,
against reading 4; the code now emits them last (one uniform rule
rather than a per-rule exception), and the E6 test pins F1 at 0, B1 at
1, the marker at 2. Readings 19-21 (E16's path, P4's `Slot` gap,
origin kinds) are new; reading 7 lists every row. The marker-row
choice is a table with no default arm, and `outOfOrder` requires
strictly ascending fields and tails (a repeated label is out of order,
tested). Focused tests: 40 pass.
## Generation rules (2026-10-23)
R0 shadow tranche, Task 3.2 (T-R0b §2-§6, §10; rulings R2, R6; Task
2.3 and 3.1 carries). Features.Check.Generate exports `generate ∷
Tables → Signatures → FunctionDecl → RecordedProblem` (an `Either`
since fix round 1, below), `staticRules` and the types `Tables` and
`Signatures`, an enumerated list with no empty problem (checked: the
export test;
a scratch module importing `emptyProblem` from it fails purs 0.15.16
with `Cannot import value emptyProblem`). Compile does not call it.
The builder is Generate.Inputs `generationInputs ∷ Resolved.Program →
{ tables, signatures }` (named apart from Features.Check.Tables). The
rules live in Generate.Signature (Sig1-Sig10, with Generate.Rigid and
Generate.Facts), .Call (E3-E6), .Expr (dispatch, E1, E2), .Operator
(E7-E11, E14, E15), .Control (E12, E13, E16), .Record (E24-E28),
.Builtin (E18, E19), .Effect (E17, E20, E21), .Failure (E22, E23) and
.Pattern (P1-P7); each rule id is in a comment beside its code.
**The applicative invariant (T-R0b §4), and how the code keeps it.**
Every rule reads only Generate.Context (`decl`, `tables`, `signatures`,
`locals`) and its children's results; no checker state, substitution,
meta counter or solved type is in scope. Mechanically (checked: test
"generation reaches no checker state"), the import closure of
Features.Check.Generate reaches no Features module but Generate.* and
seven pure table readers it reuses (Check.Implied `declared`,
Check.Tables `ownerType`, Check.Functional, and their imports
Check.Nested, NestedArguments, Components; Resolve.Builtin), and no
Generate module imports Domain.Checked* directly. (Corrected, fix round
1: the closure does reach Domain.Checked.Internal, through
Check.Functional's import of Check.Nested; the test bans only direct
imports. That is harmless: generation is handed no checked value and
builds none, so the reachable checked-IR types are never inhabited
here.) Fresh variables are canonical
names, so generation needs no counter: it is a pure fold, and each
rule's index is its own listed order. Records are built by one
constructor that sorts fields by label and tails by `Ord Var`.
**Readings.** docs/findings.md "RT1's translator" readings 2-21 are
followed as written. Reading 1 leaves the step vocabulary open; this
generator's (indices from 0): `Call/args/i`, `Construct/args/i`,
`Add|Concat|Compare/left|right`, `Interpolate/parts/i`,
`If/condition|then|else`, `Match/scrutinee`,
`Match/arms/k/pattern|body`, `Lambda/body`, `Apply/function`,
`Apply/args/i`, `Pipe/left|right`,
`Block/items/i/(Let|Defer|Discard)/value`, `Block/result`,
`(Perform|Print|Show|Crash)/args/i`, `Handler/clauses/k/body`,
`With/handler|body`, `Handle/body`, `Handle/clauses/k/body`,
`Fail/payload`, `RecordLiteral/fields/i/value`, `FieldAccess/record`,
`RecordUpdate/record`, `RecordUpdate/fields/i/value`,
`RecordExtension/items/i/(Given|Spreading)/value`,
`RecordRemoval/record`; patterns `Ctor/args/k`,
`Record/fields/k/pattern`. RT1's comparison (Task 3.3 step 4) will
find where the translator's differs. Choices the readings leave open,
argued:
- θ(D_g) (E3, E5): written clauses in constraint order (a `lacks`
clause's labels in written order), then implied: Sig6's facts over
the callee's parameters, result and row arguments, Sig7's pairs,
Sig8's facts. One fact's labels are in label order.
- Markers' pre-order: E3, E5 translate T₁ … Tₙ then R; E4, E6 the
fields then the owner; P4 the owner then the fields; E17 T̄ then the
result; E20 the clauses' parameter types in order; E22 the clauses'
payloads in order.
- Spans: an entry has its node's span, except Sig4 (the label), E25's
spread atom (the item), E26 and E27 (the label). Sig6 and Sig8 use
the parameter's span, the written result type's for the result
(Sig10 too) and `rowSpan` (else the declaration's) for the row.
- E15's `⟨p, res⟩` is positioned at `NodeType p`, as E14's; §5.2's
list names E14 but not E15.
- E20's clause parameters take the clause's `HandlerParameter.ty`,
which Resolve copies from the operation's declared parameter
(Resolve/Handler.purs:106-112), under θ. A builtin effect's
parameters come from Resolve.Builtin (Console none, Fail one).
- E22 binds a clause's local when its label has exactly one argument
(reading 16), translating that argument with `ν_f`.
- (Superseded in fix round 1, below: a lookup that misses is a fault,
not an empty entry.)
Concerns with the shared readings (followed anyway): reading 20 (P4's
`inst` at `Slot`, a position the checked `Ctor` pattern lacks) is kept
literal; reading 9 (E6 over-applied gets `⟨p, res⟩`, against E6's
Fresh column) is kept.
**`Handler(Console)`.** Domain.Recorded.Atom's `HandlerHead` now takes
a Domain.Row `EffectRef`, so a builtin effect's handler type has a head
(`HandlerHead ConsoleEffect`); the canonical form writes a declared
effect by its id and a builtin by name (`{ handler: 'Console' }`).
Checked: the canonical test decodes both builtins; E21's test pins
`Handler(Console)`; a scratch module applying `HandlerHead` to an
`EffectId` fails purs with `Could not match type`.
**Static rules.** `staticRules` is Generate.Static.Rules (not
Generate/Static.purs, whose syntax-tree test admits only the
classification's own arms). **Amendment:** its type is `Tables →
Signatures → FunctionDecl → Array StaticRefusal` (in `Either` since
fix round 1), since arity at a
fixed result reads the callee's declared result, which `Tables` lacks.
A resolved declaration can break only the class-a rules check raises:
Pipe.purs:33, Call.purs:123 and :144 (functions and constructors),
Show.purs:27, Operation.purs:64 and :104, Outcomes.purs:136. Each is
found syntactically and refused through Task 2.3's `staticRefusal`,
at the node's path. Checked (test/r0-static-rules.test.mjs): for each
site a fixture that today's checker stops in check with the same code
(E_ARITY, E_ENTRY) gets exactly that refusal; Pipe.purs:36's
instantiated case gets none; an accepted program gets none. Its walk
(Generate.Static.Walk) visits exactly the expression paths generation
records, over the whole corpus (checked, serial test).
**Every `Problem` constructor (Task 2.3 carry).**
Generate.Static.Problem's `disposition ∷ Problem → Disposition` is a
typed path from a raised problem to its class: Task 2.3's 28 give
their raise sites (`AtSites`, classed by `staticClass`); the other 36
name the phases that raise them (`Placed`): before resolution (lexer,
parser), a Resolve rule with its `StaticCode`, a Resolve body-type
check that is semantic (`RowMayHaveField`, `NotKnownDisjoint`, decided
to move into generation), a Resolve support limitation
(`SecondSpread`), check's semantic refusals, whole-program stages
(`PolymorphicRecursion`, `NestedDatatype`), lowering, the inferred-type
limit (`TypeTooDeep`) and faults (`Internal`); `Hinted` takes its
inner problem's. `StaticCode` gains `StaticUnbound`, `StaticDuplicate`,
`StaticNotCallable` and `StaticSort` (sort errors: `RowSort`,
`RecordRowAsEffect`, `EffectRowAsRecord`, `TypeAsRecordRow`, Resolve's
`ExpectedRecord`). These Resolve refusals never stand beside a
recorded problem (no resolved declaration exists, T-R0b §8);
`staticRules` raises none of them. Domain.Verdict was split first
(its static types are Domain.Verdict.Static, re-exported, behaviour
unchanged). Checked (test/r0-static-problem.test.mjs): the 64
constructors (read from the source by Style.Arms) are the 28 sited
and 36 placed, once; each, injected, has its disposition, the sited
ones exactly their rows of test/r0-static-sites.mjs; the match has
no catch-all; each placed one's cited raise line holds it in its
phase; and every src line naming a placed constructor lies in one of
its phases (`Internal`, and `RowSort`, `Syntax`, `SecondSpread`, which
other types also name, exempt).
**Tests (checked).** `node --test test/r0-generate-signature.test.mjs
test/r0-generate-expr.test.mjs test/r0-generate-forms.test.mjs
test/r0-generate-pattern.test.mjs test/r0-static-rules.test.mjs
test/r0-static-problem.test.mjs`: 45 pass. Each rule (Sig1-Sig10,
E1-E28, P1-P7) has a fixture whose `(AtomId, entry)` list is written
by hand from §3's tables and the readings, each fixture also passing
RT6 and RT7. RT5: the Expr, Pattern, Rest and Item constructor lists
equal those declared in Domain/Resolved.purs and Resolved/Core.purs,
and each reaches its rule in a fixture (its node's type is recorded).
RT6: every entry's path resolves, by a resolver written against the
compiled resolved syntax, to a node of the recorded span (a label's
or item's span inside it). RT7: every variable an entry, type or site
mentions is in `vars`; `Forall` ones are exactly Sig1's; a fresh key
agrees with its origin's path and role, a rigid one has none; every
auxiliary has exactly one §5.3 defining atom whose operand mentions no
variable of its node. `node --test
test/r0-generate-total.serial.test.mjs`: 4 pass; over the pinned corpus
(973 resolving programs, 2,958 declarations) generation returns, twice
alike; RT6, RT7 and canonical order hold for every problem; every rule
with entries and every marker kind but LocalGeneralization occurs;
`types` holds exactly the expression and pattern nodes.
**RED and mutants (recorded).** In one copy of output/, src/, scripts/
and test/ in the session scratchpad (deleted afterwards): with the
generator's compiled modules removed, each of the six files above
failed with ERR_MODULE_NOT_FOUND for output/Features.Check.Generate.
Mutants patch the compiled JS, one at a time, restored after each;
command `node --test` over the six files; unpatched, none fail.
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 | Call: E5/E6 markers before the equations | E6 over-applied |
| M2 | Translate: DataOverRecords never chosen | Sig6, Sig8 |
| M3 | Record: `spread j` from 0 | E25 |
| M4 | Pattern: P6's rest at `RestType` | P5, P6 |
| M5 | Fresh: effect-row variables given a sort | 28 tests (RT7, every `inst` fixture) |
| M6 | Generate: `rigidRow` keeps type variables | Sig1; rigid variables |
| M7 | Effect: EffectArgument unconditional | E17 |
| M8 | Static.Rules: a variable result counted fixed | static sites |
| M9 | Static.Problem: TypeMismatch as ProgramWide | dispositions |
| M10 | Signature: no entry | Sig9, Sig10; static sites |
| M11 | Operator: `cmp` at the right operand | E7-E11 |
| M12 | Pattern: field at the record's path | P7 |
M7 and M11 survived a first run; E17 gained an effect without
parameters and E10 a comparison whose operands' types differ, and both
were then killed as listed.
**Fix round 1 (task review, 2026-10-23).** RT1's comparison by the
reviewer (all 2,958 corpus declarations, generator against the
independent translator) agreed on every `(Origin.atom, entry)` but one
path step; the controller's rulings (progress ledger, "Task 3.2:
Ruling") settle four points.
1. The `fail` payload's step is `Fail/payload` (the translator's, the
shared reading), in Generate.Failure, Generate.Static.Walk and the
RT6 resolver.
2. **Amendment** to the brief's signature: `generate ∷ Tables →
Signatures → FunctionDecl → Either GenerationFault RecordedProblem`,
and `staticRules` likewise returns `Either GenerationFault`. The
earlier fallbacks (an empty callee or constructor, no effect
parameters, `Unit` for an unbound local or a payload-less clause, a
DataApplication marker for an unknown type) dropped obligations
silently; each lookup now returns `Gen = Either GenerationFault`
(Generate.Fault): `UnknownFunction`, `UnknownCtor`, `UnknownType`,
`UnknownEffect`, `UnknownBuiltinEffect`, `UnknownOperation`
(`generationProblem` gives `Internal TableLookup`), `UnboundLocal`,
`PayloadShape`, `ResultShape` (`Internal InputShape`), both kinds
that stop a run under ruling R3. The rules stay applicative: they
combine children by `<$>`, `<*>`, `traverse` and `ado`; a bind
appears only where a rule reads a child's generated result or a
table entry another names (the scrutinee's type for E12's arms, a
constructor's owner, `Γ` along a block), never a solved shape.
Check.Implied's `declared` still walks other declarations' fields
with its own `maybe []`; those ids are the tables' own, and the
owner it starts from is checked first.
3. Entries at `result` (Sig6, Sig8, Sig10) carry the written result
type's span (T-R0b §6, "the node's"): `syntax` at the parameter
count, its absence a `ResultShape` fault. No diagnostic changes:
the generator renders none. The RT6 resolver now reads that span
from the resolved syntax (`typeRefSpan`), not from the generator's
own choice.
4. The import-invariant sentence above is corrected.
Checked: test/r0-generate-faults.test.mjs (3 tests) injects each fault
by doctoring the inputs or the declaration (a callee id 99, no
constructors, no types, no effects, an effect without operations, a
local 99, a clause label with no payload, no result syntax) and checks
the `Left`, its constructor and its `Internal` kind; `staticRules`
faults on the unknown callee too. The serial corpus test now requires
`Right` on every corpus declaration (no fault taken), and the focused
generator tests pass (67). Regression runs (recorded) in a scratch
copy of output/ and test/, deleted afterwards, command `node --test
test/r0-generate-faults.test.mjs`; unpatched, none fail. F1, compiled
Expr's `localOf` answering `Right Unit` for an unbound local: fails
"an unbound local, a payload-less clause, no result syntax". F2,
compiled Lookup's `calleeOf` reading function 0's signature for any
id: fails "a missing callee, constructor, type, effect or operation"
and "the undoctored program generates Right for every declaration".
## RT1's comparison and B13 (2026-10-23)
R0 shadow tranche, Task 3.3 steps 4-5 (T-R0b §9 item 1, §11 item 2).
The generator (Task 3.2, at ae27ebb) and RT1's translator (8515ab3,
907c961, written before any Task 3.2 commit) are compared by
test/r0-rt1.serial.test.mjs over the pinned corpus, which holds the
fixtures' sources: 973 resolving programs, 2,958 declarations, 160,937
translator entries.
**Result (checked).** `node --test test/r0-rt1.serial.test.mjs`: 7
pass, no disagreement.
- `generate` is `Right` on every declaration.
- RT1 as stated: the multisets of `[list, Origin.atom, value]` agree
after recorder-spec §5.3's normalization. The normalization drops
`eq t t` unless `t` holds a record of two or more parts (a written
label beside a tail counts as two parts); on the translator's side
it drops 45,394 of 48,377 such atoms. The `vars` maps agree in full,
origins and positions included.
- Beyond the statement: the whole canonical problems agree. That
covers every origin (rule, row, span, kind), `types`, the rigid
arrays, and the raw entries before normalization. Entry lists and
`flexTy`/`flexRow` are compared sorted, since their order is
recorded, not canonical; the two sides do record entries in
different orders.
- Every rule id of T-R0b §3 occurs on both sides (entries or `vars`
origins), except Sig2, Sig9, E1, E2, E24, P1 and P2, whose rows give
no entry and no variable. Every Outside constructor occurs in some
corpus program on both sides, except LocalGeneralization (no
resolved construct produces it; exempt, ruling R11).
So the shared reading list ("RT1's translator", readings 1-21) and the
generator agree. Reading 6's conflict was resolved by Task 3.2's prep
(5bfe2c0): `HandlerHead` takes an `EffectRef`. The generator takes
the entry by name (`main`), the translator by `program.entry`; they
agree on the corpus.
**Mutants (recorded).** Each was run on a copy of output/ and the new
test modules in the session scratchpad (deleted afterwards). The copy's
test read the corpus from the worktree's git index and ran from the
worktree directory; that is harness only. Unpatched: 7 of 7 pass.
| Mutant | Patch | Failing tests |
|---|---|---|
| MG (generator) | output/Features.Check.Generate.Failure/index.js `("Fail")("payload")` → `("Fail")("value")` | RT1 multisets, vars, whole problems (first: editors/vscode/fixtures/effect-namespaces.wxw `failing`) |
| MT (translator) | test/r0-translator-records.mjs `{ spread: spreads.length + 1 }` → `spreads.length` | RT1 multisets, vars, whole problems (first: examples/records.wxw `promote`) |
**B13 settled (generation side).** T-R0b §3.4 and §11 item 2 propose
that P5-P7 give each record pattern its own equation against the
scrutinee, with no `Outside PatternGrowth`, pending RT1. Two
independent implementations agree on every record-pattern atom of the
corpus (580 P5, 1,737 P6, 419 P7; the B13 test compares them by
declaration). Neither emits a growth marker: PatternGrowth is not an
`OutsideKind`. The proposal stands as implemented. What RT1 cannot
show is whether today's growth rule (Check/PatternRow.purs:76
`growable`) accepts exactly the problems P5-P7 make valid. That is a
question about the online solver against `ValidR` (RT8 or CX), not
about generation, and it stays open there (recorder-spec Q5).
## RT2, RT4, RT9, RT10, AT13 and B9 (2026-10-23)
R0 shadow tranche, Task 3.4 (T-R0b §9 items 2, 4, 9, 10; T-R0a AT1,
AT4, AT13; T-R0b §11 item 1). The generator at 0c703e1, unchanged: no
run named a generator defect, so no generator code changed. First runs
failed only on the tests' own expectations, each corrected against the
rule text: RT4's normalization (the amendment below); RT9's E23 and
E16 spans; RT10's `bq` order (recorded, not canonical) and `main`'s
`crash` (E19 too); AT13's spans, moved when `f` preceded `g`. RT7's
determination check moved to Task 4.3 (plan re-review S2); the brief
lists no RT8 step, so none is here.
**RT2 = AT1, with AT4 (checked).** test/r0-refusal-independence.test.mjs
over test/fixtures/r0/rt2 (11 programs, T-R0b §9 item 2's minimum set:
D4 at `walk` W1, p10, c21; D6 at p11 and `submit`; b04, b03; E26's
several-tail receiver; B9's removal and rest binder; H5's depth). Each
adds, after the refusing expression, `let shown = show(1 + 2); if shown
== "3" then 1 else 2`, a later declaration and an over-applied call
(E_ARITY). Per fixture: the collecting driver's legacy slot holds the
fixture's exact diagnostic; every declaration's whole problem equals
RT1's translator's (not a prefix); the entries whose node starts after
the refused span are non-empty and the translator's; the `bq` sites are
exactly the fixture's (`pr`/`cmp`, by covered text, origin body),
including those before the refusal that today's end-of-body walks never
reach (`n == 0` in `walk`); the later declaration has its problem; the
static one has `StaticArity` and its problem. `node --test
test/r0-refusal-independence.test.mjs`: 25 pass.
Two findings from building the set (checked, the fixtures pin both):
- `submit` (requirements.md §7, "predicted D6") is refused today by D4,
not rule H: `Cannot tell how file's u, t and q split { ...r }; no
annotation can decide u, t and q, which belong to this call of file`.
- E26's `Placeholder` at a several-tail receiver (Record.purs:160, cited
by T-R0c §3.6) is unreachable: no compiled module constructs
`UnifyFailure.Placeholder` (`grep -rn "UnifyFailure.Placeholder"
output/*/index.js | grep -v instanceof` prints nothing; only its own
module's `create`). A field access at a receiver of two flexible
tails is refused by D4 instead (`Cannot tell whether ext's s or t has
field a; annotate this lambda's parameters`), and that program is the
E26 fixture.
The corpus is re-pinned (11 added, 1,128 programs), and the 11 outcomes
are appended to test/fixtures/r0/first-diagnostic.json under
`extended` (computed by `compile` at 0c703e1, src/ unchanged); no
existing entry changed. They are confirmed at the snapshot's baseline
too (fix round 1; `confirmed: "5d6b1cb"`), since src/ changed between
5d6b1cb and 0c703e1 (88 files): a detached worktree at 5d6b1cb, built
by `node scripts/build.mjs` only, compiled the 11 programs (sources
from the corpus loader) with its own `compile` and `wire`, and a
script compared each outcome's JSON with the snapshot's: `11 of 11
byte-equal`. The worktree was removed afterwards.
`node --test --test-concurrency=1` over the five
corpus-wide suites: 23 pass (RT1 included, so RT1 covers the fixtures).
**B9 settled (generation side; checked).** RT1 (corpus-wide, now with
both B9 fixtures) and RT2 agree on E28 and P7 over several tails: each
records `eq { a: Int, ...r, ...s } { a: ⟨field a⟩, ...⟨rest⟩ }` with no
marker, where today's checker stops at its R005B placeholder
(`withinOneTail`). As with B13, what generation cannot show is the
verdict side: B9's reason (`Unsupported (GuardOutsideFragment …)` while
no guard covers several tails) is decision's (Task 4.x).
**RT4 (checked; one labelled amendment).** test/r0-hand.test.mjs:
translation.md §5's 44 example files. Nine write a second spread or a
two-tail annotation without a clause and are refused at Resolve, so
they have no problem (T-R0b §8; S1 and the body-type move are not
implemented); the test pins each refusal. For the other 35, one
declaration's `D` and `B` equal the hand translation after eliminating
defining equations on both sides, as sets, up to a bijective renaming
of flexible variables (test/r0-hand-support.mjs and
test/r0-hand-match.mjs state the rules). Hand translations: §5.1's,
quoted (§17's from sig-oracle/source-boundary.mjs where a row cites
§17); for §5.2, which gives none, written here by §2.3's rules and
labelled so in the test (n02 is §17's `missingField`). `BQ`, `adm` and
`split` are outside §5's notation. 46 pass, including a control that
wrong translations and renamings fail.
Amendment, after the first run: p14 and p15 failed because elimination
was order-dependent (the generator's Sig3 atom bound the rest row first,
leaving `{ a: Int, ...r } = { a: β, ...r }`). A rule was added: two
records of the same labels and tails equal field by field (cancellative
composition), keeping the record's definedness. Then 46 pass. No hand
translation was changed to fit.
**RT9 (checked).** test/r0-markers.test.mjs: one fixture per `Outside`
constructor (HandlerType and FailFamily once per rule), each beside
`1 + true`; the marker is in `outside` with its rule, kind and node span,
and `eq Bool Int` (E7) is in `b`, which today's checker also refuses.
LocalGeneralization has no construct (R11). E17 and E20 at `State(s)`:
`inst 0` is in `vars`, type, exists, `Slot` at the node. The verdict
half (no Solved; Contradiction still found) waits for Tasks 4.1 and
5.1. E23's span is `Fail.fail(1`: Resolve spans `fail` through the
payload's end on purpose (Qualified.purs:154).
**RT10 (checked; two points for the author).** test/r0-origin-kinds.test.mjs:
the review's probes kept no files, so h1-h4, cmp-c, cmp-cf, pr-c,
pr-cf, eq-c, eq-d and `peek` (pk-crash-c) are rebuilt from its text,
and each meets today's checker as recorded (phase and text). Every `bq`
atom has T-R0b §6's kind (E10/E19 body, Sig10 contract), every `q` is
empty, and `divide`'s problem is the same under each written split.
- recorder-spec T10 expects `divide`'s `peek` site with origin
contract; T-R0b §6 makes E19 body and §3.1's Sig9 leaves `Q` empty
[VOR]. The test follows T-R0b.
- RT10's "cmp-c and cmp-cf record the same atom" holds for the origin
(same AtomId and rule), not the value: by E13, E2 and E10 the operand
is the lambda's written annotation, `{ c: Int }` against `{ c: Int, f:
Int -> Int }`, and the pair writes the split exactly there. The
statement (recorder-spec T8b: the atom mentions a flexible variable)
fits only an unannotated lambda (cmp-open). Decided here by the rule
text; the test pins both values.
**AT13 (checked).** test/r0-independence.test.mjs: four pairs change
only `f`'s body (no calls; a call to `g`, so `f` and `g` form one
recursive component; a body today's checker refuses; a call to a callee
`g` also calls). `g`'s canonical problem bytes and static refusals are
equal in each pair, and `g` keeps its two `adm` sites; a control that
changes `g` changes them. The verdict half waits for decision.
**Mutants (recorded).** Each was applied to a copy of output/ in the
session scratchpad (with test/, the examples and the corpus module;
deleted afterwards) and run with the five new test files; unpatched, 101
pass.
| Mutant | Patch (compiled module) | Failing |
|---|---|---|
| M1 prefix | Generate.Control: `concatOut(Data_Array.snoc(outs)($$final.out))` → `concatOut(outs.slice(0, 1))` | 30: every RT2 test, RT4 p09 and c23, the RT9 fixtures |
| M2 `cmp` not in BQ | Generate.Operator: `ToBQ(new …Comparable(` → `ToB(…` | 32: RT10 h3, h4, cmp-c, cmp-cf, eq-c, eq-d and the split pair; every RT2 test |
| M3 no implied callee clauses | Generate.Signature: `implied: append(` → `implied: [], unusedImplied: append(` | 16: RT4 p10, p11, p12, p19, c21, n04, n09, n13 and the control; seven RT2 |
| M4 Deferred's kind | Generate.Control: `ToOutside(…Deferred.value)` → `FailFamily` | RT9 Deferred |
| M5 E19 origin contract | Generate.Builtin: the E19 `Body.value` → `Contract.value` | 16: RT10 h1, h2, pr-c, pr-cf, peek; every RT2 first test |
| M6 reads a body | Generate.Inputs: `parameters` empty when the body is a `Block` | AT13 (the first pair), RT4 n10, RT2 walk |
## Rules and the projection (2026-10-23)
R0 shadow tranche, Task 5.1 (T-R0a §5, §5.1, §5.2, AT5, AT6; CX
refute/statements.md §4.1 conditions 1-5, §5's C1-P, C1-M, C1-D and
X7). New: Features.Check.Refute.Sig (`SigProblem`), Refute.Project
(`toSig`, `withBody`), Refute.Rules (`checkDerivation`, the empty
`registry`, `RefuterSpec`, `Refuter`, `trustedRefuter`),
Refute.Rules.Internal (`SoundRule`'s constructor), Refute.Theorems (the
empty `theorems`), Domain.Verdict.Theorem.Internal (`TheoremRef`'s
constructor) and Domain.Verdict.Unsound. Nothing reachable from
compile calls any of them: Program.Main now reaches the two new Domain
modules as types only (test/r0-verdict.test.mjs lists them).
**Readings (labelled; the rulings in the SDD ledger decide the rest).**
1. `TheoremRef`'s constructor is in Domain.Verdict.Theorem.Internal
(Task 1.1's ruling). Refute.Theorems imports and re-exports the type
alone, so a test mints a `TheoremRef` through the Domain module's
compiled JS, not through Theorems as the brief says. Rules imports
the type from Theorems, without `(..)`, which the source scan checks.
2. `SoundRule` (ruling R7) and `TheoremRef` are `data`, not T-R0a's
newtype: no `coerce` reaches them, and the compiled form keeps a
constructor for tests to mint through (test/r0-stubs.mjs).
3. `Unsound` has five constructors: `Unregistered`, `Unprojectable`,
`DAtomPremise AtomId`, `NotOriginal AtomId`, `RuleDeclines`. The rule
is not repeated: `DerivationRefused RuleName Unsound` carries it.
4. `Budget` (T-R0a §4.3), needed by `RefuterSpec`'s search, is an
uninhabited type in Domain.Verdict.Open until Task 4.1 defines it.
5. `Refuter` is opaque; `refuterParts` gives its name, theorem, the
spec's untouched search and `confirm`, the spec's check with an
accepted CX wrapped as `Refuted`. A search's `Nothing` is not read
here as `NoCounterInstance Exhausted`: the spec's `Maybe` cannot
tell exhaustion from a spent budget, so `decide` (Task 4.1) owns it.
6. Condition 1: names stay the recorded `Var`s, so the map is injective
trivially; a generalized `app` occurrence is `Generalized n`, a name
no recorded variable has. As in Lean, a variable not in the rigid
lists is flexible.
7. Condition 3: the only body atoms outside `TExpr` are `bq`'s. Every
`b` atom is in Lean's atom language once its `app` occurrences are
generalized, so `toSig` keeps every `b` atom with its id.
8. Condition 2 covers `q` as well as `D`: a non-empty `q` leaves
`toSig` undefined (requirement atoms in `D`).
9. `AtomId` is not unique ("RT1's translator", item 3), so a premise
names every `B` atom that carries it, and `withBody` keeps them all
(a sublist of `B`, so C1-M still applies). A premise found among
`D`'s ids is refused first; that never refuses a `B` atom, since no
corpus `D` id is a `B` id (checked below).
10. `checkDerivation` checks, in order, that the rule is in the
injected set, that `toSig` is defined, that each premise is an
original `B` atom, and that the rule fires again on `withBody (toSig
P) premises`. The evidence is the submitted derivation; what the
re-run derives is not compared with it.
11. AT6's "applied to a `D`-subset": a derivation found on a sub-`D`
(the rule fires there), which the re-run on the whole `D` refuses.
12. T-R0a's AT5 fixtures (`routeUndeclared`, `markNoClause`) are CX
certificates, ground (2), Task 5.2's. Here AT5 covers ground (1).
**Checked.** test/r0-rules.test.mjs (12 tests): `toSig` keeps `D` and
`B` ids in order, the rigid lists, and drops `bq`; `Box(Int) =
Box(Int)` becomes two distinct generalized variables (bounded: valid);
an `app` in `D` or a non-empty `q` gives no projection and
`Unprojectable`. AT5: a test-only head-clash rule (C1-H's shape, not
claimed sound), registered through the stub, gives `ByRule` evidence
on `fn f(): Int = true`, on the same with `where r lacks { a }` and on
`x + true`: every premise is a `B` id and no `D` id, `withBody` keeps
the whole `D`, and research/composition-assessment/sig-oracle/
bounded.mjs (default bounds) finds the premises' problem `invalid`.
AT6: an unregistered rule (empty `registry`, or another rule's name);
a premise at a non-existent index, of another declaration, or of a
`bq` atom (`NotOriginal`); a `D` premise (`DAtomPremise`); a
composition rule run with `D` dropped fires on `{ a: 1, ...p }` under
`r lacks { a }`, and the re-run on the whole `D` refuses it
(`RuleDeclines`): bounded finds the problem without `D` `invalid` and
with it `valid`, X7's lesson on a source program. A non-clashing
premise beside a clash is refused (the re-run reads the premises
only). `registry` and `theorems` are empty. `trustedRefuter` wraps only
what the check accepts and passes a refusal through.
test/r0-project.serial.test.mjs: over the pinned corpus (984 programs
that resolve, 3,011 problems) `toSig` is defined on every problem,
keeps every `D` and `B` id in order, and no `D` id is a `B` id.
Stack: the first `toSig` recursed along arrow spines. A probe
(`fn f(k: (Int, …, Int) -> Int): … = k`, n parameters, scratchpad
script) printed `1000 ok`, then `5000 toSig threw RangeError: Maximum
call stack size exceeded` and the same at 20,000. Spines are now
walked by a loop (as Domain.Type.Core's `stagesThrough`); the same
probe prints `ok` with spine depth 1000, 5000 and 20000, and a test
pins 20,000.
Structure (test/structure.test.mjs, test/structure-r0.test.mjs): a
module other than Refute.Rules importing Refute.Theorems is a graph
finding; the import scan flags an open import, `as` without a list,
`hiding`, `TheoremRef(..)` and `TheoremRef (TheoremRef)` on a
continuation line, and passes Rules' real import; each new Internal
module's graph, compiled-import and re-export rules, both directions.
purs 0.15.16 probes (a copy-on-write copy of src, .spago and output in
the scratchpad, one probe module at a time, deleted afterwards):
| Probe | Result |
|---|---|
| `TheoremRef "x"` with `Domain.Verdict (TheoremRef)` | does not compile: `Unknown data constructor TheoremRef` |
| the same through `Refute.Theorems (TheoremRef(..))` | does not compile: `Unknown data constructor TheoremRef` |
| `SoundRule {…}` through `Refute.Rules (SoundRule(..))` | does not compile: `Unknown data constructor SoundRule` |
| `Refuter parts` through `Refute.Rules (Refuter(..))` | does not compile: `Unknown data constructor Refuter` |
| `coerce ∷ String → TheoremRef` (Safe.Coerce) | does not compile: no `Coercible` instance |
| `Domain.Verdict.Theorem.Internal (TheoremRef(..))` in Features.Check.Probe | compiles; findings: `imports Domain.Verdict.Theorem.Internal` and its compiled JS imports it |
| `Refute.Rules.Internal (SoundRule(..))` in Features.Check.Probe | compiles; the same two findings |
| `Refute.Theorems (theorems)` in Features.Check.Probe | compiles; finding `imports Features.Check.Refute.Theorems` |
| Rules importing `Refute.Theorems (TheoremRef(..))` | compiles (Theorems exports no constructor); the scan's finding |
**Mutants (recorded).** Each patched a copy of output/ (with test/ and
the sig-oracle) in the scratchpad, deleted afterwards; unpatched, the
11 tests of r0-rules then present pass.
| Mutant | Patch (compiled module) | Failing |
|---|---|---|
| M1 D premise | Rules: `var $37 = any(cites)(sig.d);` → `var $37 = false;` | AT6 D atom |
| M2 sub-`D` | Project: `withBody`'s `d: problem.d,` → `d: [],` | AT5; AT6 D-subset |
| M3 shared variable | Project: `accum: next + 1 \| 0` → `accum: next` | app occurrences |
| M4 whole body | Rules: `rerun(rule)(…withBody(sig)(derivation.premises))` → `rerun(rule)(sig)` | re-run on premises |
| M5 `q` ignored | Project: `null(view.q)` → `true` | toSig undefined |
Regression row `r0-d-premise` (scripts/regression-r0.mjs, probe in
test/regression-r0.mjs): premises read from `D` as well as `B`. `node
scripts/regression.mjs r0-d-premise`: "fixed compiler passes; restored
defect fails", the probe printing `D atom accepted as a premise:
Right`.
RED runs: before Project, Rules and Theorems existed and before the
structure rules, `node --test` over the four touched test files gave
6 pass, 4 fail (r0-rules and r0-verdict: no
Domain.Verdict.Theorem.Internal output; structure-r0: Rules allowed to
import it; structure: no `theoremImportFindings`).
## Strategies and `decide` (2026-10-23)
R0 shadow tranche, Task 4.1 with Task 3.6 (T-R0a §4.1, §4.3, §5.1,
§5.3; AT7, AT8, AT9, AT11, AT12, AT16, AT17; T-R0b RT3). New:
Domain.Verdict.Search (`Budget`, `SearchHint`, `CheckRefusal`),
Features.Check.Strategy (`StrategySpec`, `Strategy`, `strategy`),
Features.Check.Decide (`Checking`, `decide`, `untilVerdict`),
Decide.Reason (rules 1, 1′, 3) and Decide.Refuters (seeding,
`shadowRefuter`). Changed: Domain.Verdict (`NoWitnessReason =
NonConstructive StrategyName`, moved from Open; `Eq` for `StrategyName`
and `Unsupport`), Domain.Verdict.Open (four placeholders moved out; `Eq
Question`), Refute.Rules (`ruleName`, `ruleDerivation`). Nothing
reachable from compile builds a `Checking` (ruling R6): Program.Main
reaches Domain.Verdict.Search as types only and no Strategy or Decide
module (test/r0-verdict.test.mjs).
**Readings (labelled; the SDD ledger's rulings decide the rest).**
1. `Checking` has T-R0a's five fields and two injected implementations:
`openRequirements`, §3.2(a)'s detector (Task 4.2's; a stub until it
lands, ruling R11), and `ends ∷ Progress → Boolean`, when the run
stops early. Production's is `untilVerdict`; rule 5's test-only
value never ends early. That is the "different injected value" of
rule 5 (ruling R7), not a flag.
2. A strategy's run gives `Ran = { attempt, hints, solution }`, not
T-R0a's bare `Attempt`: rule 2 seeds refuters with the hints, and
Solved carries the strategy's assurance.
3. `Search` gains `Inconsistent String` (ruling R10 (iii)): the state a
search reads beside the problem (its injected context) disagrees
with it, which stops the run as `BrokenInvariant`. A search's own
broken invariant is `NoCandidate (Broke …)`, a `SearchBroke` record
that never stops the run (G-Q13, dossier §18.71 item 2). Task 4.3
routes `InternalKind` by ruling R3's partition: the confined kinds
to `Broke`, the stop kinds and `GenerationFault` to `Inconsistent`.
4. Zero fuel: once the guard admits, `strategy` does not call a search
given `fuel ≤ 0`; the attempt is `Searched (OutOfBudget
(StrategyBudget name))`.
5. A refuter search's `Nothing` is `NoCounterInstance Exhausted` (the
choice Task 5.1 left here): a `Maybe` cannot tell exhaustion from a
spent budget, so a refuter never contributes `Limit` to rule 3.
6. Seeding: each refuter (and shadow) searches once with no hint and
once with each hint alone, in canonical order (sorted, duplicates
removed), each on the whole budget; the first counter-instance its
check accepts wins, else the first refusal is reported. Adding a
hint adds a run and removes none, so the search is monotone in its
hints whatever it does with several.
7. Blame (carry from Task 5.1's review): `decide` derives a
derivation's `blame` from its premises' paths, whatever the rule
wrote, rather than refusing a foreign blame site. The premises are
what `checkDerivation` checked, so the culprit named is the
evidence; no `Unsound` constructor or trusted check changes.
8. Stopping: production stops at the first Solved or contradiction
(rules first), unless rule 1 or 1′ blocks Solved, when every rule,
strategy and refuter runs; an `Accepted` beside a contradiction is
then `BothVerdicts` (rule 4 in production). Shadows always run, after
the rest, seeded with the hints gathered.
9. Rule 3: a `RequirementOpen` refusal reads as a decline
(`RequirementAtoms`) and so never as a refused `ClaimsComplete`
candidate; "every strategy declined" counts strategy attempts only;
with no strategy at all the reason is `Inference NoStrategyApplies`
(T-R0a §3.5 glosses it "every guard declined", which rule 3 gives
to `Unsupported`; rule 3 is followed). A budget limit has no node,
so its site is the body's root. `Unsupported` lists each reason
once.
10. Ruling R10 (ii), an orchestration invariant: `checkDerivation`
finds a rule by name, so two rules of one name in `Checking.rules`
stop the run as `BrokenInvariant`.
11. `CheckRefusal = RequirementOpen AtomId | Unsatisfied AtomId`; Task
4.2 adds G0's own. `SearchHint = SearchHint String`, ordered (T-R0a
§3.5's advisory text). `Budget = { fuel, depth, keys }` (§4.3).
12. No `StrategyName` constructor was added: every stub is
`OnlineSolver`, and no test needed two names.
13. RT3 is test/r0-injection.serial.test.mjs (corpus-wide, ruling R11).
Task 4.3's `onlineSearch` does not exist yet, so "the online search"
is today's per-declaration search, `checkProgram`'s `recheck`.
14. No `ErasedRow` marker and no `EffectsUnchecked` reason: the
2026-10-23 ruling defers them to the task that builds the marker
(docs/plans/r0-erased-rows.md §7.1); `decide`'s comment says so.
**Checked.** test/r0-decide.test.mjs (17 tests), r0-decide-faults (6)
and r0-order (4), all through the production `decide` with stubs from
test/r0-stubs.mjs, which mints `Valid`, `TheoremRef` and `SoundRule`
through the compiled Internal modules. AT8: a refused `Heuristic`
candidate is `Unresolved (Inference NoAcceptedCertificate)` with no
`SearchFault`; a refused `ClaimsComplete` one, then an accepting stub,
is Solved with both attempts and a `CandidateRefused`; alone, the same
Unresolved, never Faulted; `DerivationRefused` and `BrokenInvariant`
are `Left`. AT9: `NoWitness (NonConstructive OnlineSolver)` is Solved.
AT11: the `DataApplication` fixture with an accepting stub is
`Unsupported [Outside DataApplication]`; with a trusted stub refuter,
Contradiction. AT12: fuel 0 gives `Limit [StrategyBudget]`, the search
is not called and `encodeProblem` is unchanged. Rule 3's two ordering
probes; rule 4's `BothVerdicts` under a marker by refuter and by
registered rule; rule 5's only through `ends`; AT17 for Solved,
Unresolved and no strategy; `RequirementOpen` as `Unsupported
[RequirementAtoms]`; an injected open atom and a second spread (a test
`vars` key, since Resolve refuses one) each block two accepting stubs,
both run; a decline is local; blame is the premises' paths; seeds are
`[]`, `['a']`, `['b']` for hints `b, a, a`. G-Q13 without "proposed",
and the three stops of ruling R10. AT16: each `InferenceFailure`,
reason family, the `Unsupport`s rule 1 and guards give, both `Limit`
kinds, each `InternalFault` and each `SearchFault` by one injection.
test/r0-injection.serial.test.mjs (RT3): over the pinned corpus (more
than 900 programs and 2,500 declarations, the test's floors) each
declaration's `encodeProblem` is the same alone, after `checkProgram`
on the program and after `decide` with a stub refusing at once; and the
compiled import closure of Features.Check.Generate holds no Strategy,
Decide or Refute module.
AT7. The grammar is in test/r0-order.test.mjs, fixed before the first
run. First run, `node --test test/r0-order.test.mjs`: two properties
failed, `AssertionError: {"Solved":13,"Contradiction":76,
"Unresolved":195,"Faulted":116}` and `a refused candidate never gives
Faulted: world 1`. Cause: the generator called each rule kind with the
random source as its index, so every rule was named alike and the
distinct-names invariant stopped the run; the grammar says "named
apart". Correction to the generator, not an amendment of the grammar:
rule kinds take `(next, index)`. Second run: 4 pass. A scratch copy
printing its counters gave classes Solved 25, Contradiction 96,
Unresolved 279 (400 worlds), 169 worlds with a refused candidate, and
25 monotonicity worlds where seeding with the whole hint set would
lose the counter-instance.
**Mutants (recorded).** Each patched one compiled module in a scratch
copy of output/ and test/ (deleted afterwards), running r0-order,
r0-decide and r0-decide-faults; unpatched, all pass.
| Mutant | Patch (compiled module) | Failing |
|---|---|---|
| M1 whole-set seeding | Refuters: `var seeds = …cons([])(…)` → `var seeds = [canonical(hints)];` | monotone in hints; seeds |
| M2 hints unsorted | Refuters: `return sort(nub(hints));` → `return hints;` | seeds |
| M3 block ignored for running | Decide: `!progress.blocked && (…)` → `(…)` | incomplete problem; rule 1′; rule 4; AT16 |
| M4 rule's own blame | Decide: `blame: nub1(map1(…))` → `blame: v.value0.blame` | blame |
| M5 `RequirementOpen` as refusal | Reason: `new Declines(RequirementAtoms)` → `claimed(claim)` | RequirementOpen |
| M6 zero fuel searches | Strategy: `if (budget.fuel <= 0)` → `if (false)` | AT12; AT16 |
M2 leaves AT7 green: with per-hint seeding the order of the seeds
cannot change whether a counter-instance is found.
Regression rows (scripts/regression-r0.mjs; probes in
test/regression-r0.mjs): `r0-refused-stops` (a refusal becomes
`BrokenInvariant`; AT8's probe expects Solved), `r0-limit-hidden` (any
refusal outranks `Limit`; the `Heuristic` probe expects `Limit`),
`r0-marker-ignored` (rule 1 reads no marker; AT11's probe expects no
Solved), `r0-shadow-decides` (a shadow's checked CX turns the verdict
Unresolved; AT17's probe expects Solved). `node scripts/regression.mjs
r0-refused-stops r0-limit-hidden r0-marker-ignored r0-shadow-decides`:
each "fixed compiler passes; restored defect fails".
purs 0.15.16 probes (a copy-on-write copy of src, .spago and output in
the scratchpad, deleted afterwards):
| Probe | Result |
|---|---|
| `Strategy` through `Features.Check.Strategy (Strategy(..))` | does not compile: `Unknown data constructor Strategy` |
| `ShadowRefuter` through `Decide.Refuters (ShadowRefuter(..))` | does not compile: `Unknown data constructor ShadowRefuter` |
| `coerce` from a run function to `Strategy` | does not compile: no `Coercible` instance |
| `Valid` through `Domain.Verdict (Valid(..))` | does not compile: `Unknown data constructor Valid` |
| `strategy` and `shadowRefuter` (control) | compiles |
Trusted surface re-pinned: Domain.Verdict adds `NoWitnessReason(..)`
(source), `NonConstructive`, `eqStrategyName`, `eqUnsupport` (compiled);
Refute.Rules adds `ruleDerivation` and `ruleName` (both). None names a
token constructor; `ruleDerivation` returns a plain `Derivation`, which
is evidence only through `checkDerivation`.
RED: before Domain.Verdict.Search, Strategy and Decide existed, `node
--test test/r0-decide.test.mjs test/r0-decide-faults.test.mjs
test/r0-order.test.mjs` failed all three files with
`ERR_MODULE_NOT_FOUND` for output/Domain.Verdict.Search.
## G0, `entailedGround` and the two detectors (2026-10-23)
Task 4.2. Labels as above: **checked** (a run recorded here or in a
test), **cited**, **argued**, **reading** (a choice the brief or
rulings leave open, listed for review).
**Modules.** G0's check is `checkSubstitution`
(Features.Check.Strategy.Substitution, trusted, the only Strategy*
importer of Domain.Verdict.Internal), over Strategy.Candidate (the
`Substitution` type, `generic`, `under`), Strategy.Atoms (`B` atoms
against `D`) and Strategy.Asked (`BQ` atoms by the ground rule).
`g0Guard` is Strategy.Guard. §3.2(a)'s `openRequirements` is
Decide.Open and imports no Strategy* (ruling R11). The ground rule is
Features.Check.GroundRule, three-valued (`Holds`, `Unjudged`, `Open`,
`Fails`; a conjunction keeps the later). Reduction through entailed
equalities is Features.Check.Entailed with Entailed.Mgu and
Entailed.Merge, per docs/plans/r0-entailed-ground.md (reviewed,
"sound with corrections"; corrections in f0146ce before the
implementation). Decide/Reason.purs's classifiers moved to
Decide/Reading.purs, each naming every `Reading` constructor (the
Task 4.1 review carry; `byStrategy` had defaulted to `true`).
**Readings and amendments.**
1. *Amendment to the brief's location (controller ruling Q1):*
`entailedGround` is in src/Features/Check/Entailed.purs, not
Strategy/Entailed.purs, so §3.2(a)'s detector can read it.
2. *The holder set: K-a (author, 2026-10-23), replacing this task's
first K-b reading.* The first implementation injected the holder
set (`Functional`) as a first argument of `checkSubstitution`,
`g0Guard` and `openRequirements` (r0-validr-draft.md §3.5's K-b).
The author ruled K-a in fix round 2: the recorded problem carries
it, as `holders ∷ Holders = { declared, holding }`
(Domain.Recorded.Atom), read through `fields`; construction stays
Generate*-only (R4), `Eq` covers it, the canonical form encodes it
(`holders`, ascending ids), and the three consumers read the
problem's own set and take no injected one.
- *Obligation (source to problem):* storing the set stops a caller
from swapping it, not the generator from computing a wrong one.
Generation must record the program's complete set: every declared
type, and every one whose constructors hold a function directly
or through another declared type, a record field or a type
argument (Features.Check.Functional, today's set). Checked by
test/r0-holders.test.mjs (direct, through another type, a
parameterized holder, its application, a recursive holder, a
recursive non-holder, a record field, a phantom parameter) and by
RT1: test/r0-translator-holders.mjs computes the set apart, by
rounds to a fixed point over the constructors, and RT1's
whole-problem comparison agrees on the corpus. Independence is of
algorithm only: one implementer wrote both, after reading
Functional.purs.
- *Coverage:* the set is the program's complete one, not the heads
the atoms mention, so a head a candidate introduces is judged from
it (σ binding `y` of `pr y` to a holder gives `RequirementOpen`,
§3.2(a) and the brief; to an arrow, or to `T(Int → Int)` with a
phantom parameter, `RequirementFails`). A head outside `declared`
is `Unjudged` (`RequirementUnjudged`), never printable: missing
metadata is no evidence.
3. *Controller reading, pending the author's G-ValidR ruling (Q2):*
no recorded atom names a fresh base. The open set before G-ValidR
is a declared type whose constructors hold a function (wherever the
ground rule meets it before a definite failure) and `cmp` at a
rigid variable (κ policy, F-a…F-d, open); `pr` at a rigid variable
is settled by Pr-1 and is G0's guard decline, §3.2(b). Pinned:
`cmp` at a rigid row is open (r0-g0.test.mjs, disjointness test),
`pr` at a rigid variable declines (AT19 third case, `a G0 limit is
local to G0`), a holder type is open (`G0 leaves open atoms`).
4. *G0's refusals* (Domain.Verdict.Search): `Undefined`, `NotEntailed`,
`RequirementFails`, `RequirementUnjudged`, `NotGeneric` beside
`Unsatisfied` and `RequirementOpen`. Rule 3 reads `RequirementOpen`
as a decline and every other as a refused candidate, so a
`ClaimsComplete` one is a `CandidateRefused` fault (checked: each
constructor injected, r0-g0-check.test.mjs). A failing ground
judgement under σ is `RequirementFails`, never Contradiction (AT19).
5. *What D entails (argued):* `D` holds only `Lacks` and `Disjoint` on
rigid rows, so G0 treats as entailed exactly the listed facts; a
tail σ leaves unbound has none.
6. *d02's problem (argued):* d02 is refused at Resolve today, so its
problem is generated from the same program with `where r lacks
{ a }` and that clause's one `D` atom (Sig4) removed; the test
checks the clause adds only that atom.
7. *Unifier variables:* R5's fresh rows are `FreshVar` at the path
`[Named "entailed", Index n]`, skipping any the problem names.
8. *AmbiguousType (f02) now:* `cmp` at a flexible variable the
candidate leaves unbound is `Unjudged`, so the `RequirementUnjudged`
backstop, as the earlier finding predicted; not tested here (Task
4.3 has the real candidate).
**Evidence.**
- RED (checked): with `reduction` and `entailedGround` stubbed (always
`OutsideFragment`, `Nothing`) and Entailed/ moved aside, `node --test
test/r0-entailed.test.mjs test/r0-g0.test.mjs
test/r0-g0-check.test.mjs` gave 15 failures, 8 passes: every hand
row, the several-tails test, the structural test (files missing),
AT19's first two cases, `G0 leaves open atoms`, definedness. GREEN:
23 of 23.
- EG-oracle (checked, test/r0-entailed-oracle.serial.test.mjs, grammar
G-EG as fixed in the note before the run): 10,100 problems, 750
`Just` answers, 718 non-vacuous, no counterexample. `agreeing`, the
in-fragment `Nothing` answers whose solutions all agree (reported,
not asserted): 229, each a bound artefact on the cases inspected,
e.g. `x = Int → y` forces `y = Int` only because the domain's one
arrow value is `Int → Int`.
- Hand list (checked, r0-entailed.test.mjs): each R5 row and R4 gives
its exact non-vacuous `Just`; both cycles terminate with `Nothing`;
several tails give `Nothing` except an already-ground atom; the
guard fixture `{...r} = {...q}` declines.
- Mutants (checked; each patch applied to Entailed/Mgu.purs in place,
built, then `node --test test/r0-entailed.test.mjs
test/r0-entailed-oracle.serial.test.mjs`, file restored):
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 R2 swap | `[ Tuple left right', Tuple right left' ]` | EG-oracle |
| M2 none-row wrong side | `closed onlyLeft` → `closed onlyRight` | EG-oracle; hand "none, ρ′" |
| M3 one-side row wrong side | `binding tail' (Record onlyLeft.fields …)` → `onlyRight.fields` | hand "A ≠ ∅ = B" |
| M4 fresh row swapped | `onlyRight`/`onlyLeft` exchanged in the two bindings | hand "fresh ρ″" |
| M5 rigid bound | `\| not (isRigid tail) → binding tail …` → `\| true → binding tail' (Record [] [ tail ])` | guard fixture |
- `main`'s printability (checked, r0-g0-entry.serial.test.mjs): over
the pinned corpus, Sig10's atom judged by the ground rule agrees
with `printableEntry` (through `checkProgram`'s `entry`) on 984
programs; 144 do not reach generation; none has a holder-type
`main` (the fixture test covers that case).
- Regression rows (checked): `r0-definedness-dropped` (the equation's
definedness guard deleted; d02's probe expects `Undefined`) and
`r0-g0-limit-global` (`pr` at a rigid variable joins the open set,
so rule 1 blocks on G0's limit; the probe expects the stub's
Solved). `node scripts/regression.mjs r0-definedness-dropped
r0-g0-limit-global`: each "fixed compiler passes; restored defect
fails".
- purs 0.15.16 probes (scratch copy of output, deleted): `Valid`
through `Domain.Verdict (Valid(..))` does not compile (`Unknown data
constructor Valid`); `GroundType` through `Features.Check.Entailed
(GroundType(..))` does not compile (`Unknown data constructor
GroundType`); `checkSubstitution` and `genericSubstitutionSound`
used from outside compile.
- Fix round 1 (task review I-2; checked). Every earlier candidate was
the problem's own unifier, so four arms of `checkSubstitution` were
never driven. test/r0-g0-atoms.test.mjs drives each with a candidate
that is not, beside a positive control: unequal sides
(`Unsatisfied`), `lacks` and `disjoint` that `D` does not list
(`NotEntailed`, and `Right` once it does), a rigid binding, a row
bound to a non-record and a non-idempotent σ (`NotGeneric`), and
`ff`. Mutants patched into the compiled output of a scratch copy
(output, test, src and d02 copied; deleted afterwards), each run with
`node --test test/r0-g0-atoms.test.mjs test/r0-g0.test.mjs
test/r0-g0-check.test.mjs test/r0-entailed.test.mjs` (28 tests):
| Mutant (compiled JS) | Failing tests |
|---|---|
| (a) Atoms `equal`'s `Left (Unsatisfied id)` → `Right unit` | an equation whose sides σ makes unequal is Unsatisfied |
| (b) both `NotEntailed` arms → `Right unit` | the lacks and the disjoint tests |
| (b1) `lacking`'s arm only | a lacks atom D does not list is NotEntailed; one it lists holds |
| (b2) `apart`'s arm only | a disjoint atom D does not entail is NotEntailed; one it does holds |
| (c) Substitution's `generic` test → `false` | a candidate that is not generic is NotGeneric |
| (d) `Ff`'s `Left (Unsatisfied …)` → `Right unit` | an ff atom is Unsatisfied under any candidate |
- Fix round 2 (K-a; checked). The same scratch-copy method, with
test/r0-holders.test.mjs added to the run (31 tests). The I-2
mutants (a), (b1), (b2), (c), (d) each still fail their test. New:
| Mutant (compiled JS) | Failing tests |
|---|---|
| (h1) GroundRule's holder lookup → never `Open` | G0 leaves open atoms to §3.2(a); a holder a candidate introduces is judged from the problem's set; the ground rule, every constructor |
| (h2) GroundRule's undeclared-head arm removed | a head the program does not declare is never printable |
| (h3) generation records `holding: empty` | G0 leaves open atoms; a holder a candidate introduces…; generation records the program's complete holder set |
Trusted surface re-pinned: Features.Check.Strategy.Substitution is new,
exporting `checkSubstitution` and `genericSubstitutionSound` (source and
compiled); neither names a token constructor. Nothing reachable from
compile changed; no fixture changed; no corpus re-pin (no tracked .wxw,
fixture source or docs waxwing block added).
## The census (2026-10-23)
Task 3.5; the counts and their reading are docs/plans/r0-census.md,
pinned in test/fixtures/r0/census.json. Labels as above.
**Method (checked).** test/r0-census-classify.mjs classifies each
pinned corpus program: `compile` for the program, the collecting
driver's `today` slot per declaration, the generated problem, and the
detectors as landed (`outside`, a `spread j ≥ 2` variable,
`openRequirements`, `g0Guard`) plus Task 3.5's test-only erased-row
detector (test/r0-census-erased.mjs over an explicit walk of resolved
syntax, test/r0-census-walk.mjs; ruling R11). test/r0-census-tally.mjs
counts; scripts/r0-census-pin.mjs writes census.json;
test/r0-census.serial.test.mjs asserts it (about 55 s).
**Readings.**
1. *Declarations that compile today* are those whose body checks
(`today` is `Right`), in any resolving program; a category's
programs are only those `compile` accepts. 2,773 declarations are
counted, 2,397 of them in accepted programs.
2. *The marginal order* is fixed: SecondSpread, the seven `outside`
kinds in Domain.Recorded.Atom's order, BQPendingValidR, ErasedRow,
BQAtTypeVariable. Decided blocks come first and §3.2(b) last,
since only (b) can be lifted by a strategy. The marginals sum to
the union (251).
3. *BQAtTypeVariable is `g0Guard`'s decline*, so it also holds an atom
outside the one-tail fragment that is not ground. The census splits
the two: among compiling declarations, 3 rigid and 0 fragment; the
one fragment decline in the corpus (f03-compare-split's `main`) is
in a refused program.
4. *SecondSpread is labelled §3.2(a)*: rule 1′ blocks Solved for every
strategy, so adding a strategy cannot lift it.
5. *Skipping the unifier.* Both `BQ` detectors read only `bq`, so a
problem with no `BQ` atom is classified without calling them (no
open atom, in G0's scope). A cost choice, not a reading of either
detector. When `g0Guard` declines, the census rereads each atom to
name the reason and throws if none explains the decline.
6. *P-ii's wording.* r0-erased-rows.md §7 says "a label with a
variable argument"; the reference reading (r0-erased-criterion.mjs)
and this detector count a label argument holding a record or a
variable, so a closed record argument also counts. A scratch run of
the literal reading (a variable, or a record with a tail) over all
3,011 corpus declarations gave the same answer on every one, and
the 34 fixtures agree under both. Informational only (§7.1); listed
for the criterion's owner.
**Detector checks (checked).** test/r0-census-detectors.test.mjs: the
34 erased fixtures' `sources`, `marked` and `inferredRow`; one fixture
per category (`compiles` and categories asserted); G0's two decline
reasons; a second spread stopping at Resolve. Corpus-wide, the
erased-row detector equals the reference reading on 3,011
declarations. The first run of the fixture comparison agreed on all
34 before any adjustment (the detector was written from §4 and §7, then
run).
**Mutants (checked).** Each patch applied to the test module, the run,
then the file restored (scratch script; git status clean of tracked
changes after each).
| Mutant | Command | Failing tests |
|---|---|---|
| M1 erased: `callee: false && …` | `node --test test/r0-census-detectors.test.mjs` | the erased-row detector gives every fixture its answers |
| M2 P-ii: drop `given < declared \|\|` (partial uses) | same | the same |
| M3 walk: `[R.Handler, none]` (clause bodies unread) | same | none (survives) |
| M3 | `node --test --test-name-pattern='pinned counts\|reference reading' test/r0-census.serial.test.mjs` | the census equals its pinned counts; the erased-row detector agrees with the reference reading |
| M4 classify: BQPendingValidR never added | detectors test | each blocking category is detected on its fixture |
| M5 tally: marginal counted for every category | census test, `pinned counts` | the census equals its pinned counts |
| M6 tally: `blockedBy` reads refused declarations too | same | none: equivalent, every declaration of an accepted program compiles |
| M6b tally: declaration counts read refused declarations | same | the census equals its pinned counts |
**The author's counterexample (checked).**
test/r0-erased-challenge.test.mjs pins: today's first diagnostic for
`g` (check, E_EFFECT, `g performs Log, which its signature does not
allow`, at `Log.log(1)`, note at `with pure`); `erasedSources`,
`inferredRows` and the reference reading all silent on `g`, and the
classifier gives it no category; `g`'s problem has empty `d`, `q`,
`bq`, `outside`, `adm`, `split` and `vars`, and `b` is exactly Sig3's
`eq Unit Unit` and E17's `eq Int Int`. r0-erased-rows.md §7.1 now
says "checked".
**Timing (checked).** Generation of each scale program, after a
warm-up, against its serial suite's bound (3 × a measured median,
cited): 6 ms of 225 (1,000 partial applications), 8 of 225 (1,000-long
arrow), 212 of 1,650 (5,000 parameters through generics), 0 of 423
(1 MB literal), 192 of 1,563 (10,000 interpolation parts), 0 of 426
(100,000 escapes), 9 of 729 (200 shapes), 111 of 3,003 (8,000
defers), 44 of 1,458 (1,000 installations), 36 of 933 (1,000
forwarding installations). One run, 2026-10-23.
**The `BQ` detectors' unifier is super-quadratic (checked; BACKLOG
R021).** `openRequirements` on `main`'s problem of fn-scale-programs'
`generic(n)` (one `BQ` atom, Sig10):
node --input-type=module -e "
import { generic } from './test/fn-scale-programs.mjs';
import { load, resolved } from './test/r0-generate-support.mjs';
const { generationInputs: inputs } =
await load('Features.Check.Generate.Inputs');
const { generate } = await load('Features.Check.Generate');
const { openRequirements } = await load('Features.Check.Decide.Open');
for (const n of [250, 500, 1000]) {
const p = resolved(generic(n).source);
const main = p.functions.find(f => f.name === 'main');
const { tables, signatures } = inputs(p);
const problem = generate(tables)(signatures)(main).value0;
const t = performance.now(); openRequirements(problem);
console.log(n, problem.b.length, problem.bq.length,
Math.round(performance.now() - t));
}"
gave `250 468 1 211`, `500 925 1 982`, `1000 1843 1 5574` (n, `B`
atoms, `BQ` atoms, ms): about ×4.6 and ×5.7 per doubling. `g0Guard`
solves twice (its own reduction and `openAtom`'s), so it is argued,
not run, to take about twice as long. Cause (argued from
Entailed/Mgu.purs:122-137): each binding is applied to every
remaining equation and to every image of θ, so n bindings cost at
least n² substitutions over growing terms. Generation
itself stays linear (above). The census avoids the largest case only
because the 5,000-parameter program is built by a function, not
exported as a string, so it is not in the corpus. Not fixed here (a
Task 4.2 module, and no acceptance depends on it); a G-switch (timing)
input, since the switch would run both detectors on every declaration
with a `BQ` atom, and every `main` has one.
Nothing reachable from compile changed; no fixture changed; no corpus
re-pin (no tracked `.wxw`, fixture source or docs waxwing block added;
census.json has no `source`).
## The online strategy and its read-back (2026-10-23)
Task 4.3 (plan; T-R0a §4.2, T-R0b §5.3, §9 items 7-8), shadow only:
nothing reachable from compile changed (r0-verdict's reachability test
passes with the new modules); no fixture changed; no corpus re-pin (no
tracked source added; test/fixtures/r0/rt8.json has no `source`).
**What was built.** `online` (Features.Check.Strategy.Online): today's
`recheck` as the search, `g0Guard` and `checkSubstitution` as guard and
check, certificate `{ substitution, checked }`, witness
`NoWitness (NonConstructive OnlineSolver)` until Task 4.4's adapter.
The read-back (Strategy.ReadBack, with .Walk, .Position, .Type) reads
each positioned variable at its checked-IR position and completes the
auxiliaries by unification (Entailed.Mgu) of the equations that still
mention one. Online.Ending routes a refusal by ruling R3's partition,
each `InternalKind` named. Decide.Shadow is the one assembly of the
shadow run's `Checking` (`shadowChecking`, `shadowDecisions`), its
detector fixed to `Decide.Open.openRequirements`.
**Readings and amendments (labelled).**
1. *Amendment to T-R0b §3.5's E17 (recorder defect, fixed; pending
the spec owner's acceptance):* a perform
is checked as a named call (Check/Operation.purs `named`, FN001), so
E17 takes E5's three cases: the arrow of the unsupplied parameters,
or with more arguments `⟨p, res⟩` and `eq θ(result) (τ… → ⟨p, res⟩)`
(B1). §3.5 wrote `θ(⟦result⟧)` for every perform. Blame (checked):
RT8's position check found the recorded type `Int` at the perform
`Add.add(…)` where the checked node's type is `Int → Int`
(test/fx-run-programs.mjs:cases#14 `main`, whose candidate G0 then
refused, `Unsatisfied`; and test/fixtures/r0/erased/
form.partial-perform.json `g`, whose atoms held anyway). Generator
and RT1's translator were both amended, by this implementer, from the
amended rule: their agreement on it is of algorithm only.
2. *Amendment to §5.2's `Slot` list (read-back defect, fixed; pending
the spec owner's acceptance):* P4
positions its owner's `inst i` at `Slot p i` of a constructor
pattern, which has no instantiation; the read-back reads the pattern
type's argument at the slot's rank among the owner's non-effect-row
variables (Check/Tables.purs `ownerType`). Observed in a scratch run
of the read-back over the corpus before the fix (not re-runnable from
the repo): 372 accepted declarations failed with "a pattern where an
expression was expected"; in the repo: regression row `r0-ctor-slot`.
3. *§5.3's several-tail ambiguity arises at completion:* positions are
read directly, not by matching `types(p)`, so the read is ambiguous
only when an auxiliary's equations leave the one-tail fragment; then
σ keeps the positioned values and claims `Heuristic` (G-A-i(g),
proposed). None on the corpus after the read-back substitutes the
positioned values first; the fixture `two` (`{ a: Int, ...r, ...s }`)
pins it (r0-readback.test.mjs).
4. *Holes (criterion 5, Task 4.2 findings item 8; a provisional
reading the controller accepted, pending the author's ambiguity
ruling, not a decision):* the search binds a
hole as today's lowering does (a type hole `Int`,
Specialize.purs `specialize`; a row hole closed, Lower.purs), so
`pr`/`cmp` at a flexible variable today leaves open never reaches
G0's `RequirementUnjudged` backstop. Without it (observed in a
scratch corpus run with `settled` disabled, script not kept; in the
repo, mutant M3 and row `r0-hole-unbound`), three accepted
declarations meet the backstop: docs/plans/2026-10-21-c001-explicit/baseline/
h1-print-empty and h2-print-chosen `main`, and
test/fixtures/r0/erased/form.show-reference `g`. f02's `cmp` never
reaches read-back: today's `comparable` refuses the hole first
(AmbiguousType), so the attempt is `Searched Exhausted`. This binds
the representative today compiles with; it claims nothing about
other representatives (C001's h1/h2 question stays open). Its effect
stays visible (review fix round 1, I-1): the certificate's `holes`
lists the holes bound, RT8 counts a Solved resting on one as its own
class, "Solved with a bound hole (pending the author's ambiguity
ruling)", and rt8.json's `boundHoles` lists every declaration whose
candidate bound one, with its class (118: 4 Solved, 114 blocked by
markers first, h1 and h2 among them by DataApplication). The four
Solved: C001 baseline a1-discard-dictionary and a2-unused-local
`main`, erased/form.show-reference `g`, r005b
render-quiet-annotated `main`. Correction to the review's premise:
h1/h2 are not shadow Solved; DataApplication blocks them.
5. *Declaration-not-found (ruling R10 (iii)), strengthened:* the
context's declaration must regenerate exactly the problem (compared
through `fields`). Checked RED: with lookup by id alone, a problem
of `f` (id 0) searched in a program whose id 0 is `main` gave a
`Candidate` (r0-online-faults.test.mjs, before the change).
6. *R3 partition in code:* `LaterWork` (R005B placeholders) is confined
per the ruling, so a several-tail placeholder is `SearchBroke` with
its place kept as a hint; T-R0a §4.2 lists it among advisory hints.
7. *Zero fuel, documented (Decide/Refuters.purs, "Fuel"):* strategies
skip their search at fuel 0, refuters still search. Skipping would
need a refuter `LimitReached`; with `Maybe CX` (T-R0a §5.1) a spent
budget still reads `NoCounterInstance Exhausted`. Question for the
author and T-R0a's owner.
8. *`SearchHint`* is `SearchHint String` with `Eq`/`Ord`; `Question`
derives `Eq` (r0-online-carries.test.mjs).
9. *Mgu's `tailOf`* (Task 4.2 minor M-4): several tails now give no
unifier instead of the first tail; no caller passes several.
**Evidence.**
- RT8 RED (checked): `node --test test/r0-rt8.serial.test.mjs` before
the E17 fix failed `RT8: no defect and no position finding` with
`test/fx-run-programs.mjs:cases#14#main: DEFECT: candidate refused,
Unsatisfied` and the two position findings above. The targeted tests
written next failed the same way: r0-generate-forms `E17: a partial
perform is the arrow of the rest` and `… over-applied perform …`,
r0-translator-forms `E17: a partial perform, and an over-applied one
(B1)`, r0-readback `every read-back candidate passes G0…` at
`partly`. GREEN after the fix; RT1, generation totality, the census
and RT3 (r0-injection) still pass.
- RT8 GREEN (checked, test/fixtures/r0/rt8.json, `node
scripts/r0-rt8-pin.mjs`): 3,011 declarations; 0 defects; 0 position
findings. Today accepts 2,773: Solved 1,985 with no bound hole and 4
with one (fix round 1; 1,989 together); §3.2(a) blocked by rule
1, 781 (DataApplication 587, HandlerType 170, FailFamily 60, Deferred
45, EffectArgument 32, DataOverRecords 3, counted per marker); §3.2(b)
declined by `g0Guard`, 3 (examples/records.wxw); `RequirementOpen`
0; Heuristic 0. Today refuses 238: no candidate 233 (`Exhausted`) and
1 (`OutOfBudget`, h5-type-depth); today's own internal failures 3
(`SearchBroke`: fx010-record-payload.pinned, BACKLOG FX010; the two
b9 several-tail placeholders); declined 1 (f03-compare-split). No
declaration is refuted (no refuter or rule is registered), and no
class reads a decline or an Unresolved as a contradiction.
- RT7 (checked, r0-rt7.test.mjs): over the test/fixtures/r0 sources
and a fixture per §5.3 rule, determination reproduces all 48
auxiliary read-back values: E25 1, E26 36, E27 2, E28 6, P6 3.
G-Recon's evidence; it decides nothing.
- Criterion 1 (checked, r0-online.test.mjs): `shadowChecking`'s
`openRequirements` is `Decide.Open.openRequirements`; `boxed`'s
`main` (`pr Fn`, a holder) is `Unresolved Unsupported
RequirementAtoms` with G0's candidate accepted, Solved with the
detector replaced by `const []`, and blocked with an accepting stub
added. purs probes (scratch, deleted): `shadowChecking budget` typed
`Resolved.Program → Checking` compiles; passing a detector as a third
argument fails (TypesDoNotUnify); `Strategy`'s constructor is
unknown outside its module (UnknownName).
- Mutants (checked; each applied in a scratch copy of the worktree,
rebuilt with `purs compile`, the named tests run, then restored):
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 detector | Shadow.purs `openRequirements` → `const []` | r0-online: production detector; no strategy chooses |
| M2 P4 slot | Position.purs pattern slot → `Left` | r0-readback: every candidate passes |
| M3 holes | ReadBack.purs `settled value` → `identity value` | r0-online: binds a hole under pr |
| M4 stop confined | Ending.purs `TableLookup → Confined` | r0-online-faults: R3 routing; ending; stopping kind; generation fault |
| M5 E17 arity | Effect.purs partial perform → result | r0-generate-forms E17 partial; r0-readback every candidate |
| M6 id only | Online.purs `same _ = true` | r0-online-faults: declaration the program lacks |
| M7 no completion | ReadBack.purs auxiliaries dropped | r0-rt7; r0-readback every candidate |
| M8 over-applied | Walk.purs over-applied args dropped | r0-readback every candidate |
| M9 confined stops | Ending.purs `LaterWork → Stops` | r0-online-faults: R3 routing; confined kind |
| M10 too deep | Ending.purs TypeTooDeep → Exhausted | r0-online-faults: ending |
- Fix round 1 (review I-1, I-2; checked). RED first: r0-online-carries
`RT8 accounting: RequirementUnjudged is a defect under Heuristic` gave
`ambiguous several-tail read-back (Heuristic)` with the old order
(Heuristic tested before the refusal kind); `… a Solved with a bound
hole is its own class` and r0-readback `the certificate lists the
holes the read-back bound` failed (no class, no field). GREEN after:
the backstop is tested first, whatever the claim. Mutant (holes
recorded as `[]` in ReadBack.purs): r0-readback `the certificate
lists…`, r0-rt8 `a Solved resting on a bound hole…` and `the classes
equal their pinned counts` fail.
- Regression rows (checked, `node scripts/regression.mjs` with the six
names): `r0-shadow-detector`, `r0-ctor-slot`, `r0-hole-unbound`,
`r0-stop-confined`, `r0-perform-arity`, `r0-declaration-by-id`; each
fixed compiler passes and its restored defect fails.
- Cost (observed, scratch timing; argued as a G-switch input): RT8's
corpus run takes about 85 s,
most of it `g0Guard`, `openRequirements` and `checkSubstitution`
(on test/poly-programs.mjs:programs#48: 1,459, 710 and 749 ms; the
search with read-back 113 ms), BACKLOG R021's unifier among them.
## The substitution witness, Cov and the hole contract (2026-10-23)
Task 4.4 (plan; W = research/division-campaign/witness/statements.md
§1.5, §1.6, §4 Cov; the author's criteria of 2026-10-23), shadow only:
nothing reachable from compile changed (r0-verdict's reachability test
passes; its pinned set gains Domain.Verdict.Witness, the type's new
home). No fixture with a `source` changed; no corpus re-pin. RT8's pin
(test/fixtures/r0/rt8.json) changed, read below.
**What was built.** Domain.Verdict.Witness holds W's `Witness` and
`Binding` (moved from Domain.Verdict.Open, where it was uninhabited);
`NoWitnessReason` gains `Uncovered Var` and `HoleContract Var`.
Features.Check.Strategy.Witness: `substitutionWitness` binds every
flexible variable (`Recon` empty, §18.69 Q6), each `Inline` or `Free`,
names none, and offers the witness only if `coverage` accepts it;
`coverage` is Cov: every flexible variable bound, then the hole
contract. Strategy.HoleContract is W §1.5's syntactic check. The online
strategy's witness is `substitutionWitness` over the read-back's σ
before its hole defaults (`unsettled`, new on ReadBack and
`Certificate`); its placeholder `NonConstructive OnlineSolver` is gone.
ReadBack's `settled` moved to ReadBack.Type unchanged, shared with the
contract's defaults. Default binding remains a labelled shadow
experiment, not an ambiguity policy.
**Readings and amendments (labelled).**
1. *Amendment to W §1.6:* `Inline` holds an `RTExpr` (σ's vocabulary),
not `Ty Open`, which Domain cannot name; a hole inside is
ReadBack.Type's `holeVar n`. No `Named` binding until Task 6.1
defines `NameId`; `NameEntry` is uninhabited, so `names` is empty.
2. *Amendment to W §1.6:* Cov's refusal needs a reason W does not name;
`Uncovered v` is it.
3. *Reading of W §1.5 (cited §1.3, Adapt-N):* the contract judges every
hole a binding leaves, inside an `Inline` image as well as a `Free`
one, since both are defaulted; the variable named is the first in
`Ord Var` order whose binding mentions a broken hole.
4. *Reading of W §1.5, kept literal:* a `lacks` or `disjoint` atom that
mentions a hole breaks the check ("every `B` atom mentioning the
hole is an equation"), although W's own argument says `{}` is the
weakest choice for disjointness. The check is sufficient, not
complete; RT8 meets one case (below). A `BQ` atom holds only if the
ground rule gives `Holds` at the defaults with every remaining
variable `Unjudged` (no stricter than G0 at the settled σ, argued
only: no fixture has a rigid holder under a `BQ` atom with a hole;
RT8 has no `BQ` refusal).
5. *Labelled choice:* a variable σ leaves out is `Free` at a hole
numbered above every hole σ mentions, in `Ord Var` order; no
checked-IR hole stands for it. *Open risk (review, 2026-10-23;
BACKLOG R023):* that number can equal a hole of the checked
declaration that σ does not mention, since the numbering sees σ's
holes only. Harmless to the contract, which judges bindings alone;
it matters once lowering reads `Free n` (Task 6+), where two
variables would share one hole. Next check: a fixture whose σ omits
a variable while the checked IR holds a hole σ does not mention,
showing the numbers apart (or number above the checked IR's holes).
Recording it does not close it. *Open obligation (rule review of
docs/plans/r0-hole-contract-amendment.md, 2026-10-23):* such a hole
has no checked-IR hole, so its default (`{}`/`Int`) is the
contract's convention, which Task 6's lowering must adopt; sharing
a number does no harm to the contract (same sort-positional
default). *Follow-up (same review, not fixed):* Cov has no sort or
genericity check for hand-built witnesses (a row variable bound to
`Inline (TVar hole)` hides its hole from the contract); reusing
`generic` on the settled images would fit (BACKLOG R024).
6. *Amendment (after the mutant run, not before):* the lacks/disjoint
test was added because mutant M5 survived the first six tests
(corrected 2026-10-23 from "five": RED lists six).
**TDD (checked).** Tests in test/r0-witness.test.mjs, written against
a stub (`substitutionWitness` gives an empty `Witnessed`, `coverage`
accepts) with the `unsettled` plumbing already built. RED, `node --test
test/r0-witness.test.mjs`: 0 pass, 6 fail: `Cov refuses a witness
missing one auxiliary` (bindings `[]` against the two flexible
variables), `route: u defaulted to {} …` (`Witnessed` against
`HoleContract` at inst 0), `an auxiliary left out of σ …`
(`Witnessed`), `an unconstrained hole whose default is permitted …`
(free holes `[]` against `[0]`), `a BQ atom failing …` (`Witnessed`),
`a required non-default binding …` (TypeError, no bindings). GREEN: 7
pass, 0 fail, with the lacks/disjoint test (amendment 6). The route
test also shows the default itself breaks `B`: G0 refuses σ with
u ↦ `{}`.
**Mutants (checked, scratch copy, `python3 mutants.py`, each built and
`node --test test/r0-witness.test.mjs` run):**
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 coverage off | Witness.purs `Left (Uncovered variable)` → `const (Right unit) (Uncovered variable)` | Cov refuses a witness missing one auxiliary |
| M2 contract off | Witness.purs `holeContract problem witness` → `const (pure unit) (…)` | route; auxiliary left out; BQ; lacks or disjoint |
| M3 BQ arm | HoleContract.purs `Unjudged`/`Open`/`Fails` → `[]` | BQ atom failing at the default |
| M4 equation arm | `under images one == under images other` → `true` | auxiliary left out of σ |
| M5a disjoint arm | `Disjoint one other → …` → `Disjoint _ _ → []` | lacks or disjoint |
| M5b lacks arm | `Lacks row _ → rowHoles row` → `Lacks _ _ → []` | lacks or disjoint |
| M6 no Free | `bareHole …` → `Nothing <* bareHole …` | unconstrained hole accepted |
| M7 settled σ | Online.purs `certificate.unsettled` → `certificate.substitution` | unconstrained hole accepted |
M7 is "a binding alone establishes the contract": witnessing the
settled σ turns every default into an `Inline` binding the contract
never sees. Regression rows (checked, `node scripts/regression.mjs
r0-cov-skipped r0-hole-contract-skipped`): `r0-cov-skipped` (coverage
accepts every witness; probe: a witness missing an auxiliary) and
`r0-hole-contract-skipped` (probe: route's defaulted `u`); each fixed
compiler passes and its restored defect fails. The RT8 classifier
(test/r0-witness-account.test.mjs) is tested with every `Compilation`
and `NoWitnessReason` constructor injected.
**RT8 under Cov and the hole contract (checked, `node
scripts/r0-rt8-pin.mjs`, re-pinned).** 2,770 accepted candidates,
blocked or not: 2,769 `Witnessed`, 1 `NoWitness HoleContract`, none
`Uncovered` or `NonConstructive`. Solved: 1,985 `agree: Solved` (every
binding `Inline`), 3 `Solved with a bound hole` (a1-discard-dictionary
main, a2-unused-local main, erased/form.show-reference g; their `Free`
holes pass the contract), and 1 new class, `Solved, no witness:
HoleContract`: test/fixtures/r005b/render-quiet-annotated.json main,
variable inst 1 of `apply0`'s call (`b ↦ { ...hole 0 }`). Its hole 0 is
also `pickR`'s `s` in both lambdas, under `where r disjoint s`, so the
`disjoint` atom mentions it and reading 4 refuses; with the disjoint
arm disabled in a scratch copy the witness is `Witnessed` (checked), and
G0 accepted the settled σ, where `s = {}` makes the atom hold. So this
is the syntactic check's incompleteness, not a wrong default: the
declaration keeps Solved and has no compilation. It is listed in
rt8.json `noWitness` and `boundHoles`. Counts moved: bound-hole class
4 → 3, the new class 1; nothing else.
**Found, not fixed (shadow read-back; BACKLOG R022).** A row-sorted
`inst` slot whose checked type is a hole is read back as a type
(`TVar (holeVar n)`), so σ is not generic and G0 refuses
(`CheckFailed ClaimsComplete NotGeneric`) where today accepts. Probe
(scratch, today `Right`): `fn d2(whole: { ...u }, left: { ...s }): Int
where u disjoint s = 0; fn g(y: { ...s }): Int = { let k = fn(x) =>
d2(x, y); 0 }; fn main(): Int = 0;`, and the same with `where u lacks
{ a }`. RT8's corpus has no such declaration (no NotGeneric defect).
The lacks/disjoint test writes σ by hand for this reason. (Fixed
2026-10-23; see "R022: the read-back respects a variable's sort".)
**Question to the author (review, 2026-10-23; ruled the same day).**
Keep W §1.5's literal check, which refuses any `lacks` or `disjoint`
atom that mentions a hole, or admit such atoms when they hold at the
default? Ruling: amend the check to admit them when they are
established at the default by the existing atom checks under the
declared hypotheses, else keep `NoWitness`; equations unchanged; no
split selection or ambiguity policy follows. The narrow rule is
docs/plans/r0-hole-contract-amendment.md, pending its review.
## R022: the read-back respects a variable's sort (2026-10-23)
Follow-up to Tasks 4.3/4.4 (author's ruling of 2026-10-23), shadow
only: nothing reachable from compile changed; no corpus re-pin (the
probes are inline, test/r0-r022-probes.mjs).
**Fix.** ReadBack.Type `readSorted`: a row-sorted variable whose
checked type is a bare hole reads as `{ ...hole n }`; anything else as
`readType` reads it. This matches specialization, which takes an
unsolved record-sorted argument as the empty-fields row with the hole
as its tail (cited: src/Features/Specialize/Values.purs `slotType`,
`RecordSort, TVar hole@(Hole _) → TRecord (recordRow [] [ hole ])`) and
then closes it (Specialize/Lower.purs `tail`, `Hole _ → pure Nothing`).
ReadBack.Position's `valueAt` takes the variable's recorded sort.
Checked: a solved row slot is already a `TRecord` in the checked IR
(the probes' inst 1 reads `{ ...rigid 0 }`), so only the bare hole
needed the sort.
**TDD (checked).** test/r0-readback-sort.test.mjs, through the online
search and `shadowDecisions`, for both probes (`where u disjoint s`,
`where u lacks { a }`). RED, `node --test --test-reporter=spec
test/r0-readback-sort.test.mjs`: 0 pass, 4 fail: "the row slot's hole
is read as a row tail" (actual `{"tvar": hole 0}`, expected `{"record":
{fields [], tails [hole 0]}}`) and "shadowDecisions accepts the
read-back σ" (`CheckFailed`, message `NotGeneric`), each for Disjoint
and Lacks. test/r0-witness.test.mjs's lacks/disjoint test, switched to
the production σ (`certificate.unsettled`, asserted equal to the old
hand-written σ; G0 judged on `certificate.substitution`), failed
before the fix (σ differs at inst 0). RT8 with the probes added, before
the fix: defects `inline:r022-disjoint#g` and `inline:r022-lacks#g`,
`DEFECT: candidate refused, NotGeneric`. GREEN: 4/4, 7/7, RT8 5/5.
**Under the literal W §1.5 rule (checked).** Both probes are now
`Accepted` with `NoWitness (HoleContract v)`, `v` the lambda's
parameter 0 (`x ↦ { ...hole 0 }`): the `disjoint`/`lacks` atom mentions
hole 0. G0 accepts the settled σ (`x = {}`). RT8 class `Solved, no
witness: HoleContract`.
**RT8 (checked, `node scripts/r0-rt8-pin.mjs`, re-pinned).** 3,011 →
3,017 declarations: the six of the two inline probes (`d2`, `g`,
`main` each). `agree: Solved` 1,985 → 1,989 (`d2`, `main`), HoleContract
class 1 → 3, `Witnessed` 2,769 → 2,773, `NoWitness HoleContract` 1 → 3;
no corpus row changed. test/r0-rt8.serial.test.mjs pins `noWitness` to
render-quiet-annotated and the two probes.
**Mutant and regression row (checked).** Patch (ReadBack/Type.purs):
`SortRow, TVar (Hole index) → Record [] [ holeVar index ]` →
`SortRow, TVar (Hole index) → readType (TVar (Hole index))`. In a
scratch copy, built: test/r0-readback-sort.test.mjs 0 pass 4 fail (all
four above), test/r0-witness.test.mjs 6 pass 1 fail (lacks or
disjoint). RT8 needs `git ls-files`, so it was not run in the git-less
copy. Row `r0-readback-sort-blind` (same patch; probe: each R022 probe's
online attempt must be `Accepted`): `node scripts/regression.mjs
r0-readback-sort-blind r0-cov-skipped`: each fixed compiler passes and
its restored defect fails.
**`r0-cov-skipped` narrowed (review minor 5, checked).** Its
replacement now disables only the `traverse_ covered` line, the hole
contract left on; re-proved by the run above.
## The hole contract's lacks/disjoint amendment (2026-10-23)
The author's ruling of 2026-10-23, as stated in
docs/plans/r0-hole-contract-amendment.md (corrected after its review,
957f35a). Shadow only: nothing reachable from compile changed; no
corpus re-pin. Strategy.HoleContract: a `lacks` or `disjoint` atom
mentioning a hole breaks the check unless `atomUnder (facts problem)
(settled <$> images) entry` is `Right unit` (Strategy.Atoms, reused
unchanged); equations, `BQ` and Cov unchanged. This supersedes Task
4.4's reading 4 (literal) for these atoms; the R022 section above
records what the literal rule gave.
**TDD (checked).** test/r0-hole-arm.test.mjs: the note's E1-E19 (25
tests) on problems built directly (test/r0-hole-arm-support.mjs),
through `substitutionWitness`, plus render-quiet-annotated through
`shadowDecisions` and route's E9. RED against the literal rule, `node
--test --test-reporter=spec test/r0-hole-arm.test.mjs`: 14 pass, 11
fail, each failure `['HoleContract', 'x']` where `['Witnessed']` was
expected: E1, E2, E4, E8, E12 (bare), E13, E14 (with `r disjoint s`),
E15 (with `r lacks b`), E16, E19 and render-quiet-annotated main
(`NoWitness HoleContract`). Every refusal case and the unchanged ones
(E3, E5-E7, E9, E10, E11, E12 rigid, E14, E15, E17, E18) passed before
and after. Also RED: test/r0-readback-sort.test.mjs's two
"shadowDecisions accepts the read-back σ" tests, now expecting
`Witnessed` (Stage A pinned `NoWitness HoleContract` there), and
test/r0-witness.test.mjs's lacks/disjoint test, now expecting
`Witnessed`. GREEN: 25/25, 4/4, 7/7; covering run 117/117.
**Mutants (checked, scratch copy, each built, the three test files
run; scripts in scratchpad hole-arm/mutants*.py):**
| Mutant | Patch (HoleContract.purs) | Failing tests |
|---|---|---|
| A accept every atom | `either (const holes)` → `either (const (const [] holes))` | E3, E5, E6, E7, E12 rigid, E14, E15, E17 |
| B no defaults | `(map settled images)` → `images` in the arm | E1, E2, E4, E8, E12, E13, E14 apart, E15 defined, E19; witness lacks/disjoint; both R022 production tests |
| C empty facts | `facts problem` → `const {lacks: ∅, disjoint: ∅} (…)` | E4, E14 apart, E15 defined |
| D1 literal lacks arm | `Lacks row _ → rowHoles row` | E1, E13, E14 apart, E15 defined, E16, E19; witness; R022 Lacks |
| D2 literal disjoint arm | `Disjoint … → rowHoles one <> rowHoles other` | E2, E4, E8, E12, render-quiet-annotated; witness; R022 Disjoint |
| E equation at defaults (B3 a) | guard `under … == under …` → `atomUnder known (map settled images) entry` succeeds | E9, route (r0-witness), E10 undefined-sides |
| F hole-free atom breaks all (B3 b) | refused atom with no hole breaks every witness hole | E11 |
Restoring both literal arms at once does not compile (the helper goes
unused), so D is one arm at a time. B3 (b) as literally stated
(judging hole-free atoms) is equivalent (argued in the note); F is its
killable form. Regression rows (checked, `node scripts/regression.mjs
r0-hole-equation-defaulted r0-hole-arm-defaults-skipped
r0-hole-contract-skipped r0-readback-sort-blind`, each fixed compiler
passes and its restored defect fails): `r0-hole-equation-defaulted`
(mutant E; probe route's defaulted `u`) and
`r0-hole-arm-defaults-skipped` (mutant B; probe: R022's probes must be
`Witnessed`), in scripts/regression-r0-witness.mjs, spread into r0Rows.
**RT8 (checked, `node scripts/r0-rt8-pin.mjs`, re-pinned).** Witnessed
2,773 → 2,776, `NoWitness HoleContract` 3 → 0; class `Solved, no
witness: HoleContract` 3 → 0 (gone); `Solved with a bound hole` 3 → 6:
render-quiet-annotated main and R022's two probes, each now witnessed
with a `Free` hole. Nothing else moved. route is not in RT8's Solved
set; its `u` stays `NoWitness` (E9, checked). The note's B2 claim
("the arm never refuses an online witness", argued by monotonicity) is
checked over RT8: test/r0-rt8.serial.test.mjs asserts `witnesses` has
only `Witnessed` and `noWitness` is empty, so no witness is refused by
a lacks/disjoint atom.
## The read-back's sort only at an expression slot (2026-10-23)
Carry from Task 4.4b's review (Ruling), before Task 4.5; shadow only,
nothing reachable from compile changed, no corpus re-pin.
`readSorted` (ReadBack.Type, R022) was applied by ReadBack.Position's
`valueAt` at every positioned kind, but specialization reads a
record-sorted bare hole as a row tail only in an expression's
instantiation slot (cited: Specialize/Values.purs `instantiated`, the
one caller of `slotType`); a pattern's type and a named rest's go
through `typed` with no sort (cited: Specialize/Body.purs
`copyPattern`, `copyRest`), where lowering takes a bare hole as `Int`.
**Fix.** `valueAt` applies `readSorted` only at `Slot` on an expression
node (`slot`'s `AtExpr` arm); a constructor pattern's slot and every
other kind read through `readType`.
**Reachability (argued).** No corpus declaration reaches the
difference: a named rest's checked type is the matched record without
its labels (Check/RestBinder.purs `restOf`, `remainder`), a record, not
a bare hole; RT8 is unchanged (below). The test therefore plants one.
**TDD (checked).** test/r0-readback-sort.test.mjs, "the sort applies
only at an expression slot: a rest reads bare"
(test/r0-readback-rest.mjs: the P7 declaration `f(p: { a: Int, ...r })
= match p { { a: _, ...rest } => rest }`, its checked rest type replaced
by `TVar (Hole 0)`, `valueAt` at the row-sorted rest variable's
`RestType`). RED, `node --test test/r0-readback-sort.test.mjs`: 4 pass,
1 fail, actual `{"record":{"fields":[],"tails":[hole 0]}}`, expected
`{"tvar": hole 0}`. GREEN: 5/5. RT8 unchanged: `node --test
test/r0-rt8.serial.test.mjs` 5/5 against the pinned rt8.json (84 s).
**Regression rows (checked).** Row `r0-ctor-slot`'s needle follows the
moved line (`AtPattern … → readType <$> (ownerArgument … at.rank)`;
the first verify after the change failed it as "mutation must have
exactly one target"; `node scripts/regression.mjs r0-ctor-slot` then
passed). `r0-readback-sort-everywhere`
(scripts/regression-r0-witness.mjs; patch in Position.purs `plain = map
readType` → `plain = map (readSorted sort)`; probe
test/regression-r0-witness.mjs: the planted rest must read as a
`TVar`). `node scripts/regression.mjs r0-readback-sort-everywhere
r0-readback-sort-blind`: each fixed compiler passes and its restored
defect fails.
## The census walk reversed a program's arguments (2026-10-23)
Found by Task 4.5 while joining the census's classification to RT8's
run; a defect of Task 3.5's test-only code, fixed (shadow machinery).
test/r0-census-walk.mjs `expressionsOf` pushed
`childrenOf(next).reverse()`, and for `Call`, `Construct`, `Interpolate`,
`Perform`, `Print`, `Show` and `Crash` the child list is the node's own
array, so each walk reversed those arguments in the resolved program.
`classifyProgram` walks each declaration three or four times
(`erasedSources`, `inferredRows`, `patternsOf`); after an odd number, a
later `checkProgram` of the same program object refused what today
accepts (checked: a3-fixed-carriers `main`, `Right` before
`classifyProgram`, `Left E_TYPE "Expected Pair(Bool, Text), found
Pair(Text, Bool)"` after; a scratch dump of the corpus read 2,580
compiling declarations instead of the census's 2,773 that way).
**Effect on pinned results (checked).** None: the census computes each
declaration's `compiles`, generation and `compile` before walking it,
and the walk's readings do not depend on argument order;
`node --test test/r0-census.serial.test.mjs` passes against the
unchanged census.json after the fix (13/13).
**TDD (checked).** test/r0-census-detectors.test.mjs, "walking a body
leaves the program unchanged" (`Pair(1, true)` walked once, then
checked). RED, `node --test test/r0-census-detectors.test.mjs`: 4 pass,
1 fail (`['Left']` against `['Right']`). Fix: the walk reverses a copy.
GREEN: 5/5.
## The window table (2026-10-23)
Task 4.5 (plan; §3.1, §3.2, Review Focus 1), shadow only: nothing
reachable from compile changed; no acceptance change, switch,
exemption or policy. test/r0-shadow.serial.test.mjs compares, for every
declaration of every resolving corpus program, R022's two inline probes
and two inline defect probes (R020, FX032; test/r0-shadow-known.mjs),
today's class (compiles, or refused with code and text) with R0's as
decided in shadow (`shadowChecking`: `online` alone, no refuter, rule
or shadow), and pins a row for each difference in
test/fixtures/r0/window.json (`node scripts/r0-shadow-pin.mjs`). It
reads RT8's run (`declarationsOf`, test/r0-rt8-run.mjs) rather than
deciding again, RT8's classes (r0-rt8-account.mjs), the census's
erased-row detector and `g0Guard` reasons (r0-census-*.mjs) and Task
3.2's `staticRules`; the classifier (test/r0-shadow-classes.mjs) names
every case and throws on anything else. Rows carry no `source` (no
corpus re-pin): each names its origin, the SHA-256 of its program's
source, today's class, R0's verdict and online attempt, RT8's class,
the window class with its §3.2 label (none for defects), Review Focus 1
class, target and named dependency, its blockers and whether its
program compiles today.
**Summary (checked, the pinned table after fix round 1; 3,021
declarations, 1,132 programs, 746 compiling).** Agreements, no row:
Solved 1,980; a static refusal with today's code 17 (`StaticArity`,
E_ARITY). Rows, 1,024. Columns: declarations; programs; *compiling
programs in this class* (programs `compile` accepts today with a row of
the class, whether or not R0 would stop them); of those, programs
*stopped under the shadow decisions* (a row of the class whose R0
verdict is not Solved). Amended in fix round 1 (the author's ruling
R-a): the first version called the third column "programs a live R0
verdict would stop", which it is not (the FX032 row compiles and is
Solved; bound-hole rows are Solved).
| Window class | § (source) | Decls | Programs | Compiling in class | Stopped under shadow | Target (dependency) |
|---|---|---|---|---|---|---|
| markers: compiles today, R0 Unsupported Outside | (a) (plan) | 781 | 282 | 244 | 244 | Solved (G-exempt; for data kinds also the free-constructor model) |
| erased row: compiles today, census detector fires | (a) (plan) | 11 | 8 | 6 | 0 | per the G-erased ruling (narrowing not approved) |
| BQ at a rigid variable: online declines | (b) (plan) | 3 | 3 | 1 | 1 | Solved (a strategy whose Sound_F covers it, e.g. contracts carrying Q) |
| outside the unitary fragment: online declines | (b) (plan) | 0 | 0 | 0 | 0 | Solved (a strategy covering several tails) |
| BQ pending G-ValidR / RequirementOpen: compiles today | (a) (plan) | 0 | 0 | 0 | 0 | per G-ValidR |
| ambiguous several-tail read-back (Heuristic) | (b) (reading) | 0 | 0 | 0 | 0 | Solved (a strategy certifying the split) |
| Solved with a bound hole | (a), pending policy (ruling R-b2) | 6 | 6 | 5 | 0 | per the author's ambiguity ruling (Solved now) |
| today refuses, R0 Unsupported Outside | (a) (plan) | 92 | 91 | 0 | 0 | undetermined pending classification (G-exempt, then classification) |
| today refuses, BQ pending G-ValidR | (a) (reading: Task 4.2's Q2) | 2 | 2 | 0 | 0 | per G-ValidR (κ) |
| today refuses, BQ at a rigid variable | (b) (plan) | 0 | 0 | 0 | 0 | undetermined pending classification |
| today refuses, outside the unitary fragment (f03) | (b) (plan) | 1 | 1 | 0 | 0 | undetermined pending classification |
| false contradiction (D6) becomes Unresolved | (b) (ruling R-b2) | 6 | 6 | 0 | 0 | Solved (a strategy that certifies it) |
| known-valid program; current solver cannot decide | (b) (ruling R-b2) | 9 | 9 | 0 | 0 | Solved (validity; admissibility separate where it applies) |
| today's refusal becomes Unresolved (no candidate) | (b) (ruling R-b2) | 104 | 100 | 0 | 0 | undetermined pending classification |
| defect | none | 9 | 9 | 1 | 0 | its separately authorized fix |
The section's source is in window.json's class table (`sectionSource`,
`sectionReading`); each row keeps its `section`, and the class table
holds focus, target and dependency once (window.json 673 KB → 478 KB,
the pinned comparison unchanged in strictness: the whole table is
deep-equal).
**Three scenarios (checked, `summary.stops`; the author's ruling
R-a).** Programs compiling today that R0 would stop: (1) under the
implemented shadow decisions, 245; (2) in addition, if the erased-row
boundary were adopted (narrowing not approved), 6; (3) in addition, if
a future ambiguity policy rejected the bound-hole cases (Solved now;
hypothetical, not approved), 5, of which 2 are R022's inline probes
(3 over the corpus). Per blocker (overlapping, compiling declarations;
compiling programs): DataApplication 587; 138, HandlerType 170; 102,
FailFamily 60; 41, Deferred 45; 41, EffectArgument 32; 31,
DataOverRecords 3; 0, ErasedRow 91; 72. Programs Resolve refuses for a
second spread: 71 (not run in shadow, no resolved program; Task 6.5's
row).
**§3.1's numbers (checked, the table).** Option A keeps all of D6's
false contradictions: 6 declarations in 6 programs (copies of the three
the refusal audit checked), and refuses the 9 known-valid programs.
Option B would also turn today's refusals of undetermined status
Unresolved: 104 with no candidate, 92 behind markers. Option C keeps
those of blocked declarations only: none of the D6 or known-valid rows
is blocked.
**Option C's list (§3.1; listed, not adopted).** 15 rows, each refused
today and under R0 (no acceptance change), with no blocker: the six D6
rows (p11-route.wxw, rt2/d6-p11-route.json and integration/recon.md#1
`route`; c01-h-label.wxw `route`; b03-mayhold-share.wxw and
rt2/b03-mayhold-share.json `use`) and the nine known-valid rows (below).
**Known-valid programs (fix round 1, the author's ruling R-b1; each
with its evidence in test/r0-shadow-known.mjs and the row's
`evidence`).** D4 "Cannot tell" refusals whose validity is recorded
elsewhere; today's text does not assert impossibility, so they are not
false contradictions:
- c21: composition-assessment/programs/p4.wxw `main` (byte-identical to
source/examples/c21-accepts-parts.wxw, checked with `cmp`; the corpus
keeps the first origin) and rt2/d4-c21-accepts-parts.json `use`.
Cited: refusal-audit.md:353-358 (checked there, oracle, split forced);
translation.md:492.
- p10 `wrapAccepts` (source/examples and rt2/d4-p10-wrap-accepts.json):
translation.md:480, Lean `wrapAccepts_validFin` (cited).
- p12-route-narrowed `route`: translation.md:482, Lean
`routeNarrowed_validFin` (cited).
- c22s-compose-requirements-stub `main`: translation.md:493, recorded
witness `r' = {x}`, `s' = {y}` (cited).
- `walk` W1 (rt2/d4-walk-w1.json, r019 walk-as-written.caller and
.no-caller `walk`): requirements.md:83-86, valid with the identity
split (argued there). Validity only: recursive admissibility (W2,
R010, BACKLOG R019) is a separate question.
Left undetermined: f03-compare-split `main` (fix round 2, below),
rt2/d6-submit `submit` (its validity rests on "a
reviewer's unrecorded bounded evaluation", requirements.md:429-431),
the call site `main` of walk-as-written.caller, the other "Cannot tell"
refusals, and the 8 identical-sides C001 rows ("Expected X, found X").
**Defect rows (recorded, not fixed).** FX030: audit
must-be-pure.clock-row and effect-not-allowed-require.written `k`.
FX031: erased obligation-annotation.refused and obligation-ground.refused
`g`. FX010: audit fx010-record-payload.pinned `k` (R0: `SearchBroke`,
blocked by FailFamily). R005B placeholders: rt2 b9-removal and
b9-rest-binder several-tails `drop` (`SearchBroke`). R020: inline
`main` (today `x is not a field of { ..._ }`; R0 no candidate). FX032:
inline `g`, compiled today (the defect), R0 Solved.
**Reconciliation (checked, asserted by the serial test).** With
census.json over the corpus alone: programs 1,128, compiling 743,
second spreads 71, each blocker's declarations and programs, the union
251 and 245 without ErasedRow, the erased class against
`markedWithoutOutsideKind` 11, the rigid class against `guard.rigid` 3
and BQPendingValidR 0 all equal. The pinned summary differs only by the
inline probes: 746 compiling programs (743 + R022's two + FX032's) and
6 bound-hole rows (RT8's 4 corpus + 2 probes). With rt8.json: every
RT8 class's count equals its window rows plus its agreements over RT8's
sources; RT8 counts the 6 bound-hole declarations and puts the 11
erased-row ones under `agree: Solved` (the census's detector is not in
src); the 17 static refusals are RT8 `agree: no candidate`.
**Readings (labelled).**
1. *D6, hand-labelled (cited):* refusal-audit.md:46-49 checked three
refusals of valid programs whose text wrongly asserts impossibility
(p11 `route`, c01, b03); copies of the same declarations count
(argued, equal text up to layout). Amended in fix round 1: the known
valid D4 refusals are their own class (above), and no other refusal
gets a Contradiction target.
2. *Static refusals (argued):* a declaration whose `staticRules` gives
a refusal with today's code is refused by R0 beside the verdict
(T-R0a §3.2; Task 4.6 runs the rules before generation), so it is
an agreement, not a row; the shadow decision still says no
candidate.
3. *Labels:* the plan's §3.2 gives the compiling classes' labels;
the author's ruling R-b2 gives (b) to strategy limitations (no
candidate; a strategy declining a complete problem) and "(a),
pending policy" to the bound-hole class (planning only, not an
approval of rejecting them). Readings, flagged `sectionReading` in
window.json: Heuristic (b), and the 2 cmp-at-rigid refusals (a)
(Task 4.2's Q2 ruling).
4. *Primary class:* markers first (decided), then the erased-row
detector, then the bound hole; every row lists all its blockers.
5. *Hint (amended in fix round 1, the author's ruling R-b3):* the
no-candidate hint now carries today's text and place as an
untrusted search hint (a01: `untrusted search hint: the legacy
solver stopped at 1:15, reporting "Expected Int, found Bool" (its
reason for stopping, never evidence of a contradiction)`). The first
version kept only the place.
6. *AT17 hook:* the run's one `Checking` is `shadowChecking`
(Decide/Shadow.purs), through r0-online-support's `decisions`; rows
pin the online attempt (`attempts[0]`), not the attempt list, so
Task 5.2's `shadows: [cx]` moves a row only if a class moves.
**Evidence.** Classifier (test/r0-shadow-classes.test.mjs, every class
on injected facts, ten unknown inputs throw): written after the
classifier (not test-first), so checked by mutants instead, each run
against it (scratch script, restored): M1 bound hole folded into
agreement, M2 D6 list ignored, M4 erased detector ignored each fail
"each window class is assigned"; M3 a catch-all where today compiles
fails "anything else throws". M1 against the serial test fails "the
window equals its pinned table" only. Cost (observed): the serial test
takes 93 s (RT8's run 84 s of it; `compile` per program and the
detectors the rest); RT8's and the census's serial tests stay
separate, so verify decides the corpus twice (BACKLOG R025).
**Fix round 1 (the task review and the author's ruling of
2026-10-23).** Shadow only: Online.purs and Shadow.purs are reachable
from no compile path (ruling R6; r0-verdict's reachability test passes
in verify); no CLI text changed.
- *Hint (R-b3; checked).* `OnlineContext` and `shadowChecking` take
`legacyText ∷ Diagnostic → String`, injected by the caller (the test
support passes Format.Diagnostic's `wire(d).message`; Features
imports no Format module), and `stoppedHere` words today's text as
the legacy solver's untrusted reason for stopping. RED, `node --test
test/r0-online-hint.test.mjs`: 0 pass, 1 fail (actual `the current
solver stopped here: 1:15`). GREEN 1/1; the online, faults,
read-back, carries, hole-arm and witness suites 60/60. Row
`r0-hint-text-dropped` (patch `<> legacyText diagnostic` →
`<> const "" (legacyText diagnostic)`; probe: the hint must report a
non-empty text): `node scripts/regression.mjs r0-hint-text-dropped`,
the fixed compiler passes and the restored defect fails.
- *Pattern-slot arm (review minor 2; checked).* test/r0-readback-sort
"a constructor pattern's row slot reads bare" plants a bare hole as
the row argument of `Box(...s)` in a real P4 declaration
(test/r0-readback-rest.mjs `slotReadFrom`). Mutant, Position.purs
`AtPattern (Checked.Pattern found) → readType <$>` →
`… → readSorted sort <$>` (built in place, restored, rebuilt): 5
pass, 1 fail, that test. Row `r0-readback-pattern-slot-sorted` (same
patch): proved.
- *Classifier mutants, exact patches (checked; each applied to the
test module, `node --test test/r0-shadow-classes.test.mjs` run,
restored).* M1 `? 'erased row: …' : boundHoleClass;` → `… : null;`;
M2 `facts.at in falseContradictions` → `false`; M3 the `fail(facts,
'no window class where today compiles')` return → `return 'markers:
compiles today, R0 Unsupported Outside'`; M4 `return erased.length >
0` → `return false` (agreeing Solved branch). Fix round: M5 `return
facts.at in knownValid ? valid` → `return false ? valid`; M6 the
decline's `if (refused && facts.at in knownValid) return valid;`
removed; M7 (r0-shadow-table.mjs) `undetermined =` the
"undetermined pending classification" text → `'Contradiction (today\'s
refusal)'`; M8 the bound-hole entry's `${a}, pending policy` → `a`.
M1, M2, M4, M5, M6 fail "each window class is assigned on its
injected facts"; M3 fails "anything else throws"; M7 and M8 fail "no
class of today's refusals targets Contradiction". The class changes
were written before these tests (not test-first); the re-pin's diff
(10 rows to the known-valid class, every refused class's target)
and the mutants are the evidence.
- *FX032 (R-b4; argued).* The C-erased detector reads resolved syntax,
from which Resolve already discarded the operation's row
(Resolve/Effect.purs:47-58), so its silence on FX032's `g` and
today's agreement with R0 (Solved) do not validate that declaration;
the row's `defect.blindSpot` says so. Not fixed here (the separately
authorized compatibility fix; the detector is updated then if
needed).
- *History (G; checked).* 244a1c1 alone fails verify: it moved the line
`r0-ctor-slot`'s needle targets ("mutation must have exactly one
target"), fixed in 4561964. 4561964 also carries this section's
first version (a staging slip: docs/findings.md was staged whole);
per the author's ruling, history is left as it is.
- *Double corpus run:* BACKLOG R025.
- *Verify (observed).* One `npm run verify` after the other worktree's
regression runs ended: gates pass, parallel 2,792/2,792, serial
110/111: fn-linear-timing `partialFirst` 942 ms against its 930 ms
bound (Specialize, untouched here; BACKLOG T007 updated); alone it
took 852-874 ms. Verify stopped before its regression stage, which
was then run on its own: `node scripts/regression.mjs`, EXIT 0, 199
proofs.
**Fix round 2 (the scoped re-review and the controller's ruling under
R-b1).** f03-compare-split `main` moves back from "known-valid" to
"today refuses, outside the unitary fragment: online declines", target
"undetermined pending classification". "Also f03"
(refusal-audit.md:360) records no witness, argument or oracle result,
and §3.10 (refusal-audit.md:411-415; r0/boundaries.md:772) makes f03
the example of class d, whose validity depends on the open
comparability policy. Known-valid: 9 rows; option C: 15. walk W1 stays
known-valid with its "argued" evidence. The corpus-only scenario 3
(+3; the pinned summary's +5 counts R022's two probes) is now asserted
in test/r0-shadow.serial.test.mjs, as is f03's class. Checked: `node
--test test/r0-shadow-classes.test.mjs test/r0-readback-sort.test.mjs`
9/9; `node --test test/r0-shadow.serial.test.mjs` 7/7 after
`node scripts/r0-shadow-pin.mjs` (window.json: f03's row and the class
counts only).
## Final review of the first R0 shadow tranche: recorded items
- FX032: the author's G-erased ruling, item 5 (2026-10-23), classifies
FX032 as a defect (reject an unsupported operation-level `with` for now;
a separate compatibility fix). BACKLOG.md's FX032 row still reads "Open,
observation" and is pending correction, with C001, AS001, M001, STD001
and D001. Check: the row's status text changes to "Defect". FX032's
row was corrected on 2026-11-12 (dossier §18.186); the other rows'
corrections are still pending.
- Argued-unreachable live inconsistency (BACKLOG entry pending, not
fixed in this tranche): Features.Check.Record's `select` renders a bare
`Homeless` as "x is not a field" (`unselected`), while Require and
Reject treat it as a broken invariant. `Homeless` is made only inside
`FromMerge`, so no live program reaches the arm; R020 covers only
`Refused`. Check: when fixed, a test injects a bare `Homeless` into
`select`, Require and Reject and asserts one agreed treatment.
- Final-review fixes: the trusted surface `Valid` depends on is listed in
docs/engineering.md and AGENTS.md, each module carries a header marker,
and test/structure-trusted.test.mjs pins both; the Theorems import scan
accepts indented imports (defence in depth, not a guarantee); the
reachability test uses an explicit allowlist; RT1 asserts that no
generated variable has a `hole` path step.
## The CX refuter in shadow (2026-10-23)
Task 5.2 (T-R0a §5.1; AT17; CX questions 2 and 3), shadow only: no
acceptance change, nothing new reachable from compile but data
(below). `cxSpec` (src/Features/Check/Refute/Counter.purs) pairs an
untrusted search with the check of `CXChecked (withBody (toSig P)
body) rho` (refute/statements.md §4). Its obligation, `cxStatement` =
"CX-KP + CX-PR", is stated and unproved, so no `TheoremRef` exists,
`trustedRefuter` stays unused and the check mints nothing: the
Counter modules import no token module (checked: adding `import
Domain.Verdict.Internal (Refuted(..))` to Counter/Check.purs makes
`checkStructure()` return `["Features.Check.Refute.Counter.Check
imports Domain.Verdict.Internal"]`; clean, `[]`). Per the controller's
ruling it is registered as `shadowRefuter cxStatement cxSpec` in
Features.Check.Decide.Shadow's `shadowChecking` (the test-side shadow
assembly of Task 4.5), not in Program.Compile (R6; Task 4.6 wires).
**Components and sources (cited).** The check is a port, definition
by definition, of Lean's `substProblem` (Subst.lean), `decideCall`
with `pairsOf`, `patternSubst` and `freshAlloc` (Reduction.lean,
Unify/Decider.lean) and `decideClosed`/`unify` (Unify/Algo.lean:
Robinson with occurs check, Martelli-Montanari form); Lean proves
`decideCall_correct` for its definition, not for this port, which is
tested against a brute force (below). The search uses T-R0c §2's
single-label instances (Lemma SL), then shrinks a refuted sub-body by
one-at-a-time deletion (the final step of Zeller and Hildebrandt's
ddmin, 2002). New types: Domain.Verdict.Counter (`CXGround`,
`CXSubst`, `CheckedCX` with the body decision's pattern count,
`RefuteRefusal`, one constructor per conjunct), re-exported by
Domain.Verdict.Open so Domain.Verdict.Internal is unchanged; none is
a token. Program.Main now reaches Domain.Verdict.Counter (data only,
through Open), so test/r0-verdict.test.mjs's pinned list gained it.
**Readings (labelled).** (1) Budget: `keys` bounds the presence
patterns one search run enumerates; `fuel` and `depth` are not read
(Task 4.1's zero-fuel asymmetry unchanged). (2) Instances: rigid type
variables and `τ` are distinct fresh base atoms (`Sum.inr`); `R` has
at most two rows; labels are those written in `D` and in groups of at
most 200 nodes, then one unwritten (`z`, `z1`, …). (3) Seeding: a
written label a hint's text names in backticks comes first (the
review's fix round: first a bare substring test).
(4) A sub-body is every atom of an id (`withBody`; ids are not
unique). (5) Name clash avoided: `NoProjection`, `RigidUnbound`
(`Unprojectable` and `Unbound` exist elsewhere).
**Amendments after first runs (labelled).** (a) The search's whole-body
try first used only the groups touching `R`; b02 `use` and b04 `use`
(T-R0c §7.2: invalid) got no certificate, so each instance now also
tries all small groups. (b) b04's certificate (9 atoms) was beyond the
brute force's domain, so the search gained the ddmin shrink (6 atoms,
3 pairs). (c) The decider's oracle test first missed four satisfiable
problems in the brute force (a nested record no row field could hold;
a forceable variable enumerated first), so the brute force gained the
sub-body's closed values and a variable order; then 0 misses.
**TDD (checked).** RED, before the registration in `shadowChecking`
(the Counter modules built): `node --test test/r0-cx.test.mjs`, 0/5,
every test failing on the missing shadow record ("Cannot read
properties of undefined (reading 'result')", AT17's attempt count
"1 !== 2"). GREEN after it: 5/5 (6/6 with the seeding test, added
later and shown by mutant M12). The check's and the decider's tests
were written after their code; their evidence is the mutants below.
**Probes (checked; test/r0-cx.test.mjs).** Every probe declaration
that resolves (d02, d03 are Resolve refusals) gets exactly one CX
shadow record. Twelve carry a certificate, each re-evaluated by the
independent bounded brute force (test/r0-cx-support.mjs: `D` exactly
under `ρ`; no flexible solution of the sub-body within the bound):
| Declaration | `ρ` | Atoms | Pairs | Patterns |
|---|---|---|---|---|
| a01-clash-ground#f | none | 1 | 0 | 1 |
| a02-clash-rigid#f | `a ↦ #1` | 1 | 0 | 1 |
| a03-occurs-type#main | none | 1 | 0 | 1 |
| a04-occurs-row#main | none | 4 | 1 | 2 |
| a05-record-homeless#f | `r ↦ {}` | 1 | 0 | 1 |
| b01-overlap-pair#main | none | 3 | 2 | 4 |
| b02-mayhold-forced#use | `r ↦ { b: #0 }` | 3 | 2 | 4 |
| b04-share-meta-only#use | `s ↦ { b: #0 }` | 6 | 3 | 8 |
| d01-extend-duplicate#f | `r ↦ {}` | 2 | 1 | 2 |
| e01-pattern-rigid-field#f | `r ↦ {}` | 1 | 2 | 4 |
| e02-pattern-order-ab#main | none | 2 | 2 | 4 |
| e03-pattern-order-ba#main | none | 2 | 2 | 4 |
These are §7.2's invalid probes plus a01, a03 and the flexible-only
pattern probes; the rows agree with §7.2's counter-instances (b02,
b04: `0 ↦ { b: … }`). b03 `use` and c01 `route`, valid in §7.2's
bounded model, get `NoCounterInstance` (asserted). f01-f05 get none:
their refusals are `cmp`/`pr` atoms, which `toSig` drops. AT17 on the
probes: verdict, the other attempts and search faults equal the run
with `shadows: []` (asserted).
**CX question 2 (checked; test/r0-cx-corpus.serial.test.mjs).** Every
corpus `D` is scoped: of 3,011 declarations that generate (no
generation fault), all 3,011 project, 444 have a non-empty `D` (1,393
atoms), and none mentions a variable outside its sort's rigid list.
So `CXChecked` needs no values for flexible variables on this corpus.
**CX question 3 (checked; test/r0-cx-cost.serial.test.mjs).** Deciding
the body false enumerates all 2^pairs patterns (asserted: patterns =
2^pairs for each certificate). Probe checks: 0-3 pairs, 1-8 patterns,
medians 0.017-0.162 ms (21 runs). The corpus's widest certificate,
finite-base-followup/generic.wxw `route`: 13 pairs, 8,192 patterns,
about 220 ms. Corpus scratch run (observed, not pinned): the
unseeded search over all 3,011 declarations took 5.0 s in all (max
255 ms), the 72 checks 0.49 s. Argued: with the shrink, a check's cost
is that of its certificate's own sub-body, and on this corpus that
stays at 13 pairs or fewer; whether a certificate should carry more
(question 3's alternative) is not forced by this evidence.
**Corpus certificates (checked; same serial test).** 72 declarations
get a certificate the check accepts; none is a declaration today's
checker accepts. 65 re-evaluate true by the brute force at 200,000
assignments; 7 pass that bound (listed in the test; no claim either
way).
**AT17 window re-run (checked).** `node --test
test/r0-shadow.serial.test.mjs` with `shadows: [cx]`: 7/7, window.json
unchanged (no class moved), 103 s.
**Decider against the brute force (checked;
test/r0-cx-decide.test.mjs).** 600 seeded problems (seed 20261023;
two labels, three type and two row variables, the grammar fixed in
the test): 212 solved by both, 388 refuted by both, 0 where only
`decideCall` says satisfiable (after amendment (c)); asserted, so a
change fails.
**Mutants (checked; each restored).** Patched in place, `node
scripts/build.mjs`, then `node --test test/r0-cx.test.mjs
test/r0-cx-check.test.mjs test/r0-cx-decide.test.mjs`:
| Mutant (file: patch) | Failing tests |
|---|---|
| M1 Check: `scoped whole` → `const (pure unit) (…)` | each refusal is reached by breaking its conjunct |
| M2 Check: `distinctKeys (map fst bindings.ty)` skipped | each refusal … |
| M3 Check: row keys' `rigidIn` skipped | each refusal … |
| M4 Check: type keys' `boundIn` skipped | each refusal … |
| M5 Check: `traverse_ groundTy` skipped | each refusal … |
| M6 Check: `hypothesis rho whole` skipped | each refusal … |
| M7 Check: `if not decided.satisfiable` | a certificate meeting every conjunct is accepted; each probe certificate re-evaluates true; each refusal … |
| M8 Check: `traverse_ (inBody sig)` skipped | each refusal … |
| M9 Unify: occurs test `&& false` | decideCall says satisfiable wherever the brute force solves; each probe certificate re-evaluates true |
| M10 Term: `distinct … \|\| true` in `wfT` | the decider test; each probe certificate …; each refusal … |
| M11 Decide: `successor` always `Nothing` | a refuted problem tries all 2^pairs patterns; the decider test; each probe certificate …; no certificate where the bounded oracle finds the probe valid |
| M12 Search: hint order ignored | a hint seeds the search with its labels |
| N1 Check: `distinctKeys (map fst bindings.row)` skipped | each key conjunct is checked on types and on rows |
| N2 Check: type keys' `rigidIn whole.rigidTy` skipped | each key conjunct … |
| N3 Check: row `boundIn … whole.rigidRow` skipped | each key conjunct … |
| N4 Check: `traverse_ groundRow` skipped | each key conjunct … |
Fix round (the task review, item 1): M1-M8 covered one case per
refusal constructor, not per conjunct; the first version of this
section overstated that. Each key and groundness conjunct has a type
half and a row half, and N1-N4 (the other halves) survived every test
(checked: in a scratch copy with the earlier test/r0-cx-check.test.mjs,
each N exits 0 with no failing test). Four cases were added (a
duplicated row key, a rigid row bound as a type, an unbound rigid row,
a row binding with a repeated label); with them each N fails as shown
(scratch copy, `node scripts/build.mjs` then the three test files; the
restored copy passes). M12 was re-run after seeding became a
backticked match: it still fails the seeding test, whose new case
shows a bare `b` in a hint does not seed.
Regression row `r0-cx-hypothesis-skipped` (M6's defect;
scripts/regression-r0-cx.mjs, probe test/regression-r0-cx.mjs):
`node scripts/regression.mjs r0-cx-hypothesis-skipped`, "fixed
compiler passes; restored defect fails".
**Changed expectations.** The assembly's decisions now end with one
`Shadow` attempt: test/r0-online.test.mjs (four expectations) and
test/r0-readback.test.mjs (one) gained `'Shadow Left'`; no verdict
changed. No fixture or diagnostic changed; no corpus re-pin.
## D1's generation continuation, part a (2026-10-23)
R0 Task 7.1a (the controller split Task 7.1 on 2026-10-23: 7.1a is
D1's types, `seal`, `elaborate`, the import rules and the hole move;
7.1b ports the generator and runs the corpus-wide tests). Shadow only,
ruling R6: nothing reachable from compile calls the new code, and
`generate` still returns the recorded problem as before. The spec is
docs/plans/r0-generation-continuation.md ("D1").
**Effect rows: §12.1's fallback, not E-a (controller ruling,
provisional).** Task 4.4's witness holds `Inline RTExpr`, and `RTExpr`
erases every effect row, so E-a's values have no binding form and rows
nested in images cannot be written. Task 7.1a lands the fallback:
images come back with closed, empty rows (Generate.Elab.Image), a
handle in an effect-row tail fails the seal check (`SortClash`), and
7.1b's T2 and T8 will compare effect-erased projections. The options
for the author are in docs/plans/r0-ea-representation.md. G-D1's
policy point is settled; its representation is open, and Task 4.6
stays blocked.
**Labelled amendments to the spec (each in its module's header).**
1. Generation fault (ruling on Q3): `Gen` carries Task 3.2's
`GenerationFault`; `seal` returns `Either GenerationFault
(Elaborating a)`; `lifted` lifts a rule's fault.
2. `seal` takes a header (the declaration's id and the program's holder
set), which the recorded problem carries and the parts do not.
3. `fresh` takes the variable's sort and its T-R0b stored position;
`rigid` writes a signature variable; `emit` takes the rule's `At`
and each entry's row, kind and span (Task 3.2's origins), with
generator-side entry types `GenAtom`, `GenReq`, `GenSite`.
4. `ElabFault` has a fifth constructor, `ImageVariable v w`: an
`RTExpr` image may name a problem variable, which W's `Ty Open`
could not. No Cov clause excludes it (an owner question in the
representation note).
5. Step 5 of `elaborate` (a `Named` binding) has no arm: Task 4.4's
witness has no `Named` constructor and an uninhabited `NameEntry`.
6. `judgedDecision` beside `decide` mints the `Judged`; `decide`'s type
is unchanged, so Task 4.5's harness and tests stay as they are.
7. Rule E3 closes Generate.Inputs and Generate.Fault to the driver, so
Features.Check.Generate defines `generationInputs`,
`generationProblem` and `staticRules` and re-exports `Inputs` and
`GenerationFault` by name (E6's stated exception, widened);
Domain.Recorded re-exports its Internal types under their own alias.
8. Generate.Elab.Internal is not a token module: every client of `Elab`
or `Gen` imports its instance dictionaries' JS. E4 and E6 guard it.
9. The problem-identity step compares `fields`, since the problem's
`Eq` instance lives in Domain.Recorded.Internal, a token module.
10. `ClauseParamType` (spec §12.2) is deferred to 7.1b, where a rule
first writes that site.
**Tests (checked: each file passes in the verify recorded below).**
test/r0-elab-seal.test.mjs (T3a, one case per `SealFault`; St; Mint;
`positionsOf`), test/r0-elab-props.test.mjs (T4a Tr, T4b Def, T9 laws,
300 and 100 seeds; grammar fixed in test/r0-elab-terms.mjs before the
first run), test/r0-elaborate.test.mjs (T6, T7, T11, T11b),
test/r0-judged.test.mjs, test/r0-elab-rules.test.mjs (E1-E6, S10,
the pinned export lists, T10), test/r0-elab-scope.serial.test.mjs
(T3c: eight fixtures each fail with a pinned error class and phrase,
two controls compile; one purs run against a copy of output/). The
fixtures are kept as `*.purs.txt` and copied in as `.purs` for the run:
spago builds every `test/**/*.purs`, and the first verify of this task
failed at the build on exactly these modules (labelled deviation from
the spec's `*.purs`; the serial test applies the style check itself).
Not yet: T1, T2, T5, T5b, T8's corpus half (renumbering a body by
`holes`), T12 (7.1b), and T3a's
harness half (the driver has no `Elaborating` until 7.1b). T3c (vi)
covers `seal`; `generateIn` exists from 7.1b.
**TDD (checked).** RED runs:
- test/r0-elab-seal.test.mjs against a stub `untracked = const []`:
6 of 9 fail (UntrackedRead, SortClash, AuxiliarySite, RigidSiteRead,
DuplicateFresh, DuplicateSite). Produced after the implementation
against the stub, labelled as such.
- test/r0-elaborate.test.mjs and test/r0-elab-rules.test.mjs before
their modules existed: ERR_MODULE_NOT_FOUND; and before the tables
changed, `graphFindings` gave `[]` for E1 (Decide → Build), E3
(Function → Generate.Elab), E5 (Recorded → Judged.Internal) and S10.
- test/r0-judged.test.mjs: `Decide.judgedDecision is not a function`.
- One defect caught before commit: `elaborate` first passed `const
(built …)` to `either`, which PureScript evaluates eagerly, so
`build` ran on a witness Cov refused; mutant M1 restores it.
**Mutants (checked, an isolated copy in the session scratchpad; each
patch applied alone, purs compile, then the named tests).**
| Mutant | Patch | Failing tests |
|---|---|---|
| M1 | `either NotCompiled (const (built elaborating witness unit))` | T7: seal faults, NoWitness and Cov stop before build |
| M2 | `Apply (Elab s)` keeps `left.uses` | T4a, T4b, T9, and four seal tests |
| M4 | `sameSort`'s last arm `true` | SortClash |
| M5 | E3's entry deleted from structure-modules.mjs | E3 |
| M6 | `bareTypes` always true | E6 |
| M7 | Generate.Elab.Labels imports Features.Check.Scheme (State) | T10 |
| M8 | `covDomain`'s guard `true` | T6 |
| M9 | `repeatedLabel` always `Nothing` | T7: build faults arise from real reads too |
| M10 | `positioned` at `RigidName` reads through `elabTy` | RigidSiteRead |
| M11 | `judgedDecision` gives `Nothing` for Solved | the Solved pairing |
Numbering: M3 is not used (the stub RED run above stood in for it).
**Regression rows (checked: `node scripts/regression.mjs` with the
five names and r0-cov-skipped, 6 of 6, jobs 6).** r0-elab-untracked-read
(readRow records no use), r0-elab-free-not-hole (`Free` read as
`TInt`), r0-elab-fault-continues (a build fault becomes `NotCompiled`),
r0-elab-wrong-problem (the identity guard `false`),
r0-elab-phantom-role (both role annotations removed; the coerce
fixtures compile). r0-cov-skipped's needle follows `coverage`'s new
domain argument.
**Unchanged (checked by verify, no re-pin).** No pin under
test/fixtures/r0 changed: RT1, RT8 (rt8.json), the window
(window.json), census.json, the corpus manifest and the canonical
generator tests all pass as pinned. Cov's domain is unchanged while
`Recon` is empty (`flexDomain`, the same set in the same order).
**Fix round 1 (the 7.1a review: three Important, minors).**
- *E6 skipped modules whose header comment says " where" (checked).*
`reexportSourceFindings` cut the head at the first " where" and then
dropped the first `module` match, so nine src modules, among them
Domain.Elaborating and Refute.Theorems, were never examined. Now
`declarationOf` takes the declaration from `module` to its own
`where`, and only the export list is searched. RED: with a stub
`declarationOf`, "E6 reads past a header comment that says where"
failed; GREEN 11/11. A test asserts the declaration is found in every
src file; mutant M15 (the old cut) fails that case.
- *T7's seal-fault case was vacuous (checked).* The spied value now has
the seal fault itself (`a` minted twice: DuplicateFresh) and its
`build` count is asserted 0. Mutants: M1 (eager build) fails the
test, through its Cov case; M12 (the seal guard skipped) fails it,
and with the spy the seal-fault case now fails on the call count too.
- *T8's unit half (checked).* test/r0-elab-seal.test.mjs: `Free i`
reads as `Hole i` at a type position and as a record tail; two
bindings `Free 5` give one hole, `Free 2` another. M13 (`Free` read as
`TInt`) and M14 (every `Free` as `Hole 0`) fail it.
- Minors: DuplicateSite counts by site, not path (argued: pattern
paths never equal expression paths), commented in Generate.Elab;
Features.Check.Walk joins T10's helper list; the T3c file says why it
is serial; M3's gap noted.
- *Controller ruling:* amendment 7 (E6's widened exceptions and the
widened Generate and Generate.Gen pins) is acknowledged.
- *Carry to 7.1b:* an `ImageVariable` check, a property that the
images `substitutionWitness` produces mention only hole and rigid
variables (or T1's corpus count of 0), since no Cov clause excludes
them and §8.1's "none rests on an untrusted search" does not yet hold
for that fault.
**Verify (checked).** `npm run verify` at the task's last code
commit, one run under the cross-worktree lock: EXIT 0; parallel tests
2,825/2,825, serial 114/114, regression proofs 204 of 204 (jobs 6).
`git diff --stat 83279ed HEAD -- test/fixtures/r0/*.json` is empty.
After fix round 1 and the rebase onto r0-t2-cx (f21282c, which holds
the tranche tip 8752aa5), one more run under the lock at 3bcc765:
EXIT 0; parallel 2,845/2,845, serial 120/120, regression proofs 205 of
205 (jobs 6). The rebase's conflicts (Decide/Shadow.purs imports, the
regression row and probe lists, findings and progress) were resolved
as a union; test/r0-verdict.test.mjs needed no allowlist entry, and
the trusted-surface re-pin was unchanged.
**Carries to 7.1b.** test/r0-generate-signature.test.mjs asserts that
no module in the closure of Features.Check.Generate depends on
Domain.Checked; the port must replace that with T10 once `generate`
builds checked IR. A `where`-bound helper without a signature is not
generalized, so passing `map read (fresh m)` to `seal` fails with
EscapedSkolem (seen while writing T3c's control); rule helpers need
`∀ s.` signatures.
## R021: a triangular unifier for the `BQ` detectors (2026-10-24)
Shadow only: Features.Check.Entailed.Mgu is read by `openRequirements`,
`g0Guard` and the online read-back, none reachable from compile. No
fixture, pin or diagnostic changed; no corpus re-pin.
**Cause (checked).** The eager unifier applied each binding to every
remaining equation and to every image of θ (Mgu.purs, `eliminated`).
Two further costs showed up once that was gone, each seen in a scratch
build: R2 took an arrow apart one parameter at a time, so an
n-parameter spine posed n rest equations of falling size, each read
again; and `maybe (Done (solved …))` evaluated the back-substitution
on every step, since PureScript is strict (now `maybe'`).
**What changed.** θ is kept in triangular form, Baader and Snyder's
dag solved form ("Unification Theory", Handbook of Automated Reasoning,
2001): bindings in order, none mentioning its own or an earlier
variable. The new trusted module Features.Check.Entailed.Triangular
reads a type through θ when the unifier takes it (`read`), and returns
the back-substitution as the answer (`solved`). Every image a read
resolves is replaced by its resolved form, path compression as in
union-find (Tarjan 1975). R2 on two arrows poses every shared
parameter's equation, then the two remaining tails, at once
(Martelli-Montanari's decomposition of an n-ary symbol); the order of
the equations posed is the binary steps' order. `mentioned` (Mentions)
lists the variables `mentions` tests, so the reads stay inside the
trusted surface; it is not Domain.Recorded.Vars. The composition of
the dag solved form, compression on read and spine-wide R2 is this
task's; each part is published.
**Same answers (argued, then checked).** *Amended 2026-10-24 by fix
round 1 (token review I-1, I-2): the claim needs well-sortedness, and
the check is now committed; see "R021 fix round 1" below.* Argued: the
inputs are in the fragment (both callers check `fragment` first), so
every record has at most one tail and no repeated label, and every
image `binding` makes keeps that. For such terms, applying the
bindings one at a time gives the same term, field order included, as
applying their composition once. A `substitute` of a term that mentions no bound
variable returns it unchanged. Checked: a differential run against
be4df16's compiled Mgu (copied into output/ as a scratch module,
removed afterwards; script in the session scratchpad): every G-EG
one-equation problem, the pinned 2,000 two-equation sample and 20,000
four-equation problems (seed 7), then every declaration of the pinned
corpus (984 of 1,128 programs reach generation; 3,011 declarations)
and `main` of `generic(50/250/1000)`. 17,585 fragment problems, 4,404
of them with a unifier: 0 differ (`Map` entries compared by
constructor-tagged serialization). The 15,529 sampled problems outside
the fragment also agreed (0 differ), though no caller passes them.
**Timing (checked).** `openRequirements` on `main`'s problem of
`generic(n)`, ms, under the cross-worktree lock (load average 2.5
before, 1.7 after). Command: the script of "The census" above with
`n` in 250, 500, 1000, 2000, run as `node timing.mjs 250
500 1000 2000`:
| n | `B` atoms | before (be4df16) | after |
| --- | --- | --- | --- |
| 250 | 468 | 208 | 25 |
| 500 | 925 | 984 | 31 |
| 1,000 | 1,843 | 5,648 | 75 |
| 2,000 | 3,675 | 33,602 | 211 |
A second after-run gave 25, 31, 73 and 213. The remaining growth,
about ×2.8 from 1,000 to 2,000, is argued to be Features.Check.Spine's
`snoc` loop, quadratic in an arrow's length (not changed here).
**Scaling test, RED then GREEN (checked).**
test/r0-mgu-scale.serial.test.mjs bounds `openRequirements` and
`g0Guard` on `generic(1000)` at 1,000 ms each. Before the change:
`took 5505 ms` and `took 10970 ms` (fail); again with be4df16's
compiled Mgu restored in place: `took 5625 ms`, `took 11129 ms`. This
confirms that `g0Guard` takes about twice as long. After: 191 ms and
204 ms (pass).
**Mutants (checked).** Each was applied to the source and built
(build success confirmed), then run against test/r0-entailed,
r0-g0, r0-g0-atoms, r0-g0-check, r0-readback, r0-rt7, the EG-oracle
and the new test/r0-mgu.test.mjs:
- M1, occurs check dropped (`mentions … && false`): caught only by the
new r0-mgu tests (the occurs test and the idempotent-unifier
property). No earlier test caught it: `entailedGround` answers
`Nothing` for a non-ground image either way.
- M2, a lost binding (`extend` returns θ unchanged): 18 failures,
among them EG-oracle, the hand list, AT19 and r0-mgu.
- M3, `reachable` stops after one layer: caught by r0-mgu's
three-deep chain (`r ↦ {a: x | s}`, `s ↦ {b: y}`, `y = Int`, then a
contradiction through `r`). It was not caught before that test was
added.
- M4, back-substitution earliest place first: 7 failures (hand list,
r0-mgu).
- M5, the spine-wide R2 drops the remaining tails' equation: caught by
r0-mgu's idempotent-unifier property.
test/r0-mgu.test.mjs passes on be4df16's compiled Mgu too, so it
specifies the unifier rather than the new code. Its property compares
the sides up to field and tail order, because a unifier makes two
records equal as rows, and filters G-EG to the fragment.
## The census type walk fails closed (2026-10-24)
From the final whole-tranche review. test/r0-census-walk.mjs `parts`
returned "no parts" for any `Ty` it did not handle, so a new type
constructor would read as holding no record, variable or row, and the
erased-row detector and the census would undercount without a sign.
The leaves `TInt`, `TBool`, `TVar`, `TUnit` and `TText` are now listed
(Domain.Type.Core's `Ty`); anything else throws `not a Ty`, as the
expression and pattern walks do. RED (checked): the new test in
test/r0-census-detectors.test.mjs failed with `Missing expected
exception` before the change; it passes after, with every leaf injected
directly. Census pin unchanged (test/r0-census.serial.test.mjs, 13/13,
"the census equals its pinned counts" included). Test-only; no source
changed.
## R025: RT8 and the window share one run (2026-10-24)
Test-only. test/r0-rt8.serial.test.mjs and test/r0-shadow.serial.test.mjs
each decided the whole corpus in their own `node --test` process.
test/r0-shadow.serial.test.mjs is now the one serial file: `shadowRun`
(test/r0-shadow-run.mjs) runs `declarationsOf` once per program of
RT8's sources, keeps those rows for RT8 and builds the window's
programs from the same rows (then the defect probes, as before). The
assertions moved unchanged into registration modules,
test/r0-rt8-checks.mjs (`rt8Checks`) and test/r0-shadow-checks.mjs
(`windowChecks`), with their test names and failure messages; the old
RT8 file is removed. The pin scripts are unchanged. `windowPrograms`
reads `shadowRun`.
**Checked.**
- All 12 tests pass in one process.
- With rt8.json's `declarations` and one window row's
`programCompiles` altered, exactly "RT8: the classes equal their
pinned counts" and "the window equals its pinned table" failed, each
with its own "is stale; re-pin with …" message. The fixtures were
restored afterwards.
- `node scripts/r0-shadow-pin.mjs` and `node scripts/r0-rt8-pin.mjs`
rewrite both pins byte for byte (3,021 window declarations, 1,024
rows; 3,017 RT8 declarations, 0 defects).
**Serial time (checked).** Measured under the cross-worktree lock,
after R021's unifier (commit 4030fc5), alternating the two layouts.
"Before" means the two old files run together with
`--test-concurrency=1`, restored temporarily from 07c65fd:
| run | before (two files) | after (one file) |
| --- | --- | --- |
| 1 | 105.2 s | 61.6 s |
| 2 | 107.3 s | 57.3 s |
A first after-run gave 54.7 s. The task 4.5 figures (about 84 s and
93 s) predate R021's fix.
**Verify for the three hardening items (checked).** `npm run verify`
at aeec4f2, the pre-amend commit of 422d80b (the amend added only
this paragraph; R021, the census walk and R025), one run under the
cross-worktree lock: EXIT 0 in 988 s; parallel tests 2,849/2,849,
serial 122/122, regression proofs 205 of 205 (jobs 6).
## R021 fix round 1: well-sortedness and a committed oracle (2026-10-24)
The token review of the R021 change raised three items. Each fix
touches the trusted surface (Triangular, and Mgu's header).
**I-1 (checked).** `extend` took `Map.size θ` as the new binding's
place. If a variable is bound again, `Map.insert` overwrites it and
the size does not grow, so the next binding repeats a place.
`solved` then breaks the tie by key order, and the answer loses
idempotence. The review's case shows it:
`[ρ = Int, x = y, {|ρ} = {a: z | σ}, z = Bool]`, where `ρ` is both a
type and a tail, which `fragment` does not rule out. The old answer
was `ρ ↦ {a: Bool | σ}`; the new one was `ρ ↦ {a: z | σ}`. Triangular
now keeps a monotone `next` place, and the case gives the eager
answer. RED: test/r0-mgu.test.mjs "a variable bound again takes a
later place" failed (falsy image assertion) before the counter and
passes after.
**Precondition (checked).** The counter does not make the two
algorithms agree on every ill-sorted problem. A variable bound as a
type (say `v = Bool`) and later again as a tail is read at its later
binding wherever it occurs as a type. The eager algorithm had already
substituted `Bool` there. One differing problem:
`[{|s} = {b: w | u}, v = Bool, {|v} = {a: Box(Int) | s}, u = v]`.
Eager answers `Just`; triangular answers `Nothing` by the occurs
check. Equality is therefore claimed for well-sorted problems (no
variable both a type and a tail) and for the review's case.
*Amended by fix round 2:* ill-sorted answers are NOT safe-direction
(re-review cases A1 and A2 below), and the citation of
Generate/Assemble.purs does not establish well-sortedness; a guard now
enforces it. Both
callers' problems come from generation. That generation keeps sorts
apart is no longer argued from Generate/Assemble.purs; it is checked
on the corpus (test/r0-shadow.serial.test.mjs: no generated problem is
ill-sorted, equations and `BQ` atoms; reworded after hardening
re-review 2, m-6). The claim is stated in Mgu's header and amended into
docs/plans/r0-entailed-ground.md "Binding" (I-3).
**I-2 (checked).** test/r0-mgu-eager.mjs ports be4df16's eager
unifier line for line onto the compiled `substitute`, `mentions` and
`isRigid`. test/r0-mgu-eager.test.mjs compares it with `mgu`, using
constructor-tagged serialization of θ, over:
- the review's case;
- every G-EG one-equation problem and the pinned two-equation sample;
- 40,000 problems from a seeded generator (mulberry32, seed 2026):
2-6 equations each; arrow spines of 1-4 parameters; `Box`; records
with labels a/b/c and an optional tail; 30% chained-row equations
`{|ρ} = {l: T | ρ′}`; four more type variables and three more row
variables; rigid variables; and about 5% ill-sorted uses.
Result: 35,104 well-sorted fragment problems, 6,385 with a unifier, 0
differences (asserted). 12,368 ill-sorted problems, of which 10
differ (counted, not asserted). 2,629 problems were outside the
fragment and skipped. Run time is about 1.8 s, in the parallel phase.
Mutants against the differential: with `place` from `Map.size` again,
1 well-sorted-set difference (the review's case) plus the I-1 test;
with `reachable` stopping after one layer, 51 differences plus the
chain test.
**Minors.**
- The scale test's bound is raised to 2,500 ms. That is about 12
times the new time and under half the old times (5,505 and
10,970 ms).
- r0-mgu.test.mjs gains a spine-arity test: `a→b→c = Int→d`,
`d = Bool→a`, and a variable at a spine's tail.
- The verify paragraph above now names its commit correctly.
- Mgu's header names its callers.
## R021 fix round 2: the well-sortedness guard (2026-10-24)
The token re-review (B-1) put the 10 differing ill-sorted problems
through the production detectors. Three gave unsafe readings, so an
ill-sorted problem's answer is not safe-direction from either
unifier, and NoUnifier is not safe either (Open and Guard read the
recorded type). Minimal cases:
- A1, `[x = y, y = {c: Bool | s}, {|x} = {c: z | r}]` with atom
`pr z`: triangular `entailedGround` gave Just Bool, eager Nothing.
- A2, `[y = Box(x), x = p, {|x} = {a: Int | r}]` with atom `cmp y`:
eager reduced `y` to `Box(p)` (Open), triangular to
`Box({a: Int | r})` (Holds), so `openRequirements` under-reported and
`g0Guard` admitted.
Assemble.purs:47-50 only splits `vars` by declared sort, so it does
not establish the precondition.
**Fix (trusted surface: Features.Check.Entailed).** `wellSorted`
(exported beside `fragment`) is false when a variable is both a `TVar`
and a tail across the equations. `reduction`'s `inFragment` requires
it, so an ill-sorted problem is OutsideFragment and `g0Guard` declines
its non-ground atoms. The read-back's completion (ReadBack
`completing`) requires it too and reads such a problem as `Heuristic`.
**Checked.**
- test/r0-entailed.test.mjs: fixtures A1 and A2 expect `wellSorted`
false, OutsideFragment, `entailedGround` Nothing and `g0Guard`
OutOfScope, plus a `wellSorted` unit test. RED: written after the
guard in the same session, then shown failing with the guard
disabled (`|| true`, rebuilt): both fixtures failed. GREEN with the
guard.
- test/r0-mgu-eager.test.mjs now asserts that every ill-sorted
fragment problem is refused (`reduction` gives OutsideFragment;
0 admitted), that production `wellSorted` agrees with the test's own
predicate on every problem, and 0 differences on well-sorted ones.
The review's I-1 case is ill-sorted, so it is refused, and its
unifier answer is asserted equal separately. The place counter it
tests matters only off the precondition, since a well-sorted problem
never binds a variable twice, so the place mutant is caught only by
that case. Counts: well-sorted 35,103 (6,384 answered), ill-sorted
12,369 (10 differ, all refused), outside 2,629.
- test/r0-shadow.serial.test.mjs: the guard fires on none of the 3,017
generated problems of RT8's run (asserted). RT8 and window pins are
unchanged (13/13); the census is unchanged in verify.
## D1's generation continuation, part b (2026-10-24)
R0 Task 7.1b: Task 3.2's generator ported onto D1's `Gen` and `Elab`
(S6), and the corpus-wide tests (S8). Shadow only, ruling R6: nothing
reachable from compile calls the new code, and `build` runs only in
tests. S7 (E-a) is not here; it waits for the author's representation
decision (docs/plans/r0-ea-representation.md). The spec is
docs/plans/r0-generation-continuation.md ("D1").
**What landed.** `generate ∷ Tables → Signatures → FunctionDecl →
Either GenerationFault (Elaborating Checked.FunctionDecl)` is `seal` of
`generateIn` (Generate.Body). Every rule runs in `Gen s` over `GenTy s`
and returns its type, its checked node as an `Elab` and its entries.
New modules: Generate.Block, .Body, .Callee, .Node, .Update;
Generate.Rigid folded into .Signature. The recorded problem is `problem
<<< generate`. Callers changed with it: Decide.Shadow and
Strategy.Online (trusted surface; token review: both only take
`problem` of the result, and Shadow adds the seal check below), and
the JS tests through `generatedOrThrow` (which now takes `problem`) or
`rightOrThrow` (for `staticRules`).
**Entry order (checked).** Variables and sites are keyed maps, but the
entry arrays keep their recorded order (canonical bytes, RT3). Task
3.2 wrote a parent's entries before its children's, though they
mention the children's types. So each rule returns its entries as a
`Gen s Unit` not yet bound, and the parent sequences its own before its
children's; the declaration's are bound before the body's. This uses
only the existing primitives, so it is no amendment. Check:
test/r0-problem-pin.serial.test.mjs pins a digest of every corpus
problem's canonical bytes, taken from Task 3.2's generator before the
port (commit 4decfe6). RED: the first port run failed it, "161
programs' problems moved": E17 shared E5's typing, and its argument
equations were written at row F1, where Task 3.2 writes B1. Fixed by
giving `applied` the row; GREEN: 0 of 3,011 problems differ from a
full dump of the old generator's problems (scratch diff, deleted).
RT1, RT8 (rt8.json), the window (window.json) and the census
(census.json) pass as pinned in the verify below. No pin moved.
**Labelled amendments and choices (each in its module's header).**
1. `ClauseParamType p c k` joins `CheckedName` (spec §12.2's proposal;
7.1a amendment 10's deferral): a site of `build`'s reads, the stored
position of no variable; its seal arms give no fault, the read-back
refuses it as a position, the canonical decoder reads it.
2. Two generation faults, both input Resolve never gives
(`InputShape`): `BinderShape`, a fail clause with no binder (the
checked clause needs one; Resolve/HandlerExpression.purs:116-121
always writes it), and `VariableSort`, an occurrence's naming with
no handle for an effect-row variable in a type or tail position.
Task 3.2's generator wrote a variable no `fresh` declared there.
3. §12.1's fallback, exactly: under `θ` every effect row is the closed
empty row (a row's count is kept, so `app` stays `app`), so no
handle stands in an effect row; arrows generation builds, `show`'s
and `crash`'s rows and `main`'s open tail are closed; written rows
under `ν_f` and `print`'s `Console` are kept. T2 and T8 compare
effect-erased projections.
4. An over-applied call's saturated node `Apply (Call g θ a₁…aₙ) […]`
has no site; its type is B1's `τ_{e_{n+1}} → … → ⟨p, res⟩`, built
from values already read (the arguments' and the node's), which the
witness makes equal to `θ(R)`. A rule's node takes its own read type
for this (`Ruled.node ∷ Elab s (Ty Open → Node)`).
5. A builtin call of other than one argument (refused by today's
checker and the static rule, so no witness exists) builds `Apply` of
the unit value to its arguments, only so `generate` stays total.
6. `shadowDecision` (Decide.Shadow): generation, the seal check, then
`decide`, with the generator injected; `shadowDecisions` uses it
(T3a's harness half; spec §3.5's "the driver also runs step 1 right
after `generate`").
7. Instantiation slots: the checked instantiation holds no effect-row
slot (Check/DeclarationUse.purs `typeArgument`), so slot `i` is the
`i`th non-row variable; it is the `VarId` only when effect rows come
last. Checked: 0 of 3,011 corpus functions and 0 declared types put a
row variable before another; a probe writing `e` before `a` still
resolves to `a`, then `e`. T5 checks every slot position.
**Tests (checked: each passes in the verify below).**
- T1 (EL1), test/r0-elab-corpus.serial.test.mjs: 1,989 declarations
`decide` (the shadow `Checking`, its search observed, no shadow
refuter) judges Solved; all 1,989 are `Witnessed` and `elaborate`
gives `Elaborated`. Sc on the corpus: 0 seal faults in 3,011.
- T2, effect-erased (named so), same file: at all 1,989 Solved
verdicts `elaborate`'s IR equals the certificate's `checked`, 1,944
exactly and 45 by site (153 sites compared, 159 excluded as `Amb`);
beyond EL1, at 781 more certificates whose witness Cov accepts though
a marker blocks the verdict, `build`'s IR equals it, all exactly.
test/r0-elab-build.test.mjs runs the same comparison on eight small
programs, one rule group each, with every named declaration
compared. The projection (test/r0-elab-erase.mjs) keeps structure,
drops effect rows, data-type row arguments, handler marks and handler
`clauses` (row arguments and `clauses` named 2026-10-24, review
P2-4), sorts record fields, and
renumbers holes by first occurrence: canonical under renaming, the
equivalence `holes` gives (argued).
- T8's corpus half: 118 hole-bearing declarations project equal; and,
since the projection cannot see it, `build`'s body is a fixed point of
`holes` in each.
- `ImageVariable` (7.1a's carry): 14,775 `Inline` images of the judged
witnesses mention only rigid and hole variables (count of others: 0).
- T5, test/r0-elab-positions.serial.test.mjs: 52,357 flexible
variables; disagreements only §12.2's two, by name: E28's `⟨p, rest⟩`
(666, stored `Auxiliary`, read at `NodeType p`) and P4's `⟨p, inst
i⟩` (1,843, stored `Slot p i`, read only in sub-pattern types).
- T5b: 47,156 requested variables each bound to a marker of its own;
each lands exactly at the sites `positionsOf` names (an over-applied
saturated node and the static types are not sites; labelled).
- T12: site-table entries ParamType 764, ClauseParamType 240, RestType
420, LambdaBody 1 (the corpus has no bare `crash`; one inline probe
outside the pinned corpus adds it), RigidName 0; each of §3.3's
shape.
- T3a's harness half, test/r0-elab-driver.test.mjs: one value per
`SealFault`, injected as the generator: `shadowDecision` is
`BrokenInvariant` and a stub strategy is never searched; `elaborate`
is `Broken` and `build`'s `run` never called. A clean control reaches
`decide` once.
- T3c (vi): `CheatBody` (`generateIn` from Features.Check.Generate
alone) fails with UnknownName; control `Reached` (through
Generate.Body, which only rule E3 forbids) compiles.
- Faults: test/r0-generate-faults.test.mjs injects `BinderShape` and
`VariableSort`; test/r0-online-faults.test.mjs routes both to a stop.
- 7.1a's carry: test/r0-generate-signature.test.mjs no longer asserts
that no Generate* module imports Domain.Checked; it pins the
generator's closure (now with Holes, Spine and Walk), and T10 checks
the same allowlist from every Generate* module.
**TDD (checked).** The tests were written against the port, so their
RED is the restored defects below, except the problem pin (RED above).
`shadowDecision`, the two faults and `ClauseParamType` did not exist
before their tests (`not a function`, no such constructor).
**Mutants (checked, an isolated scratch copy; each patch alone, purs
build, then the named tests).**
| Mutant | Patch | Failing tests |
|---|---|---|
| N1 | every node typed `Int` (Expr) | build test, several groups |
| N2 | an over-applied call's saturated node typed as the result | build test, E3-E6 |
| N3 | the body's holes not renumbered | corpus T8 |
| N4 | clause parameters read at `ParamType` | T5b, T12 |
| N5 | `crash`'s body type not read | build test E18; T12 |
| N6 | every slot read as a type | build test E3-E6 |
| N7 | the harness skips the seal check | T3a harness |
| N8 | E7 writes its children's entries first | problem pin |
| N9 | E28 typed as its operand's record | build test E24-E28 |
| N10 | a record sub-pattern typed by the scrutinee | build test P1-P7; problem pin |
| N11 | Generate re-exports `generateIn` | T3c; E6 and the pinned lists |
| N12 | a binderless clause gets binder 0 | faults test |
| N13 | a row variable in a type read as rigid | faults test |
| N15 | E26's field variable stored `Auxiliary` | T5 |
| N16 | a lambda parameter's site holds an arrow | T12; build test E13 |
| N19 | a function reference reads no slot | T5; build test E3-E6 |
| N20 | a record variable bound to a renaming faults | survived the 7.1b tests: no corpus witness binds one (C7's path); killed by test/r0-elab-props.test.mjs T4b (seed 7107, `SortMismatch`), run after review |
| N21 | a `Free` binding read as unbound | T1 |
N14, N17 and N18 were not used. N2 first survived (no probe
over-applied a named call), and N3 survived T2 by design (the
projection renumbers holes); the build test gained `id(add, 1, 2)` and
T8 the fixed-point check, and both were then caught.
**Regression rows (checked: `node scripts/regression.mjs` with the
names).** `r0-port-seal-unchecked`, `r0-port-over-applied`,
`r0-port-holes-unnumbered` (scripts/regression-r0-port.mjs, probes in
test/regression-r0-port.mjs). Two rows follow the port: `r0-perform-
arity` now patches Generate.Call's shared `applied` (so the restored
defect types every partial use as its result), and
`r0-declaration-by-id`'s needle reads `problem` of the regenerated
value. Both pass.
**Trusted surface.** Re-pinned (scripts/trusted-surface.json, 47
importers): the new Generate modules, the changed Generate exports, the
two faults. Every diff to Generate*, Decide.Shadow and Strategy.Online
needs token review.
**Carries.** S7 (E-a) after the author's decision; T2's effect-erased
scope is revisited then (spec §12.1). The Cov question for images
naming a problem variable stands, now with the corpus count above (0).
## D1 part b: the 7.1b review's minors (2026-10-24)
Seven minor items from the Task 7.1b review, landed with the rebase onto
the shadow hardening (r0-t2-hard). Test and comment changes only; no
generator behaviour changed.
1. **The problem pin covers the inline probes (checked).**
test/r0-problem-pin-run.mjs now hashes RT8's sources (`rt8Sources`:
the corpus and R022's two probes) and the window's defect probes
(R020, FX032). Re-pinned with `node scripts/r0-problem-pin.mjs`:
3,021 problems of 988 programs, up from 3,011 of 984. A script
compared the old file with the new: none of the 984 corpus digests
changed, and the four added origins are `inline:r022-disjoint`,
`inline:r022-lacks`, `inline:r020` and `inline:fx032`. Their digests
were taken after the port, so they guard later changes, not the port.
2. **N20 (checked).** In a scratch copy, `readAs`'s `RecordSort, TVar _
→ Right ty` became `Left (SortMismatch variable)`; after `node
scripts/build.mjs`, `node --test test/r0-elab-props.test.mjs` failed
T4b ("seed 7107: SortMismatch"); T4a and T9 passed. The mutant table
row records it.
3. **A builtin of another arity (checked).** Generate/Builtin.purs `called`'s
comment now says what the placeholder is: the unit value applied to the
arguments, ill-typed. A new test, test/r0-elab-builtin-arity.test.mjs, takes
`show`, `Console.print` and `crash` with zero and two arguments: each has
exactly the `StaticArity` refusal, and the corpus run's pipeline (`decide`,
then `elaborate`) reaches no `Elaborated` (today `decide` judges none of them
Solved); the one-argument control elaborates. With `PrintArguments` made
`Semantic` in Static.purs (a scratch copy), the test failed on
`Console.print(1, 2)`.
4. **T2's by-site mode and the walk (checked).** test/r0-elab-compare.mjs
compares the declaration's `parameters` and `result` (effect-erased) in
by-site mode too; the corpus counts are unchanged (1,989 compared, 45 by
site, 153 sites, 159 excluded). The site walk (test/r0-elab-walk.mjs) throws
for a constructor outside the five leaves (`Integer`, `Boolean`, `Local`,
`UnitValue`, `TextLiteral`); the build test checks a leaf and an unknown
constructor. Its first corpus run (T5b, the positions suite) threw on
`$$Boolean`, the compiled name of `Boolean`, which the leaf set now lists.
5. **Rows last (checked).** test/r0-rows-last.serial.test.mjs: in
every resolved function's and declared type's `sorts`, nothing but
`RowSort` follows a `RowSort`, over 300 seeded programs whose type
and function parameters are written in shuffled order (more than
half mix both sorts) and over every resolving corpus program. With
Resolve/Signature.purs's `Array.sortWith sort` removed (a scratch
copy), the seeded half failed at seed 1. The corpus half could not
run in the copy (no git checkout for the corpus loader).
6. **The shadow-only family regex (checked).** test/r0-verdict.test.mjs
counts Domain.Elaborating*, Features.Check.Elaborate* and
Domain.Verdict.Judged* as added families; the allowlist is
unchanged and the test passes, so compile reaches none of them.
7. **Decide/Shadow.purs's header** names `BinderShape` and
`VariableSort` as `InputShape` faults (comment only; trusted
surface, so it needs token review; the line-1 marker stays).
## R021 follow-ups: hardening re-review 2's minors (2026-10-24)
Three minor items from the second re-review of the shadow hardening
(R021), landed with the Task 7.1b rebase. Test and docs only.
- **m-4 (checked).** The read-back's own guard (ReadBack.purs
`completing`: `wellSorted remaining`) has a fixture in
test/r0-readback.test.mjs: `field`'s generated problem plus one
equation reading its auxiliary row variable as a type (`rest = Int`)
is still one-tail but ill-sorted, and the read claims `Heuristic`;
the unmodified problem claims `ClaimsComplete`. With `&& wellSorted
remaining` deleted (and the then-unused import) in a scratch copy and
rebuilt, the fixture failed: `actual: 'ClaimsComplete'`, expected
`'Heuristic'`.
- **m-5 (checked).** The corpus assertion in
test/r0-shadow.serial.test.mjs also joins each `BQ` atom's type to
the equations as `ty = ty`, which adds its variables' uses and no
constraint: 3,017 generated problems, 7,607 `BQ` atoms, 0 ill-sorted.
test/r0-entailed.test.mjs checks the encoding on the re-review's
probe (`{| r} = {a: Int}` is well-sorted; with `pr r` joined it is
not). Production `wellSorted` still reads equations only; the probe's
readings (Reduced, InScope) agree with the eager unifier's, so this
is a recorded gap in the guard, not an R021 difference, and no
generated problem has it.
- **m-6.** The sentence under "Precondition" that cited
Generate/Assemble.purs for well-sortedness is reworded to point at
the corpus check.
**After the rebase (checked).** The Task 7.1b review asked for T1, T2
and T8's numbers to be re-taken once the hardening's `wellSorted`
change to ReadBack was in. One `npm run verify` on the rebased branch
(EXIT 0) printed the same counts as part b: 1,989 Solved declarations
compared (1,944 exactly, 45 by site: 153 sites compared, 159 excluded
for `Amb`) and 781 more witnessed certificates (all exact). No number
in part b moves. The RT1, RT8, window and census pins are unchanged.
## Whole-stack review of the R0 shadow stack (2026-10-24)
An independent reviewer (Opus, read-only) reviewed a00f90c..e37e22c,
focused on the trust boundary, effect fidelity, assembly paths and
carried gates. It ran two probes through the compiled output and did
not run the test suites. The controller re-read P1-1, P2-7, P3-2 and
P3-3 at the cited lines and confirms them. Defects are backlog items
R026 (P1: the witness is built from a substitution the trusted check
did not see), R027 (fail-open boundary checks), R028 (T1/T2 counts
are lower bounds) and R029 (the lowering boundary is unlisted, and
`Elaboration` can be minted anywhere). Open documentation findings:
- **P2-3.** Task 7.1's acceptance, Task 7.2's removal condition and
§7 risk row 7 of the implementation plan say "corpus-wide equality"
with no effect-erased qualifier, so the passing T2 reads as meeting
them. G-effect-rows blocks Task 4.6 but not Task 7.2's removal.
- **P2-4.** Option c drops more than effect rows: Generate/Elab/Image
builds `TData owner arguments []` (row arguments dropped), handler
labels `Unmarked` and `clauses: Nothing`; r0-elab-erase.mjs erases
all three. r0-ea-representation.md and the gate row say only
"closed, empty rows".
- **P2-6.** No record closes G-D1 (progress, findings and the plan
disagree on its state), authorizes the second shadow tranche (Tasks
5.2 and 7.1), or dates the controller's option-c departure from the
author's E-a ruling (r0-erased-rows.md §7.1 item 4).
- **P3-1.** T1/T2 run a pipeline the test assembles (no seal check
before `decide`; `elaborate` called from the test); no production
function composes generate, seal, decide and elaborate, so Task
4.6's assembly is not covered by T1/T2 automatically.
- **P3-4.** progress.md's Task 7.1b entry says the generator "builds
today's checked declaration"; it matches only on the effect-erased
projection.
- **P3-5 (plausible, not run).** 9195489, 98c3014 and 2c0ef09 likely
fail verify: two serial tests read `generate(...).value0` as the
problem until 8d46e88. The reviewed tip, not each commit, is the
unit being landed.
Found clean, as checked by the reviewer: the importer rules match
AGENTS.md; `Judged` is minted only in Decide; `elaborate` runs seal,
problem identity and Cov before `build`; the CLI reaches only
`checkProgram` and no new family module is reachable from
Program.Main; Task 4.6, Task 2.2, Phase 6 and the Command change did
not land. Not reviewed: CX refuter internals, the R021 unifier, the
census and window tables, the T3c fixtures, and which row information
lowering reads.
**Status after the repair sequence (2026-10-24).** R026 (f97dbde),
R029 (62b965a), R027 (7a9fcc0) and R028 (655fef9) are fixed, each with
tests that failed before the fix; see BACKLOG. P2-3: the plan's Task
7.1 acceptance, Task 7.2's two conditions and risk row 7 now say the
equality must include effect rows, and G-effect-rows blocks Task 7.2's
bridge removal as well as Task 4.6. P2-4: r0-ea-representation.md and
the gate row state all three of option c's departures. P2-6: dossier
§18.72 records the authorization history as the repository shows it:
no recorded author authorization of the second shadow tranche or of
option c, and G-D1 not closed. P3-4: the Task 7.1b progress sentence
is corrected. P3-1 (T1/T2 run a test-assembled pipeline) and P3-5
(intermediate commits) are unchanged and stand as notes. The
regression-runner defect reported separately (a rejection without a
reason counted as success) was fixed earlier at 98b9b99.
## Review of the repair sequence (2026-10-24)
An independent reviewer (Opus, read-only) reviewed 9130e75..59da938
with the author's decisions given as settled. Verdict: no P0 or P1;
R026's fix holds on every path traced (every `StrategySpec`
construction, `Certified`'s importers, `Valid` reaching a `Judged`
only through `checked`, `settled` against lowering's defaults, holes
kept `Free`, the certificate's untrusted fields reaching nothing
trusted, the restored-defect row faithful). Findings and their
disposition:
- **P2-A (fixed).** Domain.Recorded.Atom (hand-written `Eq RTExpr`)
and Domain.Recorded.Hole (`holeIndex`, read by `settled` and by
`build`'s images) were in neither list; both are now marked and
listed, with the out-of-scope rule for derived-instance data
modules stated. The rest of the closure is BACKLOG R030.
- **P3-1, P3-9 (fixed).** E6 now restricts Certified.Internal, pairs
and pins Domain.Verdict.Certified, and reports a module header it
cannot read (test failed against the previous script).
- **P3-2, P3-4, P3-6, P3-7 (fixed).** AGENTS.md names
Certified.Internal's importers; the plan records R026's change to
T-R0a §4.1 as a labelled amendment; two stale effect-erasure spots
corrected.
- **P3-8 (control added).** A certificate forged to one hole is Solved
with `NoWitness HoleContract` and is not built; now a test.
- **P3-3, P3-5 (open, BACKLOG R030).** `checkSubstitution`'s bare
`Valid`; the assurance not naming the settle and witness steps.
- **P3-10 (note).** `foldElaboration` is the only read in PureScript;
JS tests still read constructor names and fields.
Not reviewed: the effect-row audit, the unexamined helpers (R030), the
CX refuter, the R021 unifier, the census and window tables, and any
conversation-level authorization.
## Window re-pin: FX032's `g` routes to `EffectsUnchecked` (2026-10-30)
Tranche 1 Task 11 (batch lane C, §18.122) makes rule 1 block a
declaration that records an `Unsupported` operation. Re-pinned with
`node scripts/r0-shadow-pin.mjs` on the integrated tree (Tasks 7, 8,
10, 11): exactly one of 1033 rows moved, `inline:fx032#g` (class
defect, today compiles), r0 verdict `Solved` to `Unresolved Unsupported
EffectsUnchecked [OperationWithRow 1 0]` (attempt stays `Accepted`),
rt8 `agree: Solved` to `(a) blocked` with that reason. The declaration
records the `Unsupported (OperationWithRow 1 0)` obligation, the
predicted FX032 routing. Summary: FX032 `stoppedUnderShadow` 0 to 1,
`allThree` 261 to 262, `underShadowDecisions` 250 to 251. No other row
moved; census.json did not move (r0-census.serial passes).
## Correction: commit a628bd5's message (2026-10-30)
Commit a628bd5 (Tasks 10-11, lane C rebased onto Task 8) carries a
"Trusted-surface pin diff:" paragraph from lane C's pre-rebase commit
that is inaccurate on the integrated tree: the new `SiteRole`
constructors are not in the pin (Domain.Recorded.Effect is not an
allowed importer, and `sourceExports` normalizes `T(..)`, so no
constructor addition there reaches any gate), and "Context gains
ambient" is Task 8's change (82b7969); Context.purs is not in
a628bd5's diff. Its actual pin change is Generate.Obligation gaining
deferAt, entryAt, payloadAt and unsupportedAt (source and compiled).
The message also omits its edit to test/r0-obligations-equal.test.mjs
(the effect-only E1 survey skips atom-free obligations that are not
`Equal`). Found by the batch's reviewer 3 (dossier §18.123); history
is not rewritten (§18.124).
## Window re-pin: the UnframedInstall restriction (2026-10-30)
§18.124 restricts a `with` whose installed handler's marked type is
not a handler type (`Unsupported UnframedInstall`, role
`UnframedWith`). Re-pinned with `node scripts/r0-shadow-pin.mjs`
(§18.126; the author ruled on all 20 moved rows): each moved row's r0
verdict gains `, EffectsUnchecked [UnframedInstall]` and nothing else
changes in class, attempt or today's result. Nine compile today (class
"markers: compiles today, R0 Unsupported Outside", rt8 gaining the same
suffix; the classifier now accepts it): f3, rev7/late1, rev7/late2,
rev8/one3, rev8/two3, rigid, expected-handler.pinned-selection#k,
fx008-defer r2#run, r9#main. Eleven are refused today (class "today
refuses, R0 Unsupported Outside", rt8 unchanged): design-review c2, c3,
p3, fx008-defer a8#main, a9#main, r5#g, rev7/late1ctl, rev8/one3ctl,
rev8/two3ctl, rigid-ok, expected-handler.inferred#k. No summary count
moved; every row was already blocked.
The RT8 pin (test/fixtures/r0/rt8.json, `node scripts/r0-rt8-pin.mjs`,
ruled by the author with the window) moves the same nine compile-today
declarations between reason buckets: "Outside FailFamily, Outside
HandlerType" 9 to 7 (+2 with the suffix), "Outside HandlerType, Outside
EffectArgument" 11 to 7 (+4), "Outside HandlerType" 97 to 94 (+3);
totals unchanged, 0 defects, 0 position findings.
## A2 validator: findings from implementation (2026-11-01)
- Today's online read-back σ is not always in sorted-field form: 14 of
2820 corpus candidates (25 of 3642 derived runs) have record images
with fields out of label order (for example
research/composition-assessment/programs/p2.wxw#main,
`{reviewed: Bool, age: Int}`). The A2 `erase` sorts fields (spec
§2.5), so the owed property "erase of the honest package equals
today's read-back" needs "up to record field order" or a ruling. G0
is unaffected (Candidate.purs `under` canonicalizes records; by
reading). Pinned by test/r0-a2-properties.serial.test.mjs (14).
Decided (author, 2026-11-01, dossier §18.148 (5)): up to record field
order, by one canonical comparison (test/r0-a2-canonical.mjs, spec
§11) that keeps field values, tails, hole identities and every effect
label's multiplicity and order. The property stays owed until tranche
2.
- For G0, an absent type variable is not a hole: `validate` checks G0
on `erase (settle P_in)`, which does not see completion's fresh
holes, so a package leaving a flexible variable absent is refused
where the same package binding it to a hole is accepted (C7(b) with
y absent; test "G0 reads erase (settle P_in), not erase (P_c)", row
r0-a2-g0-input). Today's `certify` behaves the same.
- Spec §12 C6 predicted that `k` with its field variable absent is
accepted ("bound to a hole: as absent"); the specified pipeline
refuses it at G0 (Unsatisfied) and accepts only the hole-bound
package. Decided (author, 2026-11-01, dossier §18.148 (4)): the
prediction is corrected and G0's projection kept; absent is refused at
G0, hole-bound is the demonstrated expected divergence, in two tests
(test/r0-a2-differential.test.mjs). The replacement-compatibility
decision stays open.
- The M-B differential (Task 13) found no disagreement: 116 packages
run; compared on 11 accepted (validator accepts ⇒ M-B holds) and 10
mark refusals (validator refuses ⇒ M-B fails); other refusals not
compared. Bounded: five E2 sites (AtCallback, AtStage, AtApply, AtPipe,
AtDeferredRow) have no accepted-package coverage, binding-label marks
are never mutated, and completion and settling are shared with the
validator (§18.146).
## Tranche 2: findings from Tasks 13 and 16 (2026-11-03)
- H2's reasoning in design §B.5 was wrong about where the defect shows.
With the generation correction reverted, ten of the 11 annotation
declarations refuse, nine at their `Consumed` `InstallR` consumption
(ObligationFailed, check 0) and one `RigidExact` (amb3#f), and
form.annotation-label#g validates anyway; none refuses at E1. Check:
Task 13's H2 test; §18.157 (2) retired the prediction.
- Four honest packages that `certify` accepts are refused
`NotCertifiable ForcedTail` (§18.156 lists them). This shows the
refusal depends on the provisional forcing restriction (E4′); it does
not show the restriction alone causes it (§18.157 (1)). Check: the
pin's `forcedTail` list, compared both ways by the honest gate.
- On the corpus no refused package has a dropped partial stage, so the
"consumption unchecked" mark is never exercised there; it is shown
only on the inline fixture (probe r0-t2-honest-stages-unchecked and
rows r0-t2-honest-stages-unmarked, -mismarked).
- A "ruling recorded" check that matches a dossier heading is spoofed
by sections that record a matter as open: §18.157 for C6, §18.155
for routing. The activation gate counts only rulings numbered after
§18.157 and still cannot read what a later section decides (its
blind-spot list). Check: the real-dossier test in
test/r0-t2-activation-gate.test.mjs and row
r0-t2-activation-any-section.
## Activation evidence: findings (2026-11-04)
- The online read-back costs about ×14 the CPU of `recheck` alone on
the effect pin's sources (+58 s over 2,832 candidates, +471 MiB peak
RSS). The earlier "+80% on the shadow test" hid this, because that
test spends most of its time elsewhere. Check: the paired
measurement, test/fixtures/r0/t2-performance.json.
- R035's earlier memory figures (tranche 2 Task 7's trace-cost probe)
measured a "without" process that also loaded the collecting
compiler through the corpus forms; its memory ratios are biased
toward 1. Check: the protocol review's C1; the new worker imports no
test module (scripts/r0-t2-perf-worker.mjs).
- Under validator minting, RT8's accounting labels a decline as a
DEFECT, and the window classifier throws on the first DEFECT, so the
shadow pin test aborts at load. Check: the criterion 5 comparison's
logs; owed: a fix and a test before the real switch (proposal T6).
- A gate check that accepts any certify text other than `accepted` as a
refusal fails open; criterion 2 now recognizes only `accepted` or a
whole CheckRefusal constructor and cross-checks the pin. Check: cases
forcedRelabelled, certifyUnrecognised and their rows.
## D001 Task 3: binary `-` (2026-11-26)
- Correction to the design's ruling on `with h -1` (section 9) and to
the task's brief: `with h (-1)` is not a migration. Postfix
application binds a parenthesized group after an operand
(Format.Parse.Lookahead `startsSuffix`: the next token is `(`), so it
reads `h(-1)` as the handler and the body is missing, as design
section 4 itself says of `with h (x)`. The working migration is
`with h { -1 }`. docs/language.md and ADR 016 give only that one.
Check (argued from the parser, not run in this session):
test/int-minus.test.mjs pins both `with h -1` and `with h (-1)` as
E_SYNTAX `Expected an expression` at the closing `}`.
- `first-diagnostic`: research/division-campaign/split-irrelevance/
statements.md#1 (`walk(whole, left, n - 1)`) was pinned at E_SYNTAX
"Expected ')'" because `-` did not parse after an operand. With `-`
it is expected to stop at E_ENTRY "Expected fn main()". Re-pinning it
is the coordinator's, after checking that it is the only entry that
moved (task brief, ruling 8).
## D001 Task 7: the whole change, and a stack-depth flake (2026-11-28)
- The trusted-surface correction (design section 7) held in practice:
scripts/trusted-surface.json pins the export lists of the
Generate modules, so Task 5's one-operand generation case went into
Generate/Expr.purs as a private function rather than a new export of
Generate/Operator.purs. No arithmetic task changed a pinned export.
- The differential of 2e21c93b (main before Task 3) against d001-negate
(017d9d9b), `--corpus all`, repeated three times, found 595 stable
differences, every one in a source that writes `-` or `*`, and every
one a source 2e21c93b rejected, except the accepted `with h -1` break
(one harvested source, ADR 016). Details in docs/progress.md.
- Not arithmetic, found by that differential: 2e21c93b sometimes
overflows the JavaScript stack ("Maximum call stack size exceeded")
on two harvested programs whose types nest `Handler(Log with
S(Handler(…)))` deeply (about 2,600 characters). It crashed on both
in one run, on one in another and on neither in a third, so the
depth sits near the stack limit and the outcome depends on run
conditions. d001-negate never crashed on them in three runs, but the
code path is shared, so the margin there is unmeasured. Not fixed;
recorded for the nesting-limit work (ADR 006, O001).