verify-output-folder
Check OutputFolder.tla, the statechart command's output folder; use when changing how from-spec publishes, swaps, refuses or stops.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- verify-output-folder
- paths
- features/skill-library/skills/statechart/scripts/model/OutputFolder.tla, features/skill-library/skills/statechart/scripts/statechart/cli.py
- description
- Check OutputFolder.tla, the statechart command's output folder; use when changing how from-spec publishes, swaps, refuses or stops.
03 SKILL.md 正文
verify-output-folder
features/skill-library/skills/statechart/scripts/model/OutputFolder.tla models two runs of statechart from-spec on one output folder: each snapshots the spec, runs TLC, draws, and publishes by moving a work folder into place, setting the old folder aside and removing it; a run can be stopped, and its TLC can outlive it.
It is also the statechart skill's worked example, labelled by OutputFolder.map.py.
The rules, each with its harm:
ChartsOneSpec: a published chart was drawn from one version of the spec. Broken, a chart mixes two versions.KeepsYourFiles: a folder with files not the command's own (your notes) is never removed or replaced. Broken, your files are lost.NeverLosesChart: a failed swap puts the old chart back. Broken, the folder is left with no chart.ExitTwoLeavesFolder: a run that exits 2 left the output folder as it found it, unless--pngcould not render a chart: then it keeps what it wrote, as--help's exit codes say.OverlapNeverRefuses: an overlapping run never makes the other refuse.
The record
Model: features/skill-library/skills/statechart/scripts/model/OutputFolder.tla
Sync: 2fb4e2587489ad3fbebf71561ac648801edb710f
Covers:
features/skill-library/skills/statechart/scripts/statechart/cli.py:from_spec,snapshot,read_input,out_dir,refuse_foreign,foreign,OWN,run_tlc,publish,moved,put_back,unchanged,finish,in_work_folder,run_in_own_group,stop_group
The spec quotes no code, so at the sync commit each action was mapped to it: Start is from_spec and snapshot; Refuse is read_input, out_dir and refuse_foreign ending in 2; Tlc is run_tlc; Stale is unchanged; Swap and MoveIn are publish's loop on moved (ENOTEMPTY, EEXIST); MoveAside is moved(out, old, "ENOENT"); Checked, KeepAside and Supersede are refuse_foreign in publish; Restore and RenameFails are put_back; RenderFails is finish's render before publish; Clean is the last rmtree and finish's exit, 0, 1 or 2; Stop is in_work_folder; KillPython and OrphanEnd are run_in_own_group and stop_group.
OWN and foreign decide what counts as the command's own files, the model's notes.
features/repo-guards/tests/test_model_sync.py fails when a file or name above is gone.
Move Sync: forward only after you read every change to cli.py since it against the model, as /maintain-formal-verification-skill says, and never because the check passes.
Does a change touch it
Rerun it when the diff touches publish, moved, put_back, unchanged, finish, refuse_foreign, OWN, how a run is stopped or its TLC killed, or when the input snapshot is taken.
Run it
uv run pytest features/skill-library/tests/test_statechart_runs.py -q -k "output_folder or worked_example or overlap"
It selects eight tests: test_the_output_folder_model_keeps_every_rule_and_breaks_one_without_each_guard (TLC on the model, and on five mutants of it), and seven that drive the real command on its output folder (two overlapping runs, a spec changed mid-run, a file put in the folder, a killed run, a TLC error, the worked example).
- Bounds: two runs, run 2 starts only after run 1; two versions of the spec; one note; the cfg has no constants; 11,477 distinct states.
- The mutants:
read'set for every run, orSwapwithoutspec = snap[r], breaksChartsOneSpec;Checkedwithout~aside[r].notesbreaksKeepsYourFiles;RenameFailswithout the restore, orSupersedewithout~out.notes, breaksNeverLosesChart. - Assumptions: renames are atomic, with no copy fallback; whether
--pngruns is not modeled, only a chart it cannot render; the snapshot is one step atStart; TLC failing, as a test slot that dies before TLC prints (#1743), exits 2 before publishing and touches no folder, asRefusedoes, and has no step of its own. The missing map file, written before any work folder, is aRefusethat leaves the output folder alone.
A real bug or a modeling error
Map each step of a trace to cli.py with the table above.
A step the command cannot take in that order is a modeling error, and the model is what gets fixed.
When every step is the command's, it is a bug: tell it as the two runs' steps and what the folder held after each, and leave the rule as it is.
Change the model when the code changes on purpose
- A new exit or a new write to the output folder: add it as an action, and a mutant in
test_statechart_runs.pythat shows the rule it bears on breaking without it. - Keep
OutputFolder.map.pylabelling every state the model adds, since the statechart skill shows it as its example.
The last upkeep
/maintain-formal-verification-skill ran at 228c1436c (st-model-upkeep-run): cli.py is unchanged from it to the row's first base, and the drift st-model-sync found was settled from the code.
ExitTwoLeavesFolderwas false of the code, and the code says so on purpose:finishreturns 2 afterpublishwhen--pngrenders fewer PNGs than charts, and--helpstates it ("When a chart does not render, the command keeps the files it wrote and exits 2"). The model hasRenderFails, and the rule andOverlapNeverRefusestake that exception; with the old rule TLC breaks it at once, which is the drift.- Exit 1:
Cleanexits 0 or 1, the folder published either way. - Left out, each in the assumptions above:
moved's copy fallback (ENOSYS,EXDEV,EISDIR), which is not atomic; a rename onto an empty folder, which no chart of a run's can be; the work folder a SIGKILL leaves, outside the output folder; and the snapshot of local modules and expectations afterout_dir, later thanStart.
Every rule holds over 11,477 states, and uv run pytest features/skill-library/tests/test_statechart_runs.py -q -k "output_folder or worked_example or overlap" printed 8 passed.
The row was then rebased onto st-model-sync, whose merge of main brought main to 8f4c21b6f, and the upkeep diffed the covered code again from 228c1436c to it: cli.py changed in #1698 and #1702, in its help, from_chart and site_main, none of the names this model covers, so the sync commit moved there.
st-model-sync then merged main again, to 2fb4e2587, and the row was rebased onto it; the upkeep diffed the covered code from 8f4c21b6f: run_tlc changed in #1743: a test slot that dies before TLC prints raises CannotFinish, so the run exits 2 before it publishes, as a TLC run that fails always did; the model has no step for TLC failing, which touches no folder as Refuse does, and the assumptions now say so.
The sync commit moved there.
04 同仓库更多 Skills
no-key
A skill its skills.json lists as hidden that a model may still call by itself, kept broken so the lint is seen to catch it.
fake-skill
A FAKE skill in a FAKE tree, named for its folder until the test renames the folder.
extra-key
A skill its skills.json does not list as hidden that a model still cannot call, kept broken so the lint is seen to catch it.
unslop
Cut AI tells from writing. Use when the user says text reads like AI, asks to unslop it, or before prose ships to people.
technical-writing
Write or review docs, READMEs, RFCs, PR descriptions and commit messages to a layered standard: Diataxis structure, Google developer style, STE rules and Global English.
why
Find why code is the way it is, from its history and every evidence source this session can query, with citations. Use for 'why does X work this way', 'why did we pick Y', regressions and postmortems. Use how for runtime behavior.