Surface / foldkit-metadata
Evidence
A law such as Product.reservedWithinStock is satisfied by a transition (write:Sell) when an Evidence record attests to it:
| Record | Issued by | When |
|---|---|---|
Enumerated | Laws.check (foldkit-entity) | Verified by enumerating the declared shapes |
Bounded | Laws.check (foldkit-entity) | Proved from declared number bounds across all rows |
Walked | Walk.run (foldkit-remote/testing) | Every seeded walk from every start passed |
Scenario | Scenario.run (planned) | A multi-step scenario ran with no mismatch |
RuntimeOnly | Evidence.runtimeOnly | Declared manually when only production enforces the law |
Because a record is plain data, each producer creates an issuer once and stamps every record it returns by object identity. A record built directly with Evidence.Enumerated(...) or copied via object spread carries no stamp, so a reader can reject it:
import { Option } from 'effect'
import { Evidence } from 'foldkit-metadata'
const line = Evidence.runtimeOnly({
transition: 'write:Sell',
law: 'Product.reservedWithinStock',
why: 'only the writer reads stock and reserved together, where the sale commits',
})
Evidence.issuedBy(line) // Option.some('foldkit-metadata/runtimeOnly')
Evidence.issuedBy({ ...line }) // Option.none(): a copy was issued by no oneEvidence.runtimeOnly throws if why is empty or blank. Application code typically calls only runtimeOnly and issuedBy, and pattern-matches records with Evidence.$match.
What the stamp proves. A stamp identifies which issuer created the record object, not that the underlying claim is bug-free. Calling Evidence.issuer(name) twice with the same name throws, so later modules cannot impersonate an existing producer. Keep Evidence.issuer calls inside dedicated evidence-producing modules, and remember that a Walked record covers only the seeds and steps it ran.