strict-script strict-script

Packages

@strict-script/fuzz

A fuzzer of the kernel: it writes programs, asks the compiler about each, and runs what it accepts. A program that compiles and breaks a promise is a finding. It is a tool of this repository and is not published.

pnpm build
pnpm fuzz --seed 1 --count 100000                  # the three sources, on every core but two
pnpm fuzz --seed 7 --count 50000 --source attack   # made | changed | attack | both

The same seed gives the same programs. A finding is written to packages/fuzz/findings/, one file each, the shortest first, with what was seen in its first line; the command then ends with exit code 1.

#Where the programs come from

SourceFileWhat it is
madesrc/generate.tsPrograms written from the types down. Every one is meant to compile: one that is refused is reported (made-refused)
changedsrc/corpus.ts, src/mutate.tsEvery program the repository holds (the examples, the docs, the programs inside the tests), accepted or refused, changed in one to three places
attacksrc/attacks.tsPrograms that try to get a second name for a value that can be changed, or to end a resource twice or never, and say themselves whether they did: a function holds… that gives true when the promise was kept

#What is a finding

src/judge.ts. For a program the compiler accepts:

KindThe promiseWhat was seen
compiler-threw, compiler-stopped, not-the-sameThe compiler answers, and answers one thingIt fell, or wrote two texts for one program
not-javascript, throws-at-loadWhat it writes is a moduleIt does not load
not-of-typeSafe typingAn exported function, called with values made from the types of its parameters, gave a value that is not of the type it declares
misuseSafe typingIt called a function it was given with a value of another type
throws, rejectsErrors in the typesA call threw, or its promise rejected
changedMutabilityA value given to a parameter that is not mut was written to: it is frozen before the call
doorSafe typing, for a caller in TypeScriptThe function behind its door, called with the same values, refused them, gave another value, or left another value in what it was lent to change
does-not-holdOwnershipA function holds… of an attack gave false

Not findings: a panic the program wrote, the machine running out (a recursion without end, a text too long), and a program that does not end, which a clock stops.

#What it does not see

It is written in docs/known-limits.md, beside what is claimed from it.

#Its tests

test/fuzz.test.ts: each kind of finding is seen on a compiler made wrong on purpose; the programs of the generator are all accepted; a run on a fixed seed finds nothing.

Esc

    Type a word of the language, a rule, a command: mut, extern, match-not-covered.