Whole-program pass: 1,120 ms down to 465 ms on a large entry, findings unchanged, with a guard on the work done #126

Merged
sionzee merged 98 commits from pass-speed into main 2026-11-22 00:57:12 +01:00
Owner

The whole-program pass is what the editor, the lint plugin and an agent's edit loop wait on, and the README promises it stays "well under a second on a project of a few hundred files". On an adopter's largest entry it had crept to 1,120 ms: a dozen pieces of work each added a few percent, and each was accepted on its own. It is now 465 ms, with every finding unchanged.

Run on that project (shipped profile, minimum of interleaved runs) Before After
Whole-program pass, largest entry 1,120 ms 465 ms
The same on one thread 1,120 ms 813 ms
Whole-program pass, all directories 2,850 ms 2,090 ms
Per-file analysis, largest entry 166 ms 168 ms

About 350 ms of the gain on the entry is work moved onto other cores, not work removed; the one-thread row is the honest measure of what was cut.

Where the time went, and what was cut

  • sentinel-error was more than half the pass. It looks at package files outside the program, and analysed each one lazily, one at a time, once per file that asked. Now each file's tested calls are resolved once per pass (5,977 resolutions became 1,774), package text is read once, and the outside files are analysed in one parallel batch.
  • The same question was answered again for every caller. resolve_callee, resolve_binding, a type lookup at the top level, a global type and a type import are remembered per pass. Call resolutions on the directory run went from 1.06 million to 123 thousand.
  • A whole declaration was copied to read one field. A type lookup hands out a shared declaration; a declaration is copied once per pass.
  • A package call's effect is remembered per call site.

Two of the nine commits show no measurable gain on their own and are kept because they remove repeated work; the commit messages say which.

Nothing changed in what is reported

Byte-identical output against the previous binary, checked after every commit: 234 invocations, each compared as text with the summary line, as --json, and as stderr with the exit code. That covers the adopter's entries and its directories, the three example projects and every fixture directory, with and without --idiomatic. I repeated the adopter's directory run and the examples on top of the current main: identical again, and two runs of the new binary agree with each other.

So it does not creep back

crates/safe_ts_core/tests/work.rs checks a fixed generated project and compares counts of work done from scratch with tests/work-ceilings.json: files analysed and parsed again, calls, names and receivers resolved, types looked up and evaluated, declarations copied, package calls judged, failure chains, files sentinel-error reads. Counts, not milliseconds, so it holds on a shared CI runner. It fails when a count rises above its ceiling, and also when one falls more than 10% below, so a speed-up has to be written down. Disabling the new memos makes it fail (calls resolved on the entry: 581 → 2,579).

What is left

  • Under 600 ms on one core needs the roughly 118 package-file analyses sentinel-error does for that entry to go (about 350 ms of CPU): either a lighter analysis for files outside the program, or a narrower name filter in the rule. The second changes what the rule sees, so it is not part of a change that promises identical findings.
  • safe-ts fix on a large project is slow for a different reason: every file is checked with a fresh run, so the cross-file facts of its dependencies are worked out again each time. These cuts help it (fix strict-truthiness on one app: 10.4 s → 7.3 s), but the fix is a run shared across files.
  • The rest of the pass is type evaluation and failure chains, with no repeated questions found.

For whoever writes rules next: resolve_callee, resolve_binding, a top-level type lookup and a global type are now remembered per pass. Their answers must not depend on anything that is not part of the key.

Created with Claude Opus 5.5 (implementation) and Claude Fable 5.2 (review and verification) in Claude Code.

The whole-program pass is what the editor, the lint plugin and an agent's edit loop wait on, and the README promises it stays "well under a second on a project of a few hundred files". On an adopter's largest entry it had crept to **1,120 ms**: a dozen pieces of work each added a few percent, and each was accepted on its own. It is now **465 ms**, with every finding unchanged. | Run on that project (shipped profile, minimum of interleaved runs) | Before | After | |---|---|---| | Whole-program pass, largest entry | 1,120 ms | 465 ms | | The same on one thread | 1,120 ms | 813 ms | | Whole-program pass, all directories | 2,850 ms | 2,090 ms | | Per-file analysis, largest entry | 166 ms | 168 ms | About 350 ms of the gain on the entry is work moved onto other cores, not work removed; the one-thread row is the honest measure of what was cut. ## Where the time went, and what was cut - **`sentinel-error` was more than half the pass.** It looks at package files outside the program, and analysed each one lazily, one at a time, once per file that asked. Now each file's tested calls are resolved once per pass (5,977 resolutions became 1,774), package text is read once, and the outside files are analysed in one parallel batch. - **The same question was answered again for every caller.** `resolve_callee`, `resolve_binding`, a type lookup at the top level, a global type and a type import are remembered per pass. Call resolutions on the directory run went from 1.06 million to 123 thousand. - **A whole declaration was copied to read one field.** A type lookup hands out a shared declaration; a declaration is copied once per pass. - **A package call's effect** is remembered per call site. Two of the nine commits show no measurable gain on their own and are kept because they remove repeated work; the commit messages say which. ## Nothing changed in what is reported Byte-identical output against the previous binary, checked after every commit: 234 invocations, each compared as text with the summary line, as `--json`, and as stderr with the exit code. That covers the adopter's entries and its directories, the three example projects and every fixture directory, with and without `--idiomatic`. I repeated the adopter's directory run and the examples on top of the current `main`: identical again, and two runs of the new binary agree with each other. ## So it does not creep back `crates/safe_ts_core/tests/work.rs` checks a fixed generated project and compares counts of work done from scratch with `tests/work-ceilings.json`: files analysed and parsed again, calls, names and receivers resolved, types looked up and evaluated, declarations copied, package calls judged, failure chains, files `sentinel-error` reads. Counts, not milliseconds, so it holds on a shared CI runner. It fails when a count rises above its ceiling, and also when one falls more than 10% below, so a speed-up has to be written down. Disabling the new memos makes it fail (calls resolved on the entry: 581 → 2,579). ## What is left - **Under 600 ms on one core** needs the roughly 118 package-file analyses `sentinel-error` does for that entry to go (about 350 ms of CPU): either a lighter analysis for files outside the program, or a narrower name filter in the rule. The second changes what the rule sees, so it is not part of a change that promises identical findings. - **`safe-ts fix` on a large project** is slow for a different reason: every file is checked with a fresh run, so the cross-file facts of its dependencies are worked out again each time. These cuts help it (`fix strict-truthiness` on one app: 10.4 s → 7.3 s), but the fix is a run shared across files. - The rest of the pass is type evaluation and failure chains, with no repeated questions found. For whoever writes rules next: `resolve_callee`, `resolve_binding`, a top-level type lookup and a global type are now remembered per pass. Their answers must not depend on anything that is not part of the key. Created with Claude Opus 5.5 (implementation) and Claude Fable 5.2 (review and verification) in Claude Code.
An agent aims at "the checker passes", so a program that passes the static gates and fails at
run time is a bug SAFE-TS lets through. Until now those were found by hand. The corpus makes the
count a gate: scripts/soundness/escaping.txt lists the classes that escape today, and
`npm run test:soundness` (also in CI and `npm test`) fails when the classes that escape differ
from the list in either direction. A class escaping that isn't listed is a regression; a listed
class that no longer escapes must come off the list, like an unused @ts-expect-error. So closing
a class shows up in a diff, and reopening one fails CI.

It is not a fuzzer: each class is a hand-written generator with small variations (names, sizes,
constants), in scripts/soundness/classes/, with a one-line statement and the oracle that shows
it. Every run writes every variant, so the set doesn't depend on the seed. Programs are checked
in the setup docs/guide/adoption.md documents (strict + strict-lib, `safe-ts check
--deny-warnings` with idiomatic rules and the packs, oxlint with the preset) and run in Node
with the loader. A crash counts only if the checker saw no failure: a caller file invoking
run() at top level must pass too. About a second.

From the prototype's 32 classes: 28 escape. Dropped as artefacts the oracles reported where the
rules permit it (0 / 0 is NaN, a number; a Mut captured by a closure the owner calls itself),
merged duplicates (the random-* classes, getter + method mutation of a borrowed receiver), and
split try-return: the checker tracks it, `Promise.reject` is what escaped. Three classes the
prototype's seed never produced now escape every run.

The prototypes it came with move to notes/prototypes/, marked as such: the nominal Mut<T>
proofs (approved, built separately) and the TypeScript 7 native API type-oracle experiment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Soundness corpus: count division by zero
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m54s
Tests / test (pull_request) Successful in 10m24s
013d698ea1
The first cut dropped it because `NaN` is a `number`, so no declared type is
broken. The output is still wrong (`"NaN%"`, an average of nothing shown as
`NaN`), `number-parse-nan` already treats `NaN` from parsing as a bug, and a
check of divisors is planned. The class uses a divisor that is always 0, so it
does not depend on the seed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The failure rules recognised `f(x)` and `obj.m(x)` and nothing else. The same
call written any other way was silent, and so was a function handed over by
name: `apply((id) => find(id))` was reported and `apply(find)` was not.

- One normalisation step (analyze/spelling.rs) feeds every failure rule:
  computed members, `globalThis.` prefixes, copies (a const, destructuring, a
  class field, an export used from another file), `.call` / `.apply` / `.bind`,
  `Reflect.apply` / `Reflect.construct`.
- A function used as a value is checked as the arrow that calls it, written
  there. One handed to a call that only looks it up, compares it, removes it
  or prints it is not called there.
- `Promise.reject(x)` and an executor's `reject(x)` are `no-throw` unless `x`
  is a `PropagateError`, and then propagate like a `throw` in an async function.
- `must-use-result` follows a `Result` into what discards it: `forEach`, a
  timer, a listener, and a dropped `list.map(check)` or
  `await Promise.all(list.map(save))`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Soundness corpus: Promise.reject no longer escapes
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m3s
Tests / test (pull_request) Successful in 7m41s
ad0d57730e
`promise-reject-untracked` comes off the list: `no-throw` now reports a
rejection with an error that isn't a `PropagateError`. 28 of 31 classes escape.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Whole-program pass: evaluate a declared type once per pass, not once per question
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m36s
Tests / test (pull_request) Successful in 6m51s
5ef2d0547d
On an adopter's package of 58 files the whole-program pass took about 15 s.
Measured with timing instrumentation: 12.5 s of it was `type_answers`
(computed the first time `type_settled` asked, from `lib_effect` in the
`unhandled-failure` walk), and nearly all of that was 146 `strict-truthiness`
sites whose value is an error code, `(typeof Errors)[keyof typeof Errors]`
over a `codesOf(...)` table. Each question in `json::value` (`holds`,
`truth_kind`, `closed`, `literal`, ...) starts a new `Generator`, so the code
table (about 5,000 instantiations of tuple arithmetic, ~65 ms) was evaluated
again for every question; `literal` did the same for each `typeof Table.X`
(1,122 calls) in dispatch and member sets. The linear `answers.iter().any`
in `type_settled` was real but cost 15 ms.

`Generator::norm` now keeps what it gives in a `Memo` held by the pass's
lookup (`Run`) when it is asked before the generator has evaluated anything
(`pristine`) with no type parameters bound: the result and the generator
state it leaves, which then depend only on the type, where it is written
(for a named type without arguments: the name and the declaration it finds,
since `norm` uses that file only for the lookup), the context string and
the settings (`lazy_index`, `brands_as_strings`, `tags_only`), all in the
key. A hit restores that state, so the generator continues exactly as if it
had evaluated the type again. The state is behind `Arc` (copied on first
change), so a restore is cheap. Turned on for the value questions and the
code-table helpers (`literal_value`, `const_members`); validator codegen
is unchanged.

That package's pass drops to ~0.8 s; findings are identical to before on
four adopter entries and the repo's examples. A fixture checks that the
same name for different declarations, and a renamed import of one, keep
their own answers in both the whole-program and the editor path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each of these programs passed tsc strict, safe-ts check --idiomatic and the
oxlint preset, with no cast and no any, and failed at run time.

- no-method-signature (error, quick fix): a member written as a method in an
  interface or type literal is checked bivariantly, so an implementation that
  only takes a Dog is accepted where any Animal is passed. The fix writes
  `readonly m: (x: T) => R` (overloads become one property with call
  signatures). Against a property member, tsc refuses a narrower arrow
  function, object-literal method and class method alike; a class used as a
  type and the platform's method-declared types stay bivariant, as the rule
  page says. Applied to this repository: 48 sites in 10 files; tsc then found
  one assignment in pack-kit that only compiled through the bivariance, now
  typed with the real `Signature`.
- constructor-calls-override (error, safe-ts check only): a constructor or
  instance field initializer that calls, directly or through the class's own
  and inherited methods, a method or accessor that a subclass in the program
  overrides, or an abstract one: the override runs before the subclass's
  fields are set. Subclasses are found across files with the existing binding
  resolution; the program is taken as complete.
- unbounded-spread (error): a list of unknown length spread into Math.max/min/
  hypot, push/unshift/splice/concat, String.fromCharCode/fromCodePoint,
  Array.of and typed arrays' of, Object.assign, append/prepend/replaceChildren
  (also .call/.apply/Reflect.apply): RangeError past ~100,000 elements, and
  -Infinity for an empty Math.max. Literals, tuples, `as const`, rest
  parameters and project functions are fine. std/array gains maxOf and minOf
  (Option<number>), which no built-in form gives.
- no-optional-field (idiomatic, safe-ts check only): `key?: T` in a type the
  project declares lets a value without the key, holding anything, through;
  write `key: Option<T>`. Exempt: optional parameters, JSON types (validator
  type arguments anywhere in the program and what they name, std JSON types),
  Vue defineProps and React component props, types built on a library's or
  the platform's type, declarations and ambient blocks, decorated fields.

Fixture lines in existing fixtures that now get one of these findings are
annotated with the new rule; no existing expectation was removed. Docs
examples with method signatures are written in the property form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
no-method-signature: a member written as a method is bivariant only in its
parameters, so a method without any (`destroy(): void`, `channels(): T[]`;
a `this` parameter doesn't count) has nothing for the property form to close.
It is no longer reported (64 of 248 findings on an adopter were of that
kind). Overloads stay one member: reported, and fixed, when any signature has
a parameter. The 8 `expect: no-method-signature` annotations the previous
commit added to existing fixtures on parameterless methods are removed again
(contexts, idiomatic_rules/task, json, node_classes, ownership/fields,
pack_globals/shadow, results/open, test_runners/globals); the rule's own
fixture gains the silent cases (parameterless, optional, `this`-only) and a
mixed overload.

unbounded-spread: `push`, `unshift`, `splice`, `concat`, `append`, `prepend`
and `replaceChildren` were matched on any receiver, so a project type's own
variadic method (`router.push(...names)` with `router: Router`) was reported
with advice meant for arrays. Now a receiver that is a parameter, a variable
or a field `this.x` declared with (or a variable made with `new C(...)` of) a
class, interface or type alias of the project that declares that member
itself, or `this` inside such a class, is not reported. `Readonly<T>`,
`Mut<T>`, `T | undefined` and intersections are looked through. A type of the
same file is decided per file; an imported one is decided by the
whole-program pass (new `Run::project_type_declares`, resolved like
`type_target`: `resolve_binding` / `export_at`, not a package's, not a
`.d.ts`), from each file's `declared_members`. Arrays, tuples, `Array<T>`,
strings, DOM types, type parameters and receivers of unwritten type stay
reported.

Also a `const` whose value has a known length (`const head =
values.slice(0, 3)`) now counts as known, unless something can make it longer:
`push` / `unshift` / `splice` on it, a write to `length` or an index, or the
array handed to anything but a spread, a `for of` or a member read. A
bounded list that may be empty (`Math.max(...xs.slice(0, 16))`) stays
unreported: the rule is about lists too long for the stack, and its message
leads with the RangeError; the rule page now says so under what the rule
can't see.

Rule pages, README and docs index rows, the Unreleased CHANGELOG entries,
module docs, the no-optional-field cross-reference and the migrate skill's
tool-gaps note are updated to match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
It reports a limit that takes about 100,000 elements to reach, and on an
adopter's project a good share of its sites are bounded in practice by
something the checker can't see. `bounded-concurrency` and
`no-accumulating-copy`, its nearest neighbours, are warnings for the same
reason. A run with `--deny-warnings` still fails on it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Soundness corpus: four classes no longer escape
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m6s
Tests / test (pull_request) Successful in 7m44s
b8ca7a1819
`interface-method-bivariance`, `class-base-ctor-uninit-subclass-field`,
`spread-call-stack-overflow` and `width-subtyping-optional-prop` come off the
list: `no-method-signature`, `constructor-calls-override`, `unbounded-spread`
and `no-optional-field` report them. 25 of 31 classes escape.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
What was open: `no-unchecked-cast` bans `as`, but three constructs hand out a type nobody
checked and passed every gate, `tsc` strict included. TypeScript never checks a type predicate's
or an assertion signature's body against its claim (`(v: unknown): v is User => true`,
`asserts v is User {}` compile), and an overload signature only has to be loosely related to
the implementation (`function parse(t: string): User; function parse(t: unknown): unknown`).
A predicate could also mint a brand. The only coverage was the opt-in `partial-type-guard`,
which looked at field names in guards over `unknown`. The docs recommended the overload and the
"complete" guard as the cast-free way.

What closes it:

- `no-type-predicate` (error): every hand-written `x is T`, `this is T`, `asserts x is T` and
  `asserts x` on a function, method or arrow with a body. Nothing is verified and allowed:
  since TypeScript 5.5 a predicate whose body is one test TypeScript narrows by is inferred,
  and checked, once the annotation is gone. The quick fix "Let TypeScript infer the narrowing
  from the body" removes it for those bodies (typeof, instanceof, Array.isArray, `in`,
  literal and constant comparisons, discriminants, `!!x`, std's guards, joined by || or &&);
  a claim wider than its test then fails to compile where it was used. The message names the
  form for the rest (validate<T>, `find` for a lookup, std's isJsonObject, filter(isSome)).
  The one form allowed: `asserts x` whose body is exactly `if (!x) throw`/`panic(...)`.
- A predicate that claims a brand is `brand-constructor`.
- `no-overload` (error): overloads of the project's functions and methods, once per function.
  Allowed: overloads that only narrow the implementation (same type parameters and result,
  each parameter one of its union's members), `.d.ts`, `declare` blocks, interface call
  signatures. A result the body can't type is `trust<T>(value)`, which `check` counts.
- `partial-type-guard` is removed; a config or ignore naming it is told what replaced it.

On an adopter's project (346 files) the run adds 99 no-type-predicate and 2 no-overload
findings and changes nothing else; 24 of the predicates get the fix, and with it applied 21
compile unchanged and 3 surface a claim their body didn't make. The fix is held back where
TypeScript would infer something else: `Array.isArray` on a readonly array, `instanceof` for
a claim with type arguments (`Map<any, any>`), `Record<string, unknown>`. The repo's examples are
unchanged; the docs, the skill, the fixtures and std's test fixture write `codesOf` with
`trust` instead of an overload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
no-overload: an overload may leave out the implementation's optional parameters; the corpus drops two classes
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m45s
Tests / test (pull_request) Successful in 8m33s
d1624298a1
`area(shape: "circle", r)` / `area(shape: "rect", w, h)` over
`area(shape, a, b?)` returns what it says and accepts only what the body
handles, so it is the allowed kind; the rule compared parameter counts and
reported it. An overload that leaves out a required parameter is still reported.

`disguised-cast-asserts-predicate` and `disguised-cast-overload` come off the
soundness corpus's list: `no-type-predicate` and `no-overload` report them.
27 of 31 classes escape on this branch.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Fixture: build the code table with one signature, not an overload
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m25s
Tests / test (pull_request) Successful in 6m17s
a9b538c03a
The overload form is a cast in overload form, which another open change reports
(no-overload). The one-signature form with `trust` evaluates to the same type,
and the fixture's expected findings are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Fixture: write the interface's predicate member as a property
All checks were successful
Tests / test (pull_request) Successful in 7m4s
Benchmarks / bench (pull_request) Successful in 3m2s
30ceca8ae8
Another open change reports a member with parameters written as a method
(no-method-signature); the property form is valid either way.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Fixture and docs: write members with parameters as properties, not methods
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m42s
Tests / test (pull_request) Successful in 7m12s
15b16da2fa
Another open change reports a member with parameters written as a method in a
type (no-method-signature). The property form means the same to every rule
exercised here, and is valid either way.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The failure rules followed a method call only when the receiver's class was
visible at the call: `this`, `super`, `new C()`, a module-level instance, or a
binding declared as exactly `C`. Every other receiver was silent, so the most
ordinary shape of application code, a service holding its dependencies in
fields (`this.repo.load(id)`), propagated nothing anywhere.

A receiver is now written down as a value (analyze/receivers.rs) and a call on
it as `Callee::Of`; the whole-program pass (project/receivers.rs) follows the
declarations, across files, to the method `new Repo().load()` runs:

- a field declared with the class: an annotation, `= new Repo()`, a constructor
  parameter property, `this.repo = new Repo()` in the constructor; inherited;
- a property of a declared type (`deps.repo.load()` with `deps: Deps`, an
  alias, an interface, an object type, `Repo | undefined`), also destructured
  (`const { repo } = deps`, `function run({ repo }: Deps)`), and `const` copies
  (`const repo = this.repo`, `const self = this`);
- a function or method declared to return the class (`makeRepo().load()`, `T`
  of an async one's `Promise<T>` once awaited), and chains of these;
- a member chain into a module-level object literal (`api.users.load()`);
- getters and setters: `x.value` runs `get value()`, `x.value = v` runs
  `set value(v)`, keyed `C#get value` / `C#set value`.

Not followed: a receiver typed as an interface or a union of several types, an
override through a value declared as the base class (left to the declared
contracts of the next change), generic types, array and Map elements.

Two causes of false floating-rejection findings that the newly known
rejections exposed are fixed: a promise held in a binding and also stored in
an object literal (`{ promise }`) or compared (`p === q`) still settles where
every path awaits it, and `return c ? f() : undefined` (also `??`, `||`)
returns `f()`'s promise.

Following more receivers adds call sites; the failure and propagation passes
now take a function's calls from an index (`calls_of`) instead of scanning
the file's, and calls by span from another (`call_at`). Receivers are interned
per file and resolved once each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`queueMicrotask(this.tick)`, `items.forEach(this.tick)`, `return this.tick`,
`const f = ticker.tick; f()` and `const { tick } = ticker; tick()` run the
method with `this` undefined, and the first `this.x` throws TypeError. tsc,
oxlint's preset and `safe-ts check` all passed them (the soundness corpus
counted the class `unbound-method-this` as escaping).

The places the by-name machinery already visits as a function used as a value
(an argument, a return, an object or array literal, an assignment, a field's
value, a JSX attribute), and a `const` copy or a destructuring, now record the
method they name, through the same receivers the failure rules follow. The
whole-program pass reports it (an error) when that method is an instance
method of a module-level class whose body uses `this` or `super`: not an
arrow-function field, a `static` method, a method that doesn't use `this`, a
decorated one, one the constructor binds, `this.tick.bind(this)`,
`() => this.tick()`, or `items.forEach(this.tick, this)`. The quick fix binds
it (`.bind(<object>)`) where the object is `this`, `super` or a plain name;
the meaning test runs it.

`unbound-method-this` no longer escapes and comes out of escaping.txt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Receivers: an awaited call in the same expression, a readonly field holding an object literal; unbound-method through super
All checks were successful
Tests / test (pull_request) Successful in 8m52s
Benchmarks / bench (pull_request) Successful in 3m12s
2f8e2d1626
Three receivers the previous two commits left silent:

- `(await makeLater()).load("")` wasn't followed, while
  `const repo = await makeLater(); repo.load("")` was. The awaited call is now
  the same value as the local holding it (`Callee::Returned` from
  `member_target`, `Value::Returned` from `value_of`).
- `private readonly api = { load(id) { ... } }` and then `this.api.load()`
  wasn't followed, while a module-level object literal and a field
  `= new Repo()` were. A `readonly` field's object literal is now keyed like a
  module-level one (`Holder#api.load`) and the field resolves to it.
- `setTimeout(super.reset, 5)` was silent when the parent's constructor sets
  `this.reset = this.reset.bind(this)`: the exemption removed the method from
  the ones that use `this`. That assignment makes an own property of the
  instance; `super.reset` reads the prototype's method, still unbound. The
  exemption now applies only to a read through the instance (the constructor
  of the method's class, or of the object's class or one between).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	crates/safe_ts_core/tests/meaning.rs
#	docs/.vitepress/config.mts
# Conflicts:
#	CHANGELOG.md
#	README.md
#	crates/safe_ts_core/tests/meaning.rs
#	docs/.vitepress/config.mts
Open: `Mut<T> = T`, so TypeScript saw nothing. A `Dog[]` passed as
`Mut<Animal[]>` got a cat pushed into it, a function taking `Mut<T>` fitted a
`(value: T) => void` slot that only lends to read, and no call showed which
arguments it changes. All of it passed strict tsc with no cast or `any`.

Closes it at the type level: `Mut<T>` is `T` with a mark only `mut(value)`
adds, checked in both directions. tsc now refuses a value passed to a `Mut`
parameter without `mut(...)`, `Mut<Dog[]>` as `Mut<Animal[]>`, and a `Mut`
function in a read-only callback slot; it still accepts a `Mut<T>` read as `T`,
`Readonly<T>` or a readonly view, passed on to another `Mut<T>`, and array and
Map methods on it. `mut` is the identity, overloaded so `mut(maybe)` stays
`Mut<T> | undefined`. `mut` joins the prelude. packages/std/test/mut.check.ts
pins each refusal and acceptance with tsc; std's own `updateEach` callers lend
their arrays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: with `Mut<T>` nominal, the editor and lint paths (which don't run tsc)
said nothing about a missing loan, nothing refused two loans of one object in
one call, `mut(x)` would reach the build as a call, and an adopter had no way
to move thousands of call sites.

- `missing-mut` (new, error): an argument at a parameter or prop declared
  `Mut<...>` without `mut(...)`, across files: functions, nested functions,
  methods, callback types, JSX props, Vue template props. Also a `Mut` value
  passed on, which tsc accepts, so every lending call shows it. Quick fix wraps
  it and imports `mut` (no fix for a fresh literal).
- `aliased-mut` (new, error): one call lends `x` and also gets `x`, a part of
  it or what holds it (Rust's E0499 / E0502), through `const` aliases. A part
  declared primitive (followed across files) is a copy and isn't reported; an
  unsettled type isn't either.
- Where a loan starts: `mut(p)` of a borrowed parameter is `no-param-mutation`,
  `mut(state)` in a function `no-mutable-global`, `mut(items)` in a loop over
  `items` `no-mutation-while-iterating`, `mut<T>(x)` of a non-fresh value
  `no-unchecked-cast`, `mut(x)` at a non-`Mut` parameter `unneeded-mut`.
  borrow.rs, lifetime.rs follow through `mut(...)`.
- The transform erases `mut(x)` to `x` on its line in scripts and Vue
  templates, so every path (Vite, Node, Bun, `safe-ts emit`) gets it.
- `safe-ts migrate mut <dirs> --write`: `missing-mut`'s fix over a whole
  program in one pass, `Mut<Option<T>>` -> `Option<Mut<T>>`, notes for what it
  can't decide; lines under `@ts-expect-error` stay.
- api-diff: `T` -> `Mut<T>` breaking (callers must lend), `Mut<A>` ->
  `Mut<B>` breaking (invariant), `Mut<T>` -> `T` compatible for parameters.
- Fixtures migrated with the codemod; new `loans` fixture, codemod cases (with
  tsc and vue-tsc on output, probes), meaning.rs entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the guides said `Mut<T>` is a checker-only type TypeScript sees as `T`,
examples passed values to `Mut` parameters without a loan (no longer valid
TypeScript), and the corpus listed `aliased-mut-borrow`,
`covariant-mutable-array-param` and `mut-callback-smuggle` as escaping.

Closes: rule pages for `missing-mut` and `aliased-mut`; `no-param-mutation`,
`unneeded-mut`, `no-mutable-global`, `no-mutation-while-iterating`,
`no-unchecked-cast`, the state, quick-start, proof-types, api-diff, Vue state
and adoption guides (a `mut` codemod section, checked against its output)
rewritten for loans; examples migrated with `safe-ts migrate mut`; README
tables and known gaps; the migration skill's upgrade step, pattern and tool
gap; CHANGELOG under Added and, as a breaking change with the upgrade steps,
Changed. The corpus generators write the new call form, and the three classes
come off scripts/soundness/escaping.txt: tsc refuses the covariant loan and
the callback, `aliased-mut` the double loan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure contracts: a function type says whether it can fail (Throws, Throwing, failure-contract)
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m13s
Tests / test (pull_request) Successful in 9m26s
78603babc0
Open: the failure rules followed a call only into a body. A call through an
interface member, an abstract method, a base class's method that a subclass
overrides, or a callback kept in a field or a list runs whatever was put
there, so nothing was propagated through it and nothing put into it was
checked: an implementation's PropagateError reached callers that were never
asked to handle it, silently.

Closed: like a trait method's signature, a function type now declares what it
may throw. std's result module (and the prelude) gains `Throws<R, E>` (R to
TypeScript) and `Throwing<Args, R, E>`; an async slot declares what it rejects
with as `Promise<Throws<T, E>>`. A function type that says nothing declares no
failure.

- analyze/contracts.rs reads every function type where inference ends
  (interface and type-literal members, abstract methods, type aliases,
  parameters', fields' and locals' types, a function's own return type) and
  records the values put into declared types: object literals, instances,
  functions written in place or by name, array literals.
- A call through a declared type propagates what it declares (`store.get()`,
  `task.run()`, `job()`, items of declared collections, members taken off one,
  fields declared with a function type); a method called on an item of a
  declared array of a class is followed to that class.
- New rule `failure-contract`: a class's methods against the interfaces it
  implements, object literals and visible instances against the interface they
  go into, overrides against the method they override (declared or inferred),
  abstract implementations, a body against its own Throws, and a callback kept
  for later against the type it is kept as. A kept callback whose type is a
  function type written in the project was uncaught-propagation and is now
  failure-contract; a Throwing type that declares the failure allows it.
- Callbacks a function calls right away stay inference, with no declaration.

Fixture expectations changed from uncaught-propagation to failure-contract
where the kept callback has a declared function type (passed_callbacks,
spellings, test_runners/shadowed.ts); test_runners/fakes.ts now expects the
fake that throws under an undeclaring type, with a declared variant that
passes. The fixture harness takes several annotations on one line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: a parameter, local, field or return type declared `Mut<Service>` was read
as the class `Mut`, so the failure rules (uncaught-propagation, floating-rejection,
must-use-result, unhandled-failure) didn't follow `service.load()` on it. With
`Mut` nominal, every function that changes a service takes `Mut<Service>`, so
the receiver following was off exactly there.

Closes it: `annotated_class` unwraps `Mut<...>` and `Option<...>` (parameters,
locals), and `type_ty` follows `Mut<T>` and `Option<T>` (fields, unions, return
types), as it follows `T | undefined`. Fixture receivers/lent.ts writes each
case on a `C` and on a `Mut<C>`: propagating, rejecting and Result-returning
methods are reported the same; a caught call and a safe one stay silent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the mark `(invariant: T) => T` refused every narrowed loan. A `Mut<Unit>`
narrowed to its `Builder` member by a tag test, `is`, a `match` handler or
`variant` couldn't be passed on or lent again to a `Mut<Builder>` parameter, so
a `Mut` of an enum could never reach a function that changes one variant.

Closes it: the mark is `(value: T) => void`. A `Mut<A>` still fits a `Mut<B>`
only when the types fit both ways, so every refusal stays (a Dog[] lent as
Mut<Animal[]>, Box<Dog> as Mut<Box<Animal>>, no mut(), a Mut function in a
read-only slot, Mut<Builder> passed on as Mut<Unit>); narrowing keeps the loan's
mark, so the narrowed member is accepted, and whatever the callee writes keeps
it a valid member of what was lent. No program was found that the new mark
accepts and that ends in a wrong state. mut.check.ts pins the narrowed forms,
width (generic `T extends Entity`) and typed arrays (`<ArrayBuffer>` or generic).

Docs: the type's comment says why the mark isn't invariant; the state guide,
CHANGELOG, README, skill and rule pages describe the mark, the generic form for
a value with more fields than asked for, and typed arrays; the upgrade steps
no longer name a version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the mark `(value: T) => void` compared whole types, so a value with more
properties than asked for (a Tree where Mut<Entity> is asked, a Sprite for
Mut<Container>), a writable list where Mut<readonly T[]> is asked and a typed
array made with `new` were refused, though the callee can't break any of them:
134 + 27 + 3 of 251 tsc errors on a migrated adopter. And the advice to make
such callees generic was unsound: TypeScript lets a generic body write the
bound's type into a narrower `T["x"]`.

Closes it: the mark lists, per property of T, a slot: invariant where the
callee may write it, covariant where it can only read it (`readonly`) or calls
it (a method, rebuilt as a plain function type so its parameters count one
way, which keeps `Map<string, 1>` out of `Mut<Map<string, number>>`). Every
hazard stays refused (Dog[] as Mut<Animal[]>, { x: 0 | 1 } as
Mut<{ x: number }>, a Map of a narrower value, Mut<Builder> as Mut<Unit>, a
narrower override); width, subclasses, readonly views, typed arrays and
narrowed unions are accepted. What it newly accepts (a delete through a Record
target, Object.assign through Mut<object>) is reachable under the old mark by a
plain assignment first. mut.check.ts pins each case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: a value put into a place declared Mut<...> without a call (an
initializer or assignment, a parameter's default, a field, a `return`, an
array literal where readonly Mut<T>[] is asked) wasn't reported or migrated,
and a fresh literal at a Mut slot got no fix: 30 + 17 tsc errors after the
migration on an adopter, all mechanical.

Closes it: `missing-mut` reports those places (per file, as Slot), and its
fix, which `safe-ts migrate mut` applies, lends them; a fresh literal is lent
with the place's type (`mut<Cost>({ ... })`, `mut<number[]>([])`) where the
file can name it, else only `[]`/`{}` are left as notes. Returns count through
Promise<Mut<T>> and Generator<Y, Mut<T>, N>. Fixtures, the codemod case (tsc on
its output) and meaning.rs cover it. Docs: the state guide's table and "what to
write" for the new mark, missing-mut, adoption, README, CHANGELOG, skill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the prelude declared `type Mut<T> = lending.Mut<T>`, a second alias. TypeScript infers
`T` of a generic `f<T>(child: Mut<T>)` from the type arguments only when the argument and the
parameter name the same alias; from a `mut(sprite)` (std's `Mut`) at a parameter written with
the prelude's `Mut` it inferred `T` as the whole `Mut<Sprite>`, and asked for a
`Mut<Mut<Sprite>>`. The mark let that through only by comparing two `Shared<...>` by the
variance TypeScript measures for the alias; compared property by property, a class whose
method returns `this` doesn't lend as `Mut<Mut<...>>`, and every such call failed (16 of an
adopter's errors at the round-3 mark were this inference, typed arrays among them).

Closes it: `export import Mut = lending.Mut` names std's own type in the global scope (the
namespace import is no longer `import type`, which an import alias can't reference). The
prelude test pins the generic call; the table test reads `export import` lines as types.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mut lends what a readonly property holds: the same rule, as deep as it goes
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m24s
Tests / test (pull_request) Successful in 9m27s
48b76f39da
Open: the mark compared a `readonly` property one way, as covariant, but `readonly` is shallow.
A `{ readonly dogs: Dog[] }` lent as `Mut<{ readonly dogs: Animal[] }>` was accepted and the
callee pushed a cat into the list (`Dog[]` as `Animal[]` one property down); also a
`{ readonly state: { on: 0 | 1 } }` lent where `on: number` is written, a subclass narrowing a
`readonly` field that holds a list, a `Map` of a narrower value in a `readonly` field. And two
`Shared<...>` were compared by the variance TypeScript measures for the alias, which ignores
`readonly`: a `{ readonly n: number }` was lent where the callee writes `n`.

Closes them: each property's slot is `{ w, r }`: `w` whether the callee may replace it
(the same type both ways, or never), `r` what it holds, an object lent as a loan of its own
(`Lent<X>`: each member of the value lendable as some member asked, so a typed array's
`ArrayBuffer` fits `ArrayBufferLike`). `Shared` and the slots are written so TypeScript
compares them structurally. Recursive types (nodes with `readonly children`) check, and an
adopter's ten projects reach no depth limit; tsc takes 8.3 s and 1,295 MB where the round-3
mark took 8.0 s and 1,210 MB (minimum of three interleaved rounds).

Left open, documented on `Mut`, in the guide and as escaping corpus classes: a function in a
writable property replaced by one that needs more (compared one way like a method: compared
both ways, 97 more of the adopter's errors, subclasses lent as their base and typed arrays),
and a write through a member shared by a `readonly` property's union.

Corpus: mut-readonly-field-list, -object, -subclass (refused; each escapes with the round-3
mark), mut-function-field-replaced and mut-readonly-union-field-write (escaping.txt).
mut.check.ts pins the refusals, the recursive tree and the two open holes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: for Node's built-ins and the browser's APIs the project had complete maps, each failing
member made to fail by a test; for the language's own built-ins there was only a short list
inside the checker, so `reduce` on an empty list, `toISOString` of an invalid date, `toFixed`,
`repeat`, the `Intl` constructors, `DataView` reads and bigint `/` were known to nothing.

Closes: crates/safe_ts_core/ecmascript/ecmascript-api.json maps all 1,110 callables of the libs
lib.esnext.d.ts references (Intl, the typed arrays, DataView, Atomics, Temporal included) in
the Node and browser maps' categories: 290 throws, 224 propagates, 12 returns, 45 args, 539
never (`limits` lists the members whose only failure is a result past the engine's limits).
Each failing member has its error in the packs' notation and its condition; `checks` says what
unhandled-failure looks at before it reports one; `operators` lists bigint `/`, `%`, `**`;
`platform` the web globals both runtimes have (atob, btoa, structuredClone, new URL); `values`
the time zones and units an Intl option takes. inventory.ts enumerates the lib, triggers.ts makes
every failing member fail, and errors.test.ts (now part of `npm run test:std`) checks the map
against the installed TypeScript and the running Node: 290 of 290 throwing members and the four
web globals fail with the class their text names, none is written from the spec alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `prices.reduce((a, b) => a + b)`, `new Date(input).toISOString()`, `" ".repeat(width -
text.length)`, `n.toFixed(digits)`, `n.toString(radix)`, `toLocaleString` with a time zone from
data, `new Array(count)`, `String.fromCodePoint(code)`, `text.normalize(form)`, a DataView read
past a buffer it was given, and bigint `/` by `0n` passed every gate and threw at run time; and
`BigInt(1)` was reported though a literal integer can't fail.

Closes: the hand list in analyze.rs is gone; a call of a member the map's `checks` list is
reported unless it is shown unable to fail (crate builtins.rs, analyze/builtins.rs):
- the receiver's class comes from its shape (a declared type here or in another file, through
  `Want::NotBuiltin`, a literal, `new X()`); a receiver of no known class isn't reported;
- the receiver's state: `reduce` with an initial value, or on a list bounds.rs proves non-empty
  (also a tuple type, a non-empty literal and what `.map` makes of one); `toISOString` of a date
  parsed from text (also through a field declared `string` elsewhere) unless checked with
  `Number.isNaN(date.getTime())`; a DataView made over a buffer the function was given whose
  length nothing reads;
- an argument: fine when written in the code (literal, const, literal objects), checked against
  the range just before (bounds.rs now answers what an argument is known to be, also for a value
  that isn't an integer, and whether `NaN` is excluded), or computed by the function itself; one
  from data (a parameter, something read off one or off `this`, Number(text), JSON.parse) is
  reported, as is a literal known to be wrong (`toFixed(101)`, a malformed tag, a time zone that
  doesn't exist);
- bigint `/`, `%` (also `/=`, `%=`) by a divisor not known to be non-zero, `**` by an exponent
  not known to be non-negative.
Messages name the condition and what to write (an initial value, a check of the date, padStart
for padding, a check of the argument or divisor, the formatter made once in unsafe(...)).
Narrowed after reading an adopter's findings, where each was in range for a reason the checker
can't see: typed-array and buffer lengths, `ta.set(src, offset)`, dates made from numbers or out
of sight, DataViews in fields or over checked buffers, arguments the function computes itself.
The soundness corpus drops seven classes. Fixtures: builtins/ (new); loops/main.ts:15 and
unbounded_spread/main.ts:20 now also expect unhandled-failure (`reduce` without an initial value
on a parameter, `String.fromCodePoint(...points)` of data). Docs: guide/builtins.md (new), the
rule page, libraries.md, README, CHANGELOG, the migration skill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the checks that ask for an argument written in the code (Temporal, fromBase64,
DisplayNames#of) refused the arguments left out after it, so a literal call was reported.
Closes: those arguments may be left out; the builtins fixture covers a Temporal call from text
and one written out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: built-ins that answer "there is none" with a value of their own type passed tsc strict,
safe-ts check --idiomatic and oxlint, and the code went on with a wrong value:
`items.splice(items.indexOf(item), 1)` removing the last element, `text.slice(0,
text.indexOf(mark))`, `items[items.indexOf(from)] = to`, `sum / values.length` of an empty
list, `2026 - new Date(input).getFullYear()` for text that isn't a date. And
`const slots: number[] = []; slots[n] = 1` left holes that `slots[k]!` under
`k < slots.length` (accepted by no-unchecked-cast) read as a number.

Closed:
- not-found-index (new, warning): a search result (indexOf, lastIndexOf, findIndex,
  findLastIndex, search) used as a position (splice, slice, substring, at, with, ..., an index
  written to, an index read past it) before a comparison with -1 or `< 0`. The `+ 1` idioms of
  slice/substring/splice, answers known to be found (literal of a const list, a value typed
  `(typeof LIST)[number]`, after includes, the element of a for...of over the list or a copy)
  and project types with their own method are left alone; the message points to std's indexIn.
- number-parse-nan: Date.parse(text), and numbers read from new Date(text), before a
  Number.isNaN(date.getTime()) check. Dates from the clock, milliseconds or parts are valid.
- divide-by-length (new, warning): a division or remainder by a list's length where nothing
  shows the list isn't empty. Only lengths: any non-literal divisor was ~1,700 findings on an
  adopter with none real in a sample.
- sparse-array-write (new, error): a write past the end of an array filled by position, at
  `a.length + k`, or `delete a[i]`. Any write the bounds proof can't show inside an array (not
  a typed array) now also stops `a[i]!` from being proved on it in the file.
- The bounds proof also learns non-empty arrays from for...of bodies, per-element callbacks,
  assert.ok, copies after a check, tuples with a rest and literals; a search result's range;
  fill loops and compaction.

Soundness corpus: sentinel-splice-indexOf-neg1 and bounds-sparse-hole no longer escape.
division-by-zero-nan still does (its second program divides by a parameter).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A date one step from text: a number parsed from it, and what a project function returns
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m57s
Tests / test (pull_request) Successful in 8m28s
fc1c46ac18
Open: `new Date(text).toISOString()` was reported, but `new Date(Date.parse(text))` (also
`Number(text)`, `parseInt`, `+text`, a const holding one) was not, and neither was
`parseStamp(text).toISOString()` with `parseStamp` returning `new Date(text)`, in the same file
or another: the first rewrite an agent would make, throwing the same RangeError.

Closes: a date made from a number parsed from text is reported as one parsed from text, unless
that number was checked with `Number.isNaN` / `Number.isFinite` first. Each function's summary
now records whether it returns such a date unchecked (`FnInfo::invalid_date`), or another
function's date (`dates_from`); a caller's `toISOString()` / `toTemporalInstant()` /
`formatter.format(date)` of what it returns is reported locally and kept by the whole-program
pass only if the callee (followed across files and through functions returning another's date)
returns one, the message naming where the date is made. A check in the function before it
returns, or in the caller before the use, clears it. A Date parameter or field stays unreported.
No change on the adopter or the examples. Fixture: builtins/dates.ts and the new cases in
builtins/main.ts. Docs: guide/builtins.md, the rule page, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sentinel values, review round: narrow divide-by-length and not-found-index to what the code shows
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m18s
Tests / test (pull_request) Successful in 6m39s
e9bcf8868a
Open (review of 2f411346): divide-by-length was right 2 times in 29 on an adopter, the others
lists a caller always fills; not-found-index was right 7 times in 41, 28 of the others an
element known to be in the list; `new Date(a) > new Date(b)` wasn't reported; `[1, 2, 3].length`
as a divisor and a fill by a forEach callback's index were.

Closed:
- divide-by-length looks only at the length or size of a collection the function itself made
  by selecting (`filter`, `flatMap`, `[]` / `new Set()` / `new Map()` grown only under a
  condition), not a parameter's, a field's or a module-level list's. On the adopter: 1
  finding, real. The acceptance lines that divide by a parameter's length are no longer
  reported, nor is the testing guide's `average(values)` (restored as accepted).
- not-found-index knows the element is there when the function pushed it, took it out of the
  list with find / at / an index, loops over the list or a filter or copy of it, or built the
  list literal from it; and doesn't check test files (1 of 23 findings there was real). On the
  adopter: 18 findings, 7 real (was 41, 7 real).
- number-parse-nan reads a date made inline in a comparison or subtraction.
- The bounds proof knows a literal's length, and that a forEach / map callback's index and
  `entries()`'s fill an empty array in order; a fill no longer fails on an alias made after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contracts: name the span helper so it can't collide with another module's
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m30s
Tests / test (pull_request) Successful in 7m0s
db642660f6
Two branches each added an inherent method `text_of` to the analyzer, with
different signatures. Each compiles alone; together they are a duplicate
definition. This one reads a span's source text: `span_text`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merge failure-contracts: build on it
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m22s
Tests / test (pull_request) Successful in 7m19s
fdac858d40
# Conflicts:
#	CHANGELOG.md
#	crates/safe_ts_core/src/analyze.rs
Merge origin/ecmascript-builtins: the sentinel checks on top of the built-ins map and failure contracts
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m31s
Tests / test (pull_request) Successful in 7m9s
c451e43a9e
Both branches rebuilt the bounds proof. `Bounds` keeps both sets of answers (verdicts and the
divide-by-length / sparse-array-write diagnostics; numbers, non_empty, in_bounds for
builtins.rs). Each visitor both sides had is one method: the division and the hole checks look
at the facts before the operands are walked, the built-ins' questions are asked after
(visit_call_expression, visit_binary_expression, visit_assignment_expression; their
visit_new_expression as it was). shape.rs keeps both `new` cases; escaping.txt drops both
sides' closed classes; CHANGELOG keeps both sides' entries.

In meaning: the non-empty facts the sentinel work added (a for...of over the list, assert.ok,
a copy after a check) now also let `reduce` without an initial value go unreported there
(fixture cases added). A date check accepted by number-parse-nan (`String(d) === "Invalid
Date"`, `Number.isInteger(d.getTime())`) now also clears unhandled-failure's `toISOString`.
The not-found-index fixture's `with(-1, v)` example was rightly reported by unhandled-failure
(it throws for an empty list): the example uses `toSpliced` now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge origin/sentinel-values: the nominal Mut on top of failure contracts, the built-ins map and the sentinel rules
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m29s
Tests / test (pull_request) Successful in 7m16s
5a38e979db
Conflicts: both sides appended to CHANGELOG.md (Added and Changed: both kept), README.md (the
prelude's names: `Throws`, `Throwing` and `mut` together; the known gaps: both entries), the
docs sidebar (`failure-contract` under Failures, `missing-mut` and `aliased-mut` under State),
the prelude's compile-time test (both blocks), `mod contracts` and `mod loans` in project.rs,
and escaping.txt (neither side's removed classes; my two open Mut holes added).

In meaning: a receiver declared `Mut<C>` is now read as `C` by failure-contract too, so
`port.onmessage = f` with `port: Mut<Port>` gets the `failure-contract` a plain `Port` gets
(entry_points fixture), and a call through a `Mut` of an interface whose slot declares
`Throws` propagates what the slot declares (pinned in receivers/lent.ts, also through
`Option<Mut<C>>`). One call that lends a value twice and passes a failing callback kept for
later reports `aliased-mut` and `failure-contract` once each (pinned). The migration changes
none of the other branches' fixtures; their docs, skill examples and corpus programs only
declare `Mut` parameters and compile with the nominal type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
failure-contract: one finding for a declared on... member, the same for a name and its arrow
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m15s
Tests / test (pull_request) Successful in 7m35s
ebcc2e07c8
Open: `port.onmessage = find` with `port` of a type the project declares was
reported twice, as a runtime handler (uncaught-propagation) and as a function
put into a typed slot (failure-contract), while `port.onmessage = (id) =>
find(id)` got only uncaught-propagation. A field initializer by name
(`handler: Plain = find`) was checked against the field's type while its arrow
twin was left to inference.

Closed: an `on...` member of an object whose type the project declares is a
slot like any other. A function assigned to it, by name or written in place,
is checked against the member's type (failure-contract) and nothing else; a
platform or package object's handler (`worker.onmessage = ...`) has no slot
and stays uncaught-propagation. Calls and throws now record where the callback
that runs them later starts, so the arrow's inner failures find the member.
A field's function initializer is followed by inference in both forms, and
held to the field's type in both forms when that type declares failures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge failure-contracts: one finding for a declared handler slot
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m53s
Tests / test (pull_request) Successful in 7m59s
0b85edd506
Merge ecmascript-builtins: one finding for a declared handler slot
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m43s
Tests / test (pull_request) Successful in 7m33s
e802978283
Entry points fixture: a platform handler and a declared slot, one finding each
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m30s
Tests / test (pull_request) Successful in 7m11s
7c4a3e211e
With one finding per handler slot, a function assigned to an `on…` member of the
project's own type is a `failure-contract`, and a platform object's handler stays an
`uncaught-propagation`. The fixture now holds both, by name and as an arrow.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Open: each rule that asks "did A happen before B on some path" had its own walker with
its own idea of branches, loops and exits (number-parse-nan and not-found-index took source
order, stale-read an ancestor walk, holders and bounds their own exits).

Closes the first step: flow.rs builds a graph per function body on request (if, ?:, &&/||/??
as jumping code, optional chains, loops with back edges, switch fall-through, labelled
break/continue, return/throw, try/catch/finally with a finally copy per way out; nested
functions are one point; await/yield end their block) and a bitset forward data-flow driver
(Meet::Any / Meet::Every, replay). number-parse-nan decides "used before a check" on it:
identical on the adopter; three fixture cases the source-order walk got wrong (a check in the
other branch, a use on the next loop round, a new value assigned).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the rules that judge a value by its type went by the type written on it. A function
without a declared return type gave them nothing (`const n = count(items); if (n)` was silent
while `const n: number` was reported), and must-use-result didn't follow a Result through a
return type written as an alias, nor through `err(...)` in a `?:` branch.

Closed:
- shape.rs reads a function's result off its `return`s when every one is plain (literals,
  `.length`, arithmetic, comparisons, calls of functions whose result is known, `err(...)`,
  `validate<T>`, declared locals, built-in methods of plain values), for declarations, arrows,
  function expressions and methods of `this`, local and imported. Anything else stops the
  reading: unknown, never a union with an unknown part. Generic, recursive (any function met
  again while read), overloaded and reassigned functions stay unknown. Read once per function
  and file. A parameter typed with a function type gives its declared result; `a * f()` with
  a number on one side is a number.
- written.rs: one opener for written types (aliases of aliases, imported, generic aliases with
  their arguments bound where they are written, stopping visibly at conditional / mapped /
  `typeof` / indexed types and at std's own names). must-use-result, catch-on-result and the
  other callee checks use it (`FnInfo::returns_named`, cached per pass); json::value's alias
  shortcut goes through it.
- New rule undeclared-return-type (idiomatic, off unless named): a function whose result can't
  be read off and isn't declared. Exempt: typed by where it is written, returns nothing, a
  single test (TypeScript infers its predicate), a component, test files. Quick fix where every
  return names a type the file can write.

Fixture change: failures/stringify.ts `JSON.stringify(untyped(n))` is no longer reported
(`untyped` returns `[n + 1]`, now read off as number[]); a `new` of a project class keeps the
case reported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What was open: each of these passed tsc strict, `safe-ts check --idiomatic --deny-warnings`
and oxlint with the preset, and none was counted or ratcheted.

- `// @safe-ts std` / `// @safe-ts legacy`: one comment turned every rule off for a file (and
  `std` made its functions count as never failing for callers), and nothing said who may write
  it. Now a marker counts only in files the nearest "safe-ts" package.json lists under
  "trustedFiles" / "legacyFiles" (patterns as in "overrides", relative to it). Anywhere else it
  is an `unlisted-marker` error at the marker and the file is checked, transformed and followed
  as if it weren't there: check, the editor, the oxlint plugin, the Vite plugin and the loader
  all go through `Project::markers_allowed` (part of the analysis cache key). Library code in
  node_modules keeps its markers. `safe-ts check` prints, per package.json, the lines that list
  every marked file it found. The repository's packages, the demo, the fixtures and the docs
  examples list theirs.
- `eslint-disable*` / `oxlint-disable*` comments were counted nowhere, and silenced the oxlint
  plugin. Now all are counted; a blanket one or one naming a `safe-ts/` rule is reported by the
  new `no-lint-suppression`, on the directive's name inside the comment, where oxlint's own
  directive ranges don't reach (measured: a block directive applies from its comment's end, a
  `-line` one to the code before the comment). A named rule of another linter is only counted.
- `declare const | let | var | function | class | enum | namespace`, `declare global`,
  `declare module "..."` and the project's own .d.ts files were casts with no `as`. Now they
  are counted, the CLI checks the .d.ts files under the entries' directories (as the editor and
  oxlint already did), and the new `no-unchecked-declare` reports what asserts a value nothing
  checks (a type other than `unknown` or one admitting `undefined`, functions, classes, enums,
  required members added to a built-in or in a package augmentation, values added to a project
  module, `declare module "x";` with no body).
- `defineSanitizer(...)` was not counted; now it is, also through `export *` and renamed
  re-exports in project modules (and so are re-exported `trust()` and `panic()`).

The three counts are in the summary line, `--json --summary` and the baseline, and a test holds
the three together. An old baseline without the new keys loads; a missing count is 0, so the
gate fails once with a note until it is written again.

Soundness corpus: four new classes (unlisted std marker, unlisted legacy marker, a declared
value, a member declared on Array) that escaped before and are rejected now; the corpus project
lists no marker files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: a value used again after an operation used it up passed every gate (a generator or an
array's iterator iterated twice, an ArrayBuffer used after transfer() or a transfer list, a
Response body read twice, a locked stream, a closed WebSocket, MessagePort, FileHandle or
readline interface), and must-use-result only saw a Result dropped as a statement, not one kept
in a local and only logged.

Closes:
- use-after-consume (an error, on by default), on the flow layer: a fact per operation site,
  set where it runs, cleared by a new value or releaseLock(); a second solve on every path
  words "on one path". Which operations consume, what state they leave and which uses fail is
  data: a `consumes` section in ecmascript-api.json, browser-api.json and node-api.json
  (compiled in; a platform's findings kept where its pack is on), demonstrated on Node
  (ecmascript/consumes.test.ts, packages/feature-*/test/consumes.test.ts) and, for Worker and
  the global postMessage, in Chromium, Firefox and WebKit (test:browsers). The packs' safe
  versions count as the member they stand for. A view made on a buffer before the transfer
  reads the detached buffer (reported); one made after throws where it is made.
- must-use-result: a call kept in a local (kept.rs) that, on some path to an end after the
  last code that looks at it, nothing looks at, or that a new value replaces first; the
  whole-program pass reports the ones whose function returns a Result. Logging and string
  conversion aren't looking; handing it on, storing it, capturing it, returning it are. An
  exception and an early return before the look aren't drops; a short-circuit test of several
  counts for each.
- Soundness corpus: one-shot-generator-reused and use-after-consume-arraybuffer come off
  escaping.txt; new classes response-body-read-twice and result-kept-only-logged (both escape
  at the starting commit, both rejected now).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the new rule, the kept-Result part of must-use-result, the consumes format and the paths
number-parse-nan now follows were undocumented, and two pages said number-parse-nan takes source
order.

Closes: docs/rules/use-after-consume.md (idiomatic forms first, what it can't see),
must-use-result's "A Result kept in a local", docs/guide/flow.md, the `consumes` format in the
libraries guide (and a pointer from the built-ins guide), number-parse-nan's and
not-found-index's pages, README (rules table, known gaps), docs index and sidebar, the errors
guide, CHANGELOG (Added: the rule and the flow layer; Changed: must-use-result and
number-parse-nan, with what to write instead), and the migration skill's patterns and tool gaps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `Result<T, E>` is `T | Err<E>`, so a `Promise<Result<T, E>>` is a `Result` too. `q`,
`isErr`, `isSome`, `unwrapOr`, ... accepted a promise nobody awaited and answered "no error";
TypeScript and the checker let a promise through as text, under `!`, `||`, `??`, in a
comparison with `undefined`; an async predicate handed to `filter` (or to a project function
declared `(x: T) => unknown`) kept every item; and an async call that can't reject, dropped as
a statement, let the caller go on with nothing reporting it.

Closed:
- std: the functions that read a value refuse a promise in their types (`PromiseCheck`,
  `AwaitFirst`: "this is a promise: `await` it, then pass the value"), via a last type
  parameter whose undecidable default falls back to its constraint, so generic code and a
  `Result<Promise<T>, E>` written on purpose still compile. Checked under TypeScript 7 and 5.9,
  and over an adopter copy: nothing new stops compiling.
- `promise-as-value` (error): those calls, the places TypeScript lets a promise through, an
  async callback handed to a built-in that reads its answer right away (the map's new
  `callbacks`, tested on Node; the ones lib types are left to tsc), and to a project function
  whose parameter type lets one through and whose body reads it. Quick fix: Add await.
- `floating-promise` (warning): a dropped promise that can't reject; never the same call as
  `floating-rejection`; not the last statement of an event handler or timer.
- Soundness corpus: five classes (promise-read-as-result, promise-read-as-text,
  floating-promise-ordering, async-callback-read-right-away,
  async-callback-read-by-project-function), all escaping at e8029782, all rejected now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: npm run typecheck failed on packages/pack-kit/consumes.ts (a DOM-only type name, and a
check TypeScript took for always true). Closes: a structural type for the read result, and the
demonstration typed as possibly missing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open (review of 10f1e996): the read-off result reached only some rules and only bare-name
callees; literals were widened where TypeScript keeps them; q-needs-result-return, sentinel-error
and misplaced-axios-check didn't open aliases; the rule was off unless named.

Closed:
- tests/pairs.rs: one body written twice, with the type TypeScript infers declared (tsc checks it
  is) and without; six uses each; the two must get the same findings. 67 pairs, 0 differ.
- Calls followed however they are spelled: object-literal members, class methods, getters,
  statics and fields (this file's and imported, also through a field typed with the class),
  namespace imports, `export * as`, default exports; `new` of any class.
- Literals keep their literal type in a `const` and a union of returns, widen in a `let`, a
  property and a lone return (`Shape::Fresh`, `Shape::Widen`).
- no-null-check-for-undefined asks the shared shape where its own model can't tell
  (`Want::NoNull`; `null` literals kept apart as `Prim::Null`).
- q-needs-result-return (`Root::Written`), sentinel-error (`SentinelFn::named`) and
  misplaced-axios-check open aliases through written.rs.
- std's `Result` opened as `T | Err<E>` in the evaluator, Vue's `Ref<T>.value`, declared `void`,
  `codePointAt`, a parameter default, `console.*`, `Date` methods, `reduce` with a start,
  `unwrapOr`, Vue's `ref` family with type arguments, `reactive`, `toRef`, a block-bodied
  `computed`, React's `useState` / `useRef` / `useMemo` / `useCallback`; `filter` / `find` over a
  union only where the callback can't be an inferred predicate (or is `x !== undefined`).
- undeclared-return-type: idiomatic, a warning; not in JavaScript files; a component returning
  `items.map(...)` of JSX is exempt. Five doc examples get the type written (package calls the
  checker doesn't read); two idiomatic_rules fixture composables of `useTask` now expect the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What was open after 25d3ef37, and what closes it:

- A hatch was counted only when called by its imported name: `r.trust(x)`, `const t = trust;
  t(x)`, `(0, trust)(x)`, `trust.call(...)`, `r.unsafe(...)`, `stop = panic` counted nothing, so
  `export const forged = r.trust<T>("no")` passed the baseline uncounted. Now one pass over the
  semantic references of every binding that may hold one (named and namespace imports,
  destructuring, dynamic `import()`, prelude names; hatch_refs.rs) classifies each use: a call,
  `.call` / `.apply` / `.bind`, a copy followed to its own uses (an exported copy counts once),
  and any other use counted (handed on, re-exported, a std namespace used whole: fail closed).
  Types (`typeof trust`) don't count. The whole program decides which imports are hatches,
  through re-exports, and counts `export { x as y } from` of one.
- With std or the Vue package linked into a workspace, `defineSanitizer` counted 0: the
  resolver calls those files the project's. Now the package.json that owns the defining file
  says what it is, and a SAFE-TS package's own files aren't counted as uses.
- vue-tsc's `<!-- @vue-ignore -->`, `<!-- @vue-skip -->` and `<!-- @vue-expect-error -->` were
  neither reported nor counted. Now `no-ts-suppression` reports ignore, skip and a reasonless
  expect-error; ignore counts with @ts-ignore, expect-error with @ts-expect-error, skip as the
  new `vueSkips`.
- A disable of an oxlint rule the preset makes an error (`no-eval`, `no-proto`, ...) passed
  silently: those rules are how SAFE-TS bans the constructs. Now one without `-- reason` is
  reported by `no-lint-suppression`. The same at config level: `.oxlintrc.json` next to the
  package.json (JSON with comments) is read, and a config not extending the preset, a preset
  rule turned off or down in "rules" or "overrides", and "ignorePatterns" are named as weakened
  settings, which the baseline ratchets.
- `declare value: string` in a class was silent while `value!: string` is a cast. Now it is
  reported by `no-unchecked-declare` and counted with the ambient declarations.
- Docs that teach a `declare` form are checked with the rule on (`declares` fence word), and
  say what the rule asks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open (review): a buffer transferred through its view (`[pixels.buffer]`, `pixels.buffer.transfer()`)
left the views unreported; `maybe?.transfer()` wasn't seen; `const same = buf` was a stranger;
and the browser and Node `consumes` were compiled into the checker, so a third-party pack (or a
project's own) couldn't declare one, and a pack's version could disagree with the checker's.

Closes:
- A pack's `consumes` is read from its safe-ts.json with the rest of the pack (Manifest::consumes;
  the browser and Node packs copy theirs from their API maps when safe-ts.json is generated, and
  the manifest tests keep the two equal). Only the language's map stays compiled in. A pack's
  safe versions come from its manifest's `safe` refs. What a pack gets wrong (an entry described
  differently from an earlier pack, an operation on a state nobody describes, a section that
  isn't one) is a setup warning and that entry is left out (consumed::for_packs, unit tests).
  Fixture consume_pack: a tiny third-party pack with a one-shot cursor.
- Groups (Cx::group): a second name (`const same = buf`, neither reassigned) is the same value;
  a typed array or DataView is a view on a buffer (the one it was made on, `x.buffer`, or its
  own); `x.buffer` in a transfer list or `x.buffer.transfer()` uses up every view of the group.
  `x.buffer.detached` is asking, not using. A reassigned `let`, a property or a destructuring
  isn't followed.
- The flow layer keyed points by span alone, so a call inside an optional chain shared its key
  with the chain (`a?.b()`), and an expression statement without `;` with its expression: points
  are keyed by span and kind now (flow::PointKey). That is what hid `maybe?.transfer()`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Weakened lint settings are named by .oxlintrc.json, the file that sets them
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m54s
Tests / test (pull_request) Successful in 7m48s
6577df1a9a
The check listed `oxlint.rules no-eval off (package.json)`: the setting lives in the
`.oxlintrc.json` beside it, and that is where a reader has to look.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Open: a borrowed object could still be changed without a `Mut` in sight. A method or getter of
the project's own class that changes `this`, called on a borrowed parameter; a part of a borrowed
parameter handed out by a function and changed by the caller; a borrowed object kept in a field
and changed later through the copy; a `Sub[]` bound to a writable `Base[]` local, field, return
or property; and two `Mut` loans of one object alive at once across an async call. Five classes
of the soundness corpus escaped for these.

Closed:
- no-param-mutation follows a method of a project class that changes its object (Rust's
  `&mut self`), from state.rs's per-class summary (fields assigned, also through locals naming
  a part of `this` and elements of a field, changing methods of fields, `mut(...)` of `this` or
  a part, other methods, up the extends chain), resolved at the call through the receivers the
  whole program already follows. A method named like a collection's is decided by its body.
- A call whose function returns the borrowed argument (or a part of it) on every path, or a
  method returning its object or a part of it, hands out something borrowed: changing it is
  changing the argument (borrow.rs `hands_out`, exact paths only, no copies).
- A borrowed parameter kept in `this` (a field, an element, a constructor parameter property)
  is reported at the store when the class changes what it keeps there later; a platform
  object's handler slot set through the copy doesn't count.
- New rule mutating-getter: a getter that changes its object.
- New rule covariant-alias: a written container type bound to a writable place written with
  the same container of another type argument.
- aliased-mut reports two loans alive at once: calls of one Promise.all, a second loan while a
  promise kept in a const isn't awaited yet, an async callback of map/forEach/flatMap that lends
  a captured object to a call it awaits or returns.
- `mut<C>(this)` in an instance method of `class C` is accepted (no no-unchecked-cast): the
  polymorphic `this` doesn't reduce through the nominal mark, and `this` is a C or a subclass.
- `/** @cache */` on a class field: filling it is no change of the object.

Corpus: borrowed-receiver-method-mutation, borrowed-return-escape, covariant-mutable-array-local,
covariant-mutable-field and async-toctou-lost-update come off escaping.txt; new classes
borrowed-receiver-setter, borrowed-getter-part-escape, borrowed-stored-changed-later and
async-pending-loan are rejected. mut-function-field-replaced and mut-readonly-union-field-write
stay listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open (review of dff89f13): the failure rules stopped at the first generic alias or utility type
in a receiver's or slot's declared type (`deps: Services<Repo>`, `Readonly<Deps>`,
`ReadonlyMap<string, Repo>`, `pair[0]`, `await p`, `Partial<Port>`, `Record<string, Plain>`), an
optional call's dropped `Result` wasn't one, and an awaited undeclared `async` result was unknown.

Closed:
- project/receivers.rs resolves a declared type through written.rs (generic aliases and
  interfaces with their arguments bound, `Ty::Shape` keeps the binding), the utility types that
  keep members, a `Map`'s `get`, a tuple's item, a `Record`'s and an index signature's value,
  `await` / `.then` of a promise (`Value::Awaited`); cached per pass by type. The analysis records
  a parameter or local with any written type that has type arguments (also a destructured one),
  and follows it by that type rather than its name.
- contracts: slots see through `Partial` / `Pick` / `Required` / `Omit` / `NonNullable`,
  `Record<K, V>` (`Slot::Record`), a generic alias given its arguments (`Slot::Generic`, bound in
  `bound_slot`); `new Map([[k, f]])` / `new Set([f])` are checked against a collection slot.
- `repo?.check(id);` is a dropped `Result`.
- cache.rs (`@cache` through `Held<Catalog>`, `Partial`) and vue.rs's alias table (a generic
  alias's fields) bind type arguments too; both had the same hole.
- shape.rs: an `async` function read off is a promise of its result, `await` opens it (and a
  declared `Promise<T>`).
- tests/receivers.rs: 28 rows (receiver forms, slot forms, written-out cases), each against the
  plain declared form. tests/pairs.rs: 69 pairs (awaited async results added).

Fixture change: entry_points `listen(port: Mut<Port>)` now reads `Mut<Port>` as `Port`, so its two
handlers are `failure-contract` (a slot whose type declares no failure), as with `port: Port`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kept Results beyond a bare call; the cheap test before any graph; the layer's path table
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m57s
Tests / test (pull_request) Successful in 8m6s
9a540ef57e
Open (review): `const r = flag ? save(1) : save(2)` and `const [a, b] = await Promise.all([...])`
weren't seen as kept Results; the kept-Result analysis built a graph for one function in five on
the adopter's largest entry (2,561 of ~10,500) and use-after-consume for 539, mostly for calls
that can't matter; and the layer was held only by ten unit tests and the rules' fixtures.

Closes:
- Kept: each call of a `?:` / `??` / `||` / `&&` / parenthesised / awaited initialiser, and each
  element of an array destructuring of `Promise.all` / `allSettled` over a list written in
  place, in the binding at its place (fixtures). `const { result } = pair()` isn't (only
  `pair`'s return type says what `result` is).
- The cheap test first. Kept Results: the local pass only lists the kept calls (no graph),
  after two syntactic tests (a const looked at unconditionally by the very next statement; a
  call whose callee the file shows returns a plain type, or a method of a value declared with
  one); the whole-program pass keeps those whose function returns a Result and only then
  parses the file again and builds graphs for them (`unsafe(...)` / `parseJson` stay local).
  use-after-consume: a function gets a graph only if an operation there would use a binding
  up (`Array.from(list)` of an array doesn't); the generator walk runs only in a file with a
  `function*`. On the adopter's `apps/client/src/start.ts`: 3,119 graphs before (2,561 kept,
  539 consumed, 19 number-parse-nan), 40 after (21, 0, 19).
- flow::tests::path_cases: 39 shapes with their answers on some / every path, independent of
  any rule (labelled break and continue, do...while, a loop's update clause, for await,
  continue in try/finally, finally after a return, nested finally, switch with default in the
  middle and falling into it, && / || in a statement and a test, ?:, ??, ||=, optional calls,
  yield and await between, reset, an exception into catch, nested functions, unreachable code).
- Docs: the libraries guide says a pack's `consumes` is read from its safe-ts.json (and the
  manifest example shows it); use-after-consume's page covers views, second names and optional
  calls; must-use-result's covers branches and Promise.all; README gaps, CHANGELOG, tool gaps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open after f10ffd50:
- `promise-as-value` took any `filter` or `forEach` for the built-in's, also on a receiver whose
  type says otherwise (Node's `Readable`, whose `filter` awaits; a class of the project).
- `floating-promise` exempted the last statement of a timer or listener but not of a hook, so
  the verdict depended on which callers the checker knew.
- Missed: an optional call dropped (`hooks?.flush()`), a call through a declared function type
  (`flush: () => Promise<void>`), `const flags = ids.map(async ...)` read through the `const`,
  an assertion on a promise (`expect(p).toBeTruthy()`, `assert.ok(p)`); a receiver declared
  `Option<C>` wasn't followed to `C`'s methods by any rule.
- std's ten `@ts-expect-error` (TS2344) directives were held by one compiler only.

Closed:
- A method is the built-in's by the receiver's written type (array, typed array, Map, Set,
  iterator, DOM list; through an alias, a declared return type, a chain, across files); another
  written type isn't; an unwritten one is taken for the built-in (policy on the rule page).
- `floating-promise` reports a statement wherever it is; an arrow's value, a function passed by
  name and a Vue template's handler aren't statements.
- The misses above; `Option` / `Readonly` / `Mut` / `NonNullable` receivers are followed
  (entry_points: `port: Mut<Port>` now gets `Port`'s verdict, failure-contract).
- `typescript-versions.test.ts` compiles std, a consumer project and awaited.check.ts with
  TypeScript 7 and 5.9 (the one vue-tsc-tools installs); explicit type arguments that are type
  parameters are documented with the message users see and the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mapped promises read as values: a plain arrow that returns one counts like an async one
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m38s
Tests / test (pull_request) Successful in 12m49s
4eed7ea98b
`ids.map(async (id) => allowed(id))` read through `.some(Boolean)` was reported;
`ids.map((id) => allowed(id))` was not, although the list holds the same promises.
The callback forms the other checks already know (async, by name, an arrow whose body
is a call) now all apply here.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Open (review of 07dce04f): no-param-mutation never followed a loop's variable, nor what
`find`, `at` or `get` hand back, nor the elements of a new list holding the same objects
(`filter`, `slice`, a spread), so `for (const line of order.lines) line.qty = 0` passed. A part
handed out was followed only when every `return` gave back the same path. A callback that isn't
`async` but returns the loan's promise inside `Promise.all(xs.map(...))` passed aliased-mut.
failure-contract dropped a finding once a slot's type or the value put into it was wrapped in
`Mut` (`Mut<Deps>`, `mut<Deps>({ ... })`). The union-tag write lent through a `readonly`
property stayed open. covariant-alias reported a function returning its own local under a wider
type, and missed Vue's `Ref` and React's ref objects.

Closed:
- analyze.rs `reach`: what an expression holds of a borrowed parameter, the object itself or a
  new container of its objects, through members, elements, `?:`/`??`, the built-ins as
  ecmascript-api.json's new `returns` section says (element, container, same, fresh), and calls
  that may hand back a part (decided by the whole program, with the built-in's answer as the
  fallback for an unresolved `get`). For-of variables, destructuring (`[first, ...rest]`) and
  element callbacks of such values are bound through it. A new container's own changes are
  the function's; lending or passing it lends its objects, unless the callee's parameter holds
  only primitives (`Mut<number[]>`, `Mut<Int32Array>`). Elements declared `Mut` (lists, maps,
  sets) are owned.
- borrow.rs `hands_out`: a part of the same parameter in every `return`, by any path, through
  other functions (resolved across files) and built-ins; state.rs does the same for a method's
  `this`, noting a new container.
- New quick fix: `readonly Mut<T>[]` for a change to an element of a `T[]` parameter.
- aliased-mut: a non-async `map` callback returning the loan's promise, collected by
  `Promise.all`.
- failure-contract: `Mut<T>` slots are `T`'s, and `mut(value)` is checked as the value.
- New rule union-tag-write (error): a write through a written union to a property its members
  type differently.
- covariant-alias: returning a function's own local isn't an alias; Vue `Ref`/`ShallowRef` and
  React `RefObject`/`MutableRefObject` are writable containers.
- The class method named in a kept-copy message is chosen in source order (was hash order).

Corpus: mut-readonly-union-field-write comes off escaping.txt; new classes
borrowed-element-changed and borrowed-part-several-paths, and two more programs of
async-pending-loan (a non-async map callback, an async map callback), all rejected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open after 71e155cc: a method reached through an item of a typed
collection was silent: `repos[0]?.check()`, a local holding `repos[0]`
checked against `undefined`, `const [head] = repos`, `for...of` over a
`Map` or `Set` and over their `values()` / `entries()` / `keys()`, and a
receiver declared `Repo | null`. An element is now resolved to the
collection's item type (an array's or `ReadonlyArray`'s item, a `Set`'s
value, a `Map`'s `[key, value]` pair), an array pattern holds each item
by its index, and `null` leaves a union like `undefined` does. The
receivers fixture's `element` function now propagates `NotFound`, which
was a recorded gap.

Also open: 71e155cc made the pass on an adopter's entry about 100 ms
slower than its start. The pass now builds once the set of member names
any program function or object member can be reached by and answers no
for any other name before resolving the receiver, and memoises a
resolved member per (file, value, name, access). A `Record` slot no
longer makes every member name a slot (a call through `table.a()`
propagates nothing, as through `handlers[name]()`); a function's
declared return type is shared instead of cloned; a class reached
through `Ref` is read without cloning its declaration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A member is lent where its union is asked; mutEach lends what a list holds without a copy
All checks were successful
Tests / test (pull_request) Successful in 7m29s
Benchmarks / bench (pull_request) Successful in 3m25s
96d8c8d1ce
Open (review of 69090f0c): `Mut<number[]>` was refused where `Mut<number[] | Int32Array>` is
asked, about a third of the tsc errors left on a migrated adopter. The refusal guarded a write
that turns one member into another, which union-tag-write now refuses itself. And a function
that changes a list's elements (`readonly Mut<T>[]`) could only be lent each element with
`items.map((item) => mut(item))`: after the transform, a new array on every call.

Closed:
- std `Mut<T>` distributes over a concrete union: `Mut<A | B>` is `Mut<A> | Mut<B>`, so a member
  lends where its union is asked, each member compared as any loan (a typed array's buffer,
  `Dog[]` still refused as `Animal[] | Int32Array`), and a tag test narrows to the member's
  `Mut`. A generic `Mut<T>` takes neither branch, so it is still refused where `Mut<Entity>` is
  asked, and `mut(this)` still needs the class written. The one-value mark moves to
  `src/mut-loan.ts` so that TypeScript's messages keep saying `Mut<...>`.
- std `mutEach(items)` (and the prelude's): each element of a list, a map's values or a set's
  members lent, typed `readonly Mut<T>[]` / `ReadonlyMap<K, Mut<V>>` / `ReadonlySet<Mut<T>>`,
  the list itself as a read-only view at run time. The transform erases it like `mut(x)`
  (scripts, the prelude, Vue templates). missing-mut asks for it at a parameter with `Mut`
  elements (*Lend each element: mutEach(xs)*; `.map((x) => mut(x))` and array literals of loans
  are accepted), the migration writes it (an `import type { Mut }` rewritten once for `mut` and
  `mutEach`), and aliased-mut, unneeded-mut, no-param-mutation, the concurrency checks and the
  class summaries read it as a loan. `Iterable<Mut<T>>` parameters count as element loans.
- docs/guide/adoption.md: what tsc still refuses after the migration, by kind, with the number
  of declarations each takes, from a migrated adopter.

Corpus: new class mut-union-member-retag (a member lent as its union, retagged by the callee),
rejected by union-tag-write; nothing reopens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A call propagates what its callee's written function type declares, however the callee is reached
All checks were successful
Benchmarks / bench (pull_request) Successful in 3m33s
Tests / test (pull_request) Successful in 7m41s
bac47a019c
Open after 98443f43: removing the Record name wildcard to save time
silenced a call the starting commit reported (`jobs.a?.()` with
`jobs: Record<string, Job>` and `type Job = Throwing<[], void,
JobError>`), and next to it calls through a declared function type
were silent wherever the callee was reached other than by a member
name some declared type writes: `jobs[name]?.()`, a local taken out by
a key and checked, `table[key]()` on an object type,
`byName.get(name)?.()`, `list[0]?.()`, a module-level `const job: Job`
called by name.

What closes it: the analysis records a call of a value no name is
written for (an item read by a key, what a call hands back) as a call
through that value, and holds a local taken out by a key. The
whole-program pass asks the slot reading, without a name filter, for
every call it can't tie to a body: a record's or index signature's
value by any name or key, an array's item by index or key, a Map's
`get`, an array's `at` / `find` / `pop` / `shift`, a tuple's position,
a computed key of an object type whose members declare the same
contract. A tuple slot checks what is put into it item by item; an
interface or object type that is only an index signature is a record.
A plain function type still propagates nothing; a mapped type stays
unknown. A new table test (24 rows) holds each form, by name and in an
arrow, in the whole-program run and on the editor's path, to the plain
`job: Job`.

The name filter is replaced by two exact gates: the fallback from a
receiver's class runs only for a member some class declares with a
function type, and an interface's members are read without cloning
the list each time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts, all kept from both sides: `analyze_file_with` / `analyze_vue_with` / `analyze`
take both the `consumes` table and the `MarkerPermission`; `Project::analyze_text` passes
both; `FeatureSet` has `consumes` and the marker lists / oxlint weakenings; the rule list,
the sidebar (no-lint-suppression, unlisted-marker and no-unchecked-declare under Ignore
comments, use-after-consume under Correctness), the module list and the CHANGELOG's Added
and Changed entries hold both pieces'. `kept_results` and the hatch-counting functions of
project.rs sit side by side.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts, all kept from both sides: ecmascript-api.json gets both new sections (`callbacks`
and `consumes`, merged as JSON: each side only added its own key); package.json takes
`test:std` from this side (vue-tsc tools for the TypeScript-versions test) and `test:browsers`
from the other (the browsers' consumes test); the soundness class list imports both new
groups; the migration skill has both sections ("A promise used as its value", "A value used
after it was used up") and census.mjs both pointers; the CHANGELOG's Added and Changed keep
every entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: with no-unchecked-declare (escape-hatches-2) in the chain, `declare function
openStream(): Readable;` in the receivers fixture is reported, as every other fixture stub's
`declare` is. Closes: the expectation written on it, as on the other fixtures' stubs; the
stub stays, since what the fixture shows is a call returning a package's Readable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts, kept from both sides: `FnInfo` gets `returns_promise` and `returns_named` (both
computed where the function is declared; `names_a_type` and `is_promise_type` side by side),
the rule list, `.gitignore`'s fixture node_modules (consume_pack and return_types), the
meaning tests (one entry for `undeclared-return-type`, one for `floating-promise`), the
migration skill's tool gaps (the hatch counts and no-unchecked-declare from one side, the
strict-truthiness wording that names undeclared-return-type from the other), and the
CHANGELOG. must-use-result's page keeps the new "A Result kept in a local" section and the
rewritten "What the rule can't see" (aliases are opened now; the kept-Result sentences after
it stay). entry_points: both sides made the same expectation change; this side's comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open after the merge: three mechanisms read a receiver through `Option<C>`, `Readonly<C>`,
`Mut<C>`: the whole-program opener (`written_ty`, which knew `Readonly`, `Mut` and the
utility types, but not std's `Option`), and two analysis-side unwraps from the promise rules
(`named_class` in `annotated_class`, an early return in `receiver_type`), which only the
receivers of imported classes reached. And "an optional call is a call" was written three
times: the failure rules' and the promise rules' statement walkers each unwrapped
`repo?.check(id)` themselves, and the kept-Result collector didn't, so `const r =
repo?.check(id); console.log(r)` dropped the error unseen.

Closes:
- The opener reads std's `Option<C>` as `C` (as `C | undefined` already was), and a std name
  is see-through also where std is code of the project (`written::is_std`); a project type of
  that name still isn't. The two analysis-side unwraps are gone: a binding written with type
  arguments is followed by its written type (`record_receiver_binding`), and the two places
  that asked `instance_of` alone now ask that first too: a call through a second name
  (`const same = fixed; same.run()`, spelling.rs) and a binding handed to a slot
  (`given_of`). Receiver table: two rows, `Option<Repo>` and `Option<Deps>`; spellings
  fixture: `Readonly<Handlers>` and `Option<Handlers>` through a second name.
- `analyze::as_call`: the call an expression is, also optional; the statement walkers of
  the failure rules and of floating-promise, and kept.rs, all ask it. kept_results fixture: an
  optional call kept and only logged (reported), and one checked (silent).
- Docs: must-use-result (optional calls kept; `Option` and `Mut` in the written forms),
  uncaught-propagation, the CHANGELOG entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts:
- Receivers: this side read `Mut<C>` and `Option<C>` as `C` in two places, `annotated_class`
  (the analysis) and `type_ty` (the whole-program pass); the other side has one opener for
  every written type (`written_ty`), which reads `Mut` and std's `Option` as what they wrap.
  Kept the opener: `annotated_class` is the plain class reference again, and a binding
  written `Mut<C>` / `Option<Mut<C>>` is followed by its written type.
- `member_primitive` (aliased-mut: is a part declared primitive?) was written against the
  old `type_ty`; it now reads the member through the same opener (`Ty::Shape` holds a
  `Written`, aliases opened with their arguments bound) instead of its own alias step.
- escaping.txt: neither side's closed classes (aliased-mut-borrow, covariant-mutable-array-param,
  mut-callback-smuggle; one-shot-generator-reused, use-after-consume-arraybuffer), this
  side's two open Mut holes.
- entry_points: this side's split (a platform handler, a project slot) kept.
- Kept from both: the README's known gaps (the Mut paragraph, the sentinel line saying
  number-parse-nan follows paths), the sidebar (floating-promise and promise-as-value under
  Failures, missing-mut and aliased-mut under State), `mod loans` and `mod promises`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: with the nominal `Mut<T>` and the one opener in one chain, nothing held a receiver
written `Mut<Repo>`, `Mut<Deps>` or `Option<Mut<Repo>>` to the plain form, nor a result read
off a function of a lent list.

Closes: three receiver rows (each against the plain `Repo` / `Deps` / `Repo | undefined`;
the harness passes a `Mut` parameter on as `mut(name)`, as missing-mut asks of every call
that passes a loan on), and two pairs (a lent list's `length` and element, called with
`mut([n])`). 42 rows and 71 pairs, none differs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts, kept from both sides: ecmascript-api.json gets `returns` beside `consumes` and
`callbacks` (merged as JSON, each side only added its own key); builtins.rs reads both new
sections (`Hands` / `returns` and `Reads` / `callbacks`, each with its own accessors and
checks that a member it names is in the map); the slot reader keeps the other side's
utility types, `Record` and generic slots, with this side's `Mut<Deps>` read as `Deps`
beside `Option`; cache.rs keeps this side's `Map` values as elements before the other side's
utility and generic shapes; the README's known gaps (union-tag-write refuses the union write;
number-parse-nan follows paths); the sidebar; the CHANGELOG. escaping.txt: neither side's
closed classes (mut-readonly-union-field-write from this side; one-shot-generator-reused and
use-after-consume-arraybuffer from the other).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open after the merge:
- `packages/std/src/mut-loan.ts` (borrow-escapes: the one-value mark of `Mut`) is
  `// @safe-ts std`, and with escape-hatches-2 a marker counts only in a file its package.json
  lists: `unlisted-marker` at the marker, and the module checked as project code (its `null`s
  reported in every fixture importing std's `mut`). Closes: `src/mut-loan.ts` under std's
  `"trustedFiles"`, as unlisted-marker's page says to write.
- null_package_receivers: `copy.put("c", null)` with `copy: Readonly<Store>` is now also
  `no-param-mutation`. The one opener (return-types) reads `Readonly<Store>` as `Store`, and
  borrow-escapes follows `Store.put`, which writes the store's private map: `Readonly` makes
  the fields read-only, not the methods, so the caller's store does change. A finding of the
  two pieces together, right by the rule's page; the expectation is written, with the reason
  in the fixture's comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `returns` (borrow-escapes) says `Array.from` hands back a container of its argument's
objects, and the borrow follower took that for every call, while `callbacks` (promise-statics)
says its second argument is a callback whose results are collected. So
`Array.from(order.lines, (l) => ({ ...l }))` was taken to hold the borrowed lines, and a change
to the copies was reported as `no-param-mutation` (borrow-escapes alone reports it). Nothing
held the three sections (`consumes`, `callbacks`, `returns`) to each other.

Closes:
- `Builtins::static_hands(name, args)`: a static whose callback's results are collected and
  that is given that callback hands back new values, as `map` does; both callers (analyze.rs
  `call_reach`, borrow.rs `part_in`) pass the call's argument count. `Array.from(xs)` is a
  container as before. elements fixture: `fromList` (reported) and `fromMapped` (silent),
  in two functions since one parameter's findings in one function are one finding.
- builtins::tests::the_sections_agree: all three sections load; a collected callback means
  fresh values (a static's optional mapper through `static_hands`); a truthiness callback
  picks an element or a container, and its iteration of an iterator may stop early
  (`iterates: some`); an order callback sorts the same items; a static's `returns` and
  `consumes` are about the same argument.
- Receiver table: a slot row for std's `Mut<Port>` lent with `mut<Port>({ ... })`, now that
  failure-contract reads a `Mut` slot as its type (43 rows).
- no-param-mutation's page: `Array.from` with a mapper is with `map` (and an identity mapper
  is the same gap as `lines.map((l) => l)`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ambient declarations test: a neutral member name in the sample
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m9s
Tests / test (pull_request) Successful in 9m13s
6e1cc600bc
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merge the chain below: a neutral member name in the ambient declarations test
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m19s
Tests / test (pull_request) Successful in 9m56s
259c12be10
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A dropped promise that holds a Result gets one finding, not two
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m14s
Tests / test (pull_request) Successful in 9m10s
7c841c8442
`load();` with `load(): Promise<Result<...>>` was both `floating-promise` and
`must-use-result`. The dropped `Result` is the finding; awaiting it and looking at it
answers both, so `floating-promise` leaves the call to that rule, as it already does
for the rules about failures.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merge the chain below: one finding for a dropped promise that holds a Result
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m29s
Tests / test (pull_request) Successful in 10m37s
c539bc1dfe
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merge the chain below: one finding for a dropped promise that holds a Result
All checks were successful
Benchmarks / bench (pull_request) Successful in 4m31s
Tests / test (pull_request) Successful in 10m43s
25cb75b732
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merge the chain below: one finding for a dropped promise that holds a Result
All checks were successful
Benchmarks / bench (pull_request) Successful in 5m6s
Tests / test (pull_request) Successful in 10m2s
95d03c4c0f
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Open: for each file with candidates, `sentinel-error` walked every file of its
package, read the ones outside the program from disk again, made both paths
canonical for every pair, and resolved every tested call again. On an adopter's
client entry, 24 files asked, so 9,192 file visits, 5,977 call resolutions and
3,553 disk reads.

Closes it: per pass, what a file's tested calls go to (`Run::tested_calls`),
the text of package files outside the program (`Run::package_text`) and the
canonical form of each path (`Run::same_file`) are kept. The files already
analyzed are looked at first, and the walk stops once every candidate is
tested (the set of tested keys doesn't depend on the order). Resolutions drop
to 1,774. Findings are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the files of a package outside the program that name a candidate (its
tests and scripts) were analyzed one at a time, in the pass, as the walk
reached them: on an adopter's client entry, 118 analyses, about 420 ms of
CPU, most of the remaining `sentinel-error` cost.

Closes it: before the walk, the files it will read are analyzed in parallel
into the project's cache, which the walk then finds them in. The walk, and
what it inserts into the pass's files and when, are as before, so findings are
unchanged. This is the same work spread over cores, not less of it: on one core
the pass is as slow as before this commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `Run::type_settled` walked all of a file's type answers for each question
(`answers.iter().any(...)` on a map keyed by the very rule and span it was
given), and `lib_effect` asked it twice in a row with the same arguments.

Closes it: one map lookup, asked once. The rule names it is asked with are
all literals, so the signature takes `&'static str`. Findings are unchanged; on
an adopter the maps are small, so this is no measurable gain there (pass
594 ms against 591 ms on the client entry, minimum of 7), only a cost that no
longer grows with the number of questions a file leaves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: every `TypeLookup::lookup_type` answer carried its own copy of the
declaration (`Lookup::Found(PathBuf, TypeDecl)`), cloned out of the file's
analysis on each of the pass's questions: about 140,000 on an adopter's
directories, 24,000 on its client entry, mostly the same few hundred types.
The json memo also hashed and compared whole declarations in its keys.

Closes it: `Lookup::Found` holds an `Arc<TypeDecl>`; `Run::declared_type`
makes each declaration shared once per pass (a file's own types and its
globals), and `type_at`, `exported_type` and `global_type` hand that out. The
few readers that keep a part of a declaration clone just that part. Findings
are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `Run::resolve_callee` and `Run::resolve_binding` worked every answer out
again: each failure rule, contract and promise check asks about the same calls,
and every caller of a function about the same callees. On an adopter's
directories, 1,061,399 call resolutions for 122,843 distinct calls and 530,837
name lookups for 24,989 names; on its client entry, 219,777 for 32,420.

Closes it: both are remembered per pass, by the file asking. Only the top-level
question is (depth 0, the same budget every time it is asked); the steps inside a
resolution, which run with less of the link budget left, are not. Findings are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `Run::type_at` followed imports and re-exports again for every
question (139,223 on an adopter's directories for 5,905 distinct ones;
24,488 for 2,197 on its client entry), `Run::global_type` stat'ed the
directories above the file to find its tsconfig and walked the global
declaration files each time (35,756 for 763), and every type import was
resolved again through the resolver (40,827 for a few hundred).

Closes it: `type_at` from the top, `global_type` and the resolution of an
import's types (`Run::types_where`, `Run::resolve_types`, keyed by the importing
file, since tsconfig `include`s and `.vue` files make it depend on more than the
directory) are remembered per pass. `Project::resolve_types` had no other
caller and is gone. Findings are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: the files outside the program were analyzed side by side, but in one
small batch per file that asks (24 on an adopter's client entry, some of
two or three files), so the pass waited on each batch's slowest file in turn.

Closes it: in `safe-ts check` (`Run::sentinel_askers`), the first question
analyzes, in one parallel batch, the files any asking file of the program will
read: a superset (every function `sentinel.rs` lists, before a written return
type is opened), so each later walk finds its files in the project's cache.
The editor, which checks one file, keeps the per-file batch. The walks and what
they find are as before, so findings are unchanged; like the commit that added
the batches, this spreads work over cores and removes none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `Run::lib_effect` looked a package call up in the feature packs, the
types and the inferred modules again each time it was asked: once per file,
then again for each function that owns the call and each set of literal
arguments its failure is worked out for, and by the promise rules (22,612
questions on an adopter's client entry, 147,194 on its directories).

Closes it: the answer is kept per pass (by file, the call's and its callee's
spans, and its target), shared as an `Arc`. `LibTarget` gains `PartialEq` for
the key. Findings are unchanged. The gain is small: about 16 ms of the pass's
CPU on the client entry (minimum of 9), within noise on the directories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Open: `npm run bench:check` holds the transform's ratios, but nothing held
the checker's own speed. The whole-program pass on an adopter's entry had grown
from well under a second to over one by changes of a few percent each, mostly
the same question asked again; a time can't catch that on a shared runner.

Closes it: `safe_ts_core::work` counts work done from scratch (relaxed atomic
counters at the memo misses and the parses): files analyzed and parsed again,
calls, names, receivers and type names resolved, declarations shared, types
evaluated, package calls judged, failure chains and propagations worked out,
and the files `sentinel-error` reads. `tests/work.rs` generates a fixed
project (24 modules of one package through a barrel, a class, tests outside the
program) and checks it from the entry and as a directory against
`tests/work-ceilings.json`: a count over its ceiling fails, and so does one more
than 10% under it, so a speed-up is kept. The counts are the same on every run
(checked over eight runs). Turning off the call, type or package-call memo makes
it fail (calls 581 -> 2,579 on the entry).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge main: the stack has landed, with the pinned nightly and implicit-propagation
All checks were successful
Benchmarks / bench (pull_request) Successful in 2m13s
Tests / test (pull_request) Successful in 6m23s
8a209ba204
Co-Authored-By: Claude Fable 5.2 <[email protected]>
sionzee deleted branch pass-speed 2026-11-22 00:57:13 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Evobug/Safe-Ts!126
No description provided.