Explanation: proof-spec.v0
proof-spec.v0 is a JSON schema for one proof: observe, act, assert. Gateproof and unsurf both use it.
- Gateproof runs HTTP and shell proofs.
- unsurf runs browser (DOM) proofs.
A spec that one tool writes, the other tool can read.
Convert a plan to specs
import { planToProofSpecs } from "gateproof";
const specs = planToProofSpecs(plan, (storyId) => ({
url: `https://example.com/${storyId}`,
}));Each story becomes one spec. The story id is the spec name. The story title is the spec description.
Convert one story or one spec
| Function | From | To |
|---|---|---|
goalToProofSpec(story, target) |
PlanStory |
ProofSpec |
proofSpecToGoal(spec) |
ProofSpec |
PlanStory |
planToProofSpecs(plan, targetFor) |
PlanDefinition |
ProofSpec[] |
computeRisk(act) |
actions | "low", "medium", or "high" |
goalToProofSpec and proofSpecToGoal keep their old names for compatibility. They take and return a story.
What does not convert
scopeandcleanuphave no field in v0. They stay in Gateproof.dependsOnhas no field in v0. Each spec runs alone.- Only the first spec gets the plan's
loopsettings.stopOnFailureis copied only when it is set. Assert.durationhas no v0 equivalent. It is dropped.- HTTP observe keeps only
url.headersandpollIntervalare dropped. Cloudflare.observebecomes anoteobservation that stores the original definition.Act.execkeeps onlycommand.cwdandtimeoutMsare dropped.Assert.httpResponsekeeps onlystatus.actionIncludesis dropped.Assert.numericDeltaFromEnvkeeps onlybaselineEnvandminimumDelta.sourceandpatternare dropped.- If the plan has a
loopwithoutmaxIterations, the first spec getsmaxIterations: 1. - In
proofSpecToGoal, only the first HTTP observation and theexecactions convert. DOM actions and DOM assertions from unsurf are dropped. - In
proofSpecToGoal,numericDeltaFromEnvcomes back withsource: "httpBody"andpattern: "\\d+". AnhttpResponsewith nostatusis dropped.