Skip to Content

Capture a project by its rig

A core knows a stack, and a project’s rig knows one app of that stack; this is what a core does with it.

A core knows a stack. A project's rig knows one app of that stack: the services it calls, the people who sign in, the journeys to walk and the screens it claims to reach. It is one file, pitafix-rig.toml, the same for every core, and docs/writing-a-rig.md is the guide to writing one. This section is what a core does with it.

A project's rig is installed into PitaFix's data folder under a grant of its own (install-rig), and a project never hands a core a rig straight from its own folder. What a core reads is the installed copy, which is where the hosts a rig may reach are read from.

How the core is told. The app puts the installed rig's folder in the capture options as rig, and only when the rig's core is this core's id. At level 2 it is options.rig in initialize:

→ {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocol":1,"root":"…","options":{"rig":"/data/rigs/orchard-web"},"paths":{…},"trust":{"project":true}}}

At level 1 it is rig in the JSON object of PITAFIX_OPTIONS. A rig that changes is another project to the session, so the core starts again for it. The folder is read only, and a fixture's handler is run from it and from nowhere else.

How the core reads it. A core in Go calls rig.Load(dir) from pkg/rig, which parses the manifest, expands it and checks it, running nothing. A core in another language runs pitafix rig show --json <dir>, with the helper at PitaFix.app/Contents/Resources/bin/pitafix. Either way a journey's steps come expanded: every use is its run, every state its way in and every sign_in of a person who gets in by steps those steps. Don't read the TOML yourself, as that repeats the expansion, and the expansion is what makes the next rule hold.

One step record for each rig step. A core walks a journey's steps one by one, in the rig's order, and leaves one step record for each. The record's journey is the rig journey's id. A step that is not reached after an earlier one failed still gets a record, with the status skipped. The rig's claims name a step as journey/step, and pitafix rig test finds that step by position: the N-th step of a rig journey is the N-th step record of that journey's run. Leave a step out and every claim after it is off by one.

What the core offers. Each journey of the rig is a walk whose id is the journey's id, offered in static discover (or detect), with the targets that can walk it. Offer the rig's journeys only when the rig is there. Without one, a core that can walk by itself keeps offering its own walks, as the Next.js core walks a project's routes. A core that can't, as the MyGo core and the paper core in pkg/rig/rigtest, has doctor answer a blocking check named rig that says the project has no rig and how to install one, and has discover offer no journey. Refuse the same way a rig that is for another core, one with a problem, and one whose folder is inside the project, which the project could change after the person agreed to it.

What a core does with the rest. [app], [[services]], [[people]] and [crawl] are for the core to honour as far as it can: a fixture's handler answers the app's calls, a person's cookies are set before a journey, and a remote service's hosts are the whole of what the capture may reach. A key a core doesn't read does nothing in a capture, and its own guide says which. The core's doctor should say what it refuses of the rig, so that the person sees it before a walk fails.

What rig test holds a core to. pitafix rig test <rig> --project <dir> --core <core> reads the manifest with nothing run, then has the core walk each journey in a throwaway copy of the project, with the rig option set, through the same checks core test gives every run. It then adds the rig's own. The core must declare rig = true and have the id the rig names. Each journey must be offered as a walk, and the walk must pass. For each state a journey's step is claimed to show, that step's record must be there, must have passed and must hold a screenshot artifact. A rig with no journey has the core's own walk run once. TestOptions.Walks in pkg/coreproc is what makes core test capture those walks in the place of its own captures.

This round, no core in pitafix-rigs starts a run = "local" service, and the Rails and Kotlin Multiplatform cores keep their own forms (recipes and walks) beside the rig.

On this page