PhloemDocs

People's gates

A gate is a line where a run waits for a person: a confirmation, a reading, an inspection, a hold point or a signature. The system's alerts keep running while it waits, and a shutdown ends the run and cancels the question.

def receive():
    torque = ask("bolt torque", N * m, decimals=1, min=0 * N * m, max=60 * N * m)
    check("bolt torque", torque, between(22 * N * m, 26 * N * m))

    inspect("weld", views={"top": ["bead continuous", "no porosity"], "side": []},
            reference={"top": "weld-top"}, photos=1)

    step("leak check", optional=True)
    pause("Swap the fixture")
    confirm("Unit accepted", sign=True)
LineAsksIf the answer is no
confirm(prompt)Confirm or Declinedeclining aborts the run; at_end runs
x = ask(name, what)a value — see belowjudged by a check
inspect(name)Pass or Fail, view by view when it has viewsa failed inspection fails the run
pause(label)Resumenothing to decline; stopping is Abort
confirm(prompt, sign=True)Sign: a confirmation that attestsas confirm

Every gate takes photos=N (photos required with the answer, from a file or a live camera) and timeout= (unanswered in time fails the run). Without a timeout the run waits as long as it takes.

What ask takes

torque  = ask("bolt torque", N * m, decimals=1, example="24.0")
bore    = ask("bore diameter", mm, labels=["top", "middle", "bottom"], show_limits=False)
serial  = ask("serial on the label", str, pattern="[A-Z]{2}[0-9]{4}")
finish  = ask("surface finish", ["matte", "satin", "gloss"])
legible = ask("label legible", bool)
due     = ask("calibration due", date)

check("bore", bore, between(9.9 * mm, 10.1 * mm))
check("bore round", spread(bore) < 0.05 * mm)
check("finish", finish in ["matte", "satin"])
check("legible", legible)
check("calibrated for a month", due >= today(days=30))
Second argumentThe person entersEntry options
a unita readingdecimals=, min=, max=; count=N for N readings, or labels=[…] to name each
strtextpattern=: a regular expression the whole text must match
a listone of the choices—
boolyes or no—
datea day, YYYY-MM-DD—

What can be entered is not what passes. Entry options refuse a slip — a third decimal, a value past max= — and say what to fix. What passes is the check's limit. A check on counted readings passes only if every reading does; average(bore), highest(bore), lowest(bore) and spread(bore) (highest less lowest) reduce them instead. Text, a choice, yes/no and a date compare with ==, !=, in, not in, not, and (a date) <, >= — against a day, or today(days=): the day the run started, plus or minus days.

OptionShows the person
example="24.0"a placeholder in the box: one value it accepts
labels=["top", "middle", "bottom"]a name for each reading; sets the count, and the record keeps them
show_limits=Falsenothing of the limits the checks will judge, so a reading is not nudged toward them. The check and the record still state them

Couldn't measure. A person may answer an ask with Couldn't measure or an inspect with Can't inspect, and a reason. It is never a pass: a check on it records not measured, and a run with nothing else wrong ends incomplete — the unit is neither passed nor rejected. cannot=False removes the choice.

Inspections

WrittenShows
inspect("seal")one Pass / Fail
inspect("label", checks=["legible", "not torn"])checks to tick; it passes only with every one ticked
inspect("weld", views={"top": [...], "side": []})one answer per view, each with its own checks and photos
reference="label-ok" or reference={"top": "weld-top"}a reference picture, by name, from the project's trellis/references/ folder (.jpg, .png or .webp)
fail_reasons=["porosity", "undercut", "crack"]what a person picks from when it fails: a fail names at least one, a pass none. Reports and defect counts read them

A missing reference picture shows as missing; it never holds the run.

Any answer — a confirmation, a reading, an inspection, resuming a pause — can carry a note of up to 500 characters, kept beside it in the record.

Skipping a step

A step written step("leak check", optional=True) offers Skip step, with a note saying why (Why it is skipped). The record keeps the skip and the note; the step's checks record skipped.

Where an answer came from

Every answer, skip, reset and Stop records its source: the device and the surface it came through (rig-02 · Computer, rig-02 · CLI, the console), with the time. A typed name is never taken as identity. A signature is accepted only from a person's surface — Computer, the CLI or the console — never from the assistant or a paired device.

Warning

Asking a question while an output this sequence set is away from its safe= value is a warning when the file compiles: the person may walk up to live hardware. Make the hardware safe first, then ask.

Updated