Skip to content

Conformance

The kernel trusts the code of each evaluator. The code must keep the duties C1 to C8 of docs/SEMANTICS.md. A plan, a replay and a check of the types are correct only when the code keeps them.

The function conforms(machine, name) examines one evaluator without the kernel. It gives the code probe parts and a probe runtime. The probes record each call of a part, each context, each resolution and each effect. Then conforms compares the records with the contract of the kind. Each finding names the duty, the reason and the first probe that shows it.

The evaluator tally gives the list of the values of its parts. Without a break, it conforms. Each check box changes one line of its code. The page then runs conforms of the core again, and each ring shows what conforms found.

Break the code
The contract of tally
({ parts, context, effect, doc }) => {
let ctx = context;
ctx = { ...ctx, caps: [...ctx.caps, "log"] }; // C1
const used = parts;
const values = evaluateEach(used, ctx);
return ok(values);
}
tally1 breakC1capabilitiesC2effectsC3partsC4pure readsC5sealed partsC7nameslocno state

conforms gives 1 finding: C1.

C1 Each context that the code gives a part has only the capabilities of its document.State: broken: conforms found it. conforms: The code gives the part 0 the capabilities probe, log, and its document has the capabilities probe.
The probe of the finding
Document{"type":["tally"],"value":[{"type":"probe","value":{"probe":0}},{"type":"probe"…
Part 01
Part 11
Capabilitiesprobe
Each check box changes one line of the code. A dashed spoke is a break that is on.Select a ring to show its finding and its probe. A thick red ring is a duty that conforms found broken. A solid blue ring is a kept duty. A dashed blue ring is a break that the contract permits. A dotted gray ring is a break that another break hides.

A duty comes from the contract of the kind. The same code conforms under one contract and breaks a duty under another.

  • An effect breaks C2 when the contract does not declare it. On a pure kind, each effect also breaks C4.
  • A read of the context outside resolve breaks C4 only on a pure kind.

The function conforms gives the first finding of each duty that a probe shows. Some checks need a probe that another break changes.

  • Code that keeps state gets the finding local. Then conforms does not evaluate the probes again, thus it does not check C4 and C5.
  • C3 applies only to a result that is a value. An effect without its capability gives an error, thus C3 gets no check.

Each hidden duty goes with a finding of another duty, thus an empty list hides nothing. But a fix can show a duty that a break hid. Thus fix each finding, and run conforms again.