lab-kit-cli 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/CHANGELOG.md +6 -0
  2. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/PKG-INFO +2 -2
  3. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/README.md +1 -1
  4. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/spec/lab-model.md +5 -7
  5. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0/examples/monte-carlo-lab/.agents}/skills/experiment/SKILL.md +3 -3
  6. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/review/SKILL.md +2 -2
  7. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.lab/method/DISCIPLINE.md +1 -1
  8. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/lab.yaml +1 -2
  9. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/method/DISCIPLINE.md +1 -1
  10. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/pyproject.toml +1 -1
  11. {lab_kit_cli-0.4.0/examples/monte-carlo-lab/.agents → lab_kit_cli-0.5.0}/skills/experiment/SKILL.md +3 -3
  12. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/skills/review/SKILL.md +2 -2
  13. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/__init__.py +1 -1
  14. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/files.py +1 -47
  15. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/run.py +0 -1
  16. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/commands/setup.py +0 -1
  17. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/lab.py +6 -4
  18. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_checks.py +13 -5
  19. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_end_to_end.py +0 -5
  20. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_example.py +1 -1
  21. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/.github/workflows/ci.yml +0 -0
  22. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/.github/workflows/policy.yml +0 -0
  23. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/.github/workflows/release.yml +0 -0
  24. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/.gitignore +0 -0
  25. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/AGENTS.md +0 -0
  26. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/CLAUDE.md +0 -0
  27. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/CONTRIBUTING.md +0 -0
  28. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/LICENSE +0 -0
  29. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/SETUP.md +0 -0
  30. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/agents/reporter.md +0 -0
  31. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/agents/reviewer.md +0 -0
  32. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/agents/runner.md +0 -0
  33. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/agents/scout.md +0 -0
  34. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/how-lab-kit-works-dark.svg +0 -0
  35. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/how-lab-kit-works-light.svg +0 -0
  36. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/lab-loop-dark.svg +0 -0
  37. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/lab-loop-light.svg +0 -0
  38. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/number-chain-dark.svg +0 -0
  39. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/docs/figures/number-chain-light.svg +0 -0
  40. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/agents/reporter.md +0 -0
  41. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/agents/reviewer.md +0 -0
  42. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/agents/runner.md +0 -0
  43. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/agents/scout.md +0 -0
  44. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/address/SKILL.md +0 -0
  45. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/configure/SKILL.md +0 -0
  46. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/organise/SKILL.md +0 -0
  47. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/plan-mission/SKILL.md +0 -0
  48. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/publish/SKILL.md +0 -0
  49. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/run/SKILL.md +0 -0
  50. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/run-mission/SKILL.md +0 -0
  51. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/set-up/SKILL.md +0 -0
  52. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/set-up-lab/SKILL.md +0 -0
  53. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.agents/skills/write/SKILL.md +0 -0
  54. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.gitignore +0 -0
  55. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.lab/frozen.sha256 +0 -0
  56. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/.lab/method/LADDER.md +0 -0
  57. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/AGENTS.md +0 -0
  58. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/CLAUDE.md +0 -0
  59. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/backlinks.json +0 -0
  60. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/cards.json +0 -0
  61. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/catalog.json +0 -0
  62. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/journal.json +0 -0
  63. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/nav.json +0 -0
  64. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.folio/search.json +0 -0
  65. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/.gitignore +0 -0
  66. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/assets/data/.gitkeep +0 -0
  67. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/assets/figures/.gitkeep +0 -0
  68. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/assets/refs.bib +0 -0
  69. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/claims/C-1.md +0 -0
  70. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/index.html +0 -0
  71. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-concluded-the-pi-error-scaling-mission.md +0 -0
  72. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-lab-set-up.md +0 -0
  73. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-locked-the-pi-error-scaling-protocol.md +0 -0
  74. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-opened-the-pi-error-scaling-mission.md +0 -0
  75. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-r-1-fitted-the-mean-absolute-error.md +0 -0
  76. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-ran-the-pi-error-scaling-protocol.md +0 -0
  77. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-recorded-r-1.md +0 -0
  78. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-recorded-r-2.md +0 -0
  79. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-reported-the-pi-error-scaling-experiment.md +0 -0
  80. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/journal/2026/2026-10-04-the-square-root-law-holds-per-size-predictions.md +0 -0
  81. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/maps/research.html +0 -0
  82. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/projects/lab/index.html +0 -0
  83. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/protocols/pi-error-scaling.md +0 -0
  84. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/questions/Q-1.md +0 -0
  85. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/reports/pi-error-scaling-report/index.html +0 -0
  86. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/results/R-1.md +0 -0
  87. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/content/results/R-2.md +0 -0
  88. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/docs/folio.yaml +0 -0
  89. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/.gitkeep +0 -0
  90. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/.gitignore +0 -0
  91. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/bin/.gitkeep +0 -0
  92. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/bin/fold.py +0 -0
  93. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/bin/sample.py +0 -0
  94. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/lock.json +0 -0
  95. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/runs/.gitkeep +0 -0
  96. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/runs/20261004-231629/MANIFEST.sha256 +0 -0
  97. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/runs/20261004-231629/out/estimates.tsv +0 -0
  98. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/runs/20261004-231629/run.json +0 -0
  99. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/experiments/pi-error-scaling/score.yaml +0 -0
  100. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/ops/STATE.md +0 -0
  101. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/ops/missions/.gitkeep +0 -0
  102. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/ops/missions/2026-10-04-pi-error-scaling.md +0 -0
  103. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/substrate/README.md +0 -0
  104. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/examples/monte-carlo-lab/substrate/estimator.py +0 -0
  105. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/method/LADDER.md +0 -0
  106. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/skills/plan-mission/SKILL.md +0 -0
  107. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/skills/run-mission/SKILL.md +0 -0
  108. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/skills/set-up-lab/SKILL.md +0 -0
  109. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/__main__.py +0 -0
  110. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/budgets.py +0 -0
  111. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/__init__.py +0 -0
  112. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/base.py +0 -0
  113. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/locks.py +0 -0
  114. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/checks/results.py +0 -0
  115. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/cli.py +0 -0
  116. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/commands/__init__.py +0 -0
  117. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/commands/experiments.py +0 -0
  118. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/commands/runs.py +0 -0
  119. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/commands/status.py +0 -0
  120. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/data.py +0 -0
  121. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/errors.py +0 -0
  122. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/frozen.py +0 -0
  123. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/gitlog.py +0 -0
  124. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/ops.py +0 -0
  125. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/protocol.py +0 -0
  126. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/records.py +0 -0
  127. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/rederive.py +0 -0
  128. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/store.py +0 -0
  129. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/src/lab_kit/supervise.py +0 -0
  130. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/conftest.py +0 -0
  131. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_budgets.py +0 -0
  132. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_instrument.py +0 -0
  133. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_runs.py +0 -0
  134. {lab_kit_cli-0.4.0 → lab_kit_cli-0.5.0}/tests/test_store.py +0 -0
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ - lab-kit no longer runs a lab's code to check it. The `lab-selftest` check is gone, and with it the `tools:` key in `lab.yaml`: a lab that still has the key gets an error saying to delete it. lab-kit checks the record; the lab tests its code in its own test suite, which its gate runs beside `lab-kit check`.
6
+ - The method (DISCIPLINE §7) and the experiment and review skills say so: an experiment's command calls the lab's own tested code, `bin/` holds only what is particular to one experiment and may be empty, and a fold is tested on a planted case in the lab's suite. The lock still hashes `bin/` and records the commit, which says which version of the lab's code a run used.
7
+ - Locks and run records are unchanged.
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  - The run store. `store:` in `lab.yaml` names one shared filesystem, such as `/labs/<lab>`, where every finished run's raw output goes. When a run ends, `lab-kit run` publishes `work/` and `run.log` to the store at the run folder's own path: a copy into `.incoming/`, checked against `work.sha256` (nothing missing, extra or changed), renamed into place, made read-only. It then writes `store.json` beside `run.json` and deletes the local copy. A run in the store is never overwritten. A failed publish is noted in `run.log`, keeps the local copy and never changes the run's exit code.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lab-kit-cli
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: A research lab's method and machinery on top of folio: pre-register, lock, run, score, re-derive.
5
5
  Project-URL: Homepage, https://github.com/pierg/lab-kit
6
6
  Project-URL: Issues, https://github.com/pierg/lab-kit/issues
@@ -82,7 +82,7 @@ The gate, `lab-kit check`, runs folio's checks and then the lab's. It runs offli
82
82
  - **Runs.** Every run started after its lock, used exactly the pinned configuration, and its evidence matches its manifest (`lab-run-after-lock`, `lab-roster-frozen`, `lab-evidence-sealed`).
83
83
  - **Results.** Every live result re-derives exactly, rests on a finished run of a locked protocol, and passed an independent reviewer (`lab-rederive`, `lab-result-grounded`).
84
84
  - **Scores.** A scorecard scores exactly the ids the lock names (`lab-score-exact`), and a scored experiment is reported or explained (`lab-scored-reported`).
85
- - **Lab files.** Ids resolve, frozen surfaces are untouched, scripts pass `--selftest`, nothing runs under an unapproved mission, spend stays within its cap and its standing budget, records only grow, the method is current, and the state file stays a short pointer.
85
+ - **Lab files.** Ids resolve, frozen surfaces are untouched, nothing runs under an unapproved mission, spend stays within its cap and its standing budget, records only grow, the method is current, and the state file stays a short pointer.
86
86
 
87
87
  Together they hold a chain from every number on a page back to the lock:
88
88
 
@@ -66,7 +66,7 @@ The gate, `lab-kit check`, runs folio's checks and then the lab's. It runs offli
66
66
  - **Runs.** Every run started after its lock, used exactly the pinned configuration, and its evidence matches its manifest (`lab-run-after-lock`, `lab-roster-frozen`, `lab-evidence-sealed`).
67
67
  - **Results.** Every live result re-derives exactly, rests on a finished run of a locked protocol, and passed an independent reviewer (`lab-rederive`, `lab-result-grounded`).
68
68
  - **Scores.** A scorecard scores exactly the ids the lock names (`lab-score-exact`), and a scored experiment is reported or explained (`lab-scored-reported`).
69
- - **Lab files.** Ids resolve, frozen surfaces are untouched, scripts pass `--selftest`, nothing runs under an unapproved mission, spend stays within its cap and its standing budget, records only grow, the method is current, and the state file stays a short pointer.
69
+ - **Lab files.** Ids resolve, frozen surfaces are untouched, nothing runs under an unapproved mission, spend stays within its cap and its standing budget, records only grow, the method is current, and the state file stays a short pointer.
70
70
 
71
71
  Together they hold a chain from every number on a page back to the lock:
72
72
 
@@ -44,7 +44,7 @@ A lab is a repository. Its folio library sits at the root or in a folder such as
44
44
  journal/{yyyy}/ the library's one journal: one permanent file per entry, {date}-{slug}.md
45
45
  ... maps, concepts, the front door, papers
46
46
  experiments/{slug}/ one per protocol, same slug
47
- bin/ the lab's own scripts for this experiment, each with --selftest
47
+ bin/ what is particular to this experiment, if anything; may be empty
48
48
  lock.json the lock record: protocol id, its sha256 with the status field set aside, the lock time (UTC),
49
49
  the instrument (a hash of bin/), the git commit and the lab-kit version
50
50
  runs/{run-id}/
@@ -70,12 +70,11 @@ A lab is a repository. Its folio library sits at the root or in a folder such as
70
70
  `lab.yaml`:
71
71
 
72
72
  ```yaml
73
- lab-kit: 0.4.0 # the version this lab is checked with
73
+ lab-kit: 0.5.0 # the version this lab is checked with
74
74
  library: docs # where folio.yaml is; "." for the root
75
75
  front: lab # the front door's id: a project document
76
76
  frozen: # surfaces never edited in place
77
77
  - substrate/
78
- tools: [tools/fold.py] # lab-wide scripts; each must pass --selftest
79
78
  rederive_timeout: 120 # seconds per re-derive command
80
79
  store: /labs/monte-carlo-lab # optional: where finished runs' raw output is published (below)
81
80
  ```
@@ -110,7 +109,7 @@ question --> protocol (draft) --> review of the draft --> lock --> run --> evide
110
109
  4. **Lock.** The write skill sets the protocol's status to `locked`. The protocol's card lists `locked` in `frozen_in`, so folio's `frozen` check holds it from here: nothing changes but its status field. `lab-kit lock {slug}` writes `lock.json` with the file's hash, taken with the status field set aside, so the one change folio allows (to `abandoned`) does not break it. `folio journal add --title .. --description .. --body .. --kind lock --about {slug}` records it. The commit that holds the protocol, `lock.json`, that journal entry and `.folio/` is the lock; folio's `frozen` check compares with the first commit that set `locked`. From here lab-kit also checks the protocol's bytes, and the bytes of the experiment's `bin/`, so the instrument is committed before the lock.
111
110
  5. **Run.** `lab-kit run {slug} -- <command>` refuses unless the lock is intact, the instrument included. It writes `run.json`, starts the lab's own command in the background, and logs it. A run under a mission names it with `--mission`, and the mission must be approved and `active`. A run that spends tokens or money also needs a mission that records a cap. Launch, checkpoints and terminations each go in a journal entry of kind `run` about the protocol.
112
111
  6. **Evidence.** When the command exits, `lab-kit run` writes `MANIFEST.sha256` and the exit code. `out/` is committed once, at the end, in one commit. A run whose tool failed is invalid, and is recorded as invalid.
113
- 7. **Score.** The review skill reads the lock first. It folds `out/` with a selftested script. `lab-kit score {slug}` creates `score.yaml` with every prediction and rule id the lock names. The review fills each with a verdict, a value and the evidence it came from, and lists the numbers to record under `record`.
112
+ 7. **Score.** The review skill reads the lock first. It folds `out/` with a tested fold. `lab-kit score {slug}` creates `score.yaml` with every prediction and rule id the lock names. The review fills each with a verdict, a value and the evidence it came from, and lists the numbers to record under `record`.
114
113
  8. **Reviewer pass.** An independent reviewer re-derives the scored numbers and returns a verdict. The commander records it, and `score.yaml` points to it.
115
114
  9. **Result.** For each number worth citing, folio's run skill follows `record-a-result` with `from: experiments/{slug}/score.yaml#<name>`, and writes `R-n`. Its number, baseline, bound, evidence path, re-derive command and protocol come from that entry; its date is the day it is recorded. A result is permanent and writes no status. folio derives it: `live` until a newer result supersedes it or a retraction names it. A null or a fired kill rule is a result too.
116
115
  10. **Claim.** If the lab wants to say something, the write skill adds or revises a claim `C-n` citing its results.
@@ -138,7 +137,6 @@ A result that is not promoted is recorded too: a journal entry about the protoco
138
137
  | `lab-score-exact` | A `score.yaml` names the lock's hash. Its `scores` list exactly the locked protocol's prediction ids (`P1`...) and decision-rule ids (`D1`...), no more and no fewer. Each has an allowed verdict and an existing evidence path. |
139
138
  | `lab-ids-resolve` | Every id cited in a lab file (state, missions, lock records, runs, scores) resolves to a document in the library. |
140
139
  | `lab-frozen-intact` | Every surface listed under `frozen:` matches its hash in `.lab/frozen.sha256`. |
141
- | `lab-selftest` | Every script in `experiments/*/bin/` and under `tools:` passes `--selftest`. |
142
140
  | `lab-mission-approved` | Every mission file has status `draft`, `active` or `concluded`. An `active` or `concluded` mission records `approved`, naming who and a date. No run names a draft mission, and `ops/STATE.md` names no draft as the active mission. Every standing budget has grants, each with a positive `amount` and an `approved` naming who and a date. A mission's `budget` names a budget that exists; past draft, such a mission records a numeric `cap`; and what the missions under a budget commit fits inside its amount. |
143
141
  | `lab-spend-recorded` | A run marked as spending names a mission that records the operator's approval and a cap, and its recorded spend is within the cap. |
144
142
  | `lab-append-only` | Lab files only: committed mission log entries, standing budget grants and units, lock records and run records are unchanged in later commits; a mission file or a budget is never deleted. A run record committed while its run was going may later fill in `ended`, `exit` and `spent`, each once: nothing else in it changes, and a closing field once set never changes again. Journal entries and results are folio's `permanent` check. |
@@ -147,9 +145,9 @@ A result that is not promoted is recorded too: a journal entry about the protoco
147
145
  | `lab-scored-reported` | Every scored experiment has a report citing its results, or a journal entry about its protocol saying why not (warning). |
148
146
  | `lab-work-stored` | When `lab.yaml` names a `store:`, every ended run with a `work.sha256` has a `store.json`: its raw output was published (warning). |
149
147
 
150
- The gate checks that the record is consistent. It does not check that the record is honest. That is the reviewer's job.
148
+ The gate checks that the record is consistent. It does not check that the record is honest. That is the reviewer's job. Nor does it test the lab's code: the lab's own gate runs the lab's test suite beside `lab-kit check`, and an experiment's command calls that tested code.
151
149
 
152
- lab-kit runs every selftest, re-derive command and run from the lab root with `PYTHONDONTWRITEBYTECODE=1`, so no bytecode lands in a frozen surface. A run counts as ended for `lab-evidence-sealed` whatever its exit code; for `lab-result-grounded` it must have exited 0.
150
+ lab-kit runs every re-derive command and run from the lab root with `PYTHONDONTWRITEBYTECODE=1`, so no bytecode lands in a frozen surface. A run counts as ended for `lab-evidence-sealed` whatever its exit code; for `lab-result-grounded` it must have exited 0.
153
151
 
154
152
  ## 6. The `lab-kit` command
155
153
 
@@ -30,7 +30,7 @@ You take one question from a draft protocol to a finished run with its evidence
30
30
  7. Fail loud. An arm whose tool fails is invalid, never downgraded. Undecidable is not a pass. Judged, not checked.
31
31
  8. Name every move the agent under test may make, under the protocol's allowed moves. A move the list does not name is one it may never use. The section is checked by the protocol genre's required parts; its completeness is judged.
32
32
  9. No live spend without the operator's word, recorded in a mission with a cap. Checked by `lab-spend-recorded`.
33
- 10. Every script in `bin/` has a `--selftest`. Checked by `lab-selftest`.
33
+ 10. The code a run executes is tested by the lab's own test suite. Prefer a command that calls the lab's own tested code (its package or its tools) over a script written for one experiment; keep in `bin/` only what is particular to this experiment, and test it there too. Judged, not checked.
34
34
  11. Evidence is committed once, at the end of the run. Scratch and logs stay out of git. Checked by `lab-evidence-sealed`; the rest is judged.
35
35
  12. Every document goes through the write skill. You never write one by hand. Checked by `folio check`.
36
36
 
@@ -45,9 +45,9 @@ You take one question from a draft protocol to a finished run with its evidence
45
45
  - the decision rules `D1`..., with the kill rule marked `(kill)`;
46
46
  - the predictions `P1`..., each with a confidence;
47
47
  - what it cannot show.
48
- 2. **Make its folder.** Run `lab-kit experiment <slug>`. Put the lab's scripts in `experiments/<slug>/bin/`, each with a `--selftest`. Run `lab-kit check --only lab-selftest`.
48
+ 2. **Make its folder.** Run `lab-kit experiment <slug>`. The run's command calls the lab's own tested code; anything particular to this experiment goes in `experiments/<slug>/bin/`, with its tests in the lab's suite. An experiment that needs nothing of its own leaves `bin/` empty. Run the lab's tests.
49
49
  3. **Review the draft.** Send a reviewer with fresh context. Fold its points into the draft through the write skill. A protocol is cheap to fix before the lock and impossible to fix after.
50
- 4. **Lock.** Commit `bin/` first: the lock hashes it, and `lab-lock-intact` fails if it changes after. Through the write skill, set the protocol's status to `locked`. Run `lab-kit lock <slug>`. Record it: `folio journal add --title .. --description .. --body .. --kind lock --about <slug>,<Q-n>`. Run `folio index`, then `lab-kit check`. Commit exactly the protocol, `lock.json`, the `lock` journal entry and `.folio/` together; that commit is the lock. From here folio's `frozen` check and `lab-lock-intact` hold it.
50
+ 4. **Lock.** Commit `bin/` and the code the command calls first: the lock hashes `bin/` and records the commit, and `lab-lock-intact` fails if `bin/` changes after. The lab's code outside `bin/` may change later; the lock's commit says which version the run used, so a protocol that needs it fixed pins it by commit. Through the write skill, set the protocol's status to `locked`. Run `lab-kit lock <slug>`. Record it: `folio journal add --title .. --description .. --body .. --kind lock --about <slug>,<Q-n>`. Run `folio index`, then `lab-kit check`. Commit exactly the protocol, `lock.json`, the `lock` journal entry and `.folio/` together; that commit is the lock. From here folio's `frozen` check and `lab-lock-intact` hold it.
51
51
  5. **De-risk.** Run the token-free stages first, with `lab-kit run`. Fix the apparatus only before the lock. After it, an apparatus fault ends the run as invalid.
52
52
  6. **Launch.** Run `lab-kit run <slug> -- <command>`. Add `--spend --mission <file>` for a run that spends. Watch it at once: arm one watcher on its log that fires on the end marker or an error signature. A silent launch failure can waste a whole night.
53
53
  7. **Supervise.** Write a journal entry of kind `run` about the protocol for each launch, checkpoint, surprise and termination, with `folio journal add`. Keep each entry to what changed. Record a deviation the moment you see it. Commit each entry with `.folio/` after `folio index`; never stage the run's working files.
@@ -27,7 +27,7 @@ You turn a finished experiment's evidence into a scorecard against its lock, the
27
27
  3. Score exactly what the lock names: every prediction and every rule, no more and no fewer. Checked by `lab-score-exact`.
28
28
  4. A badly chosen rule is still the rule. Record the flaw as a lesson; never rescore. Judged, not checked.
29
29
  5. A miss is a result. Nulls, fired kill rules and invalid arms are recorded at the same length as wins. Checked in part by `lab-scored-reported`; the rest is judged.
30
- 6. Every fold script has a `--selftest` on a planted case with a known answer. Checked by `lab-selftest`.
30
+ 6. Every fold is tested against a planted case with a known answer, in the lab's own test suite. Judged, not checked.
31
31
  7. You score; the reviewer gates. Nothing is recorded as a result before a reviewer pass. Checked by `lab-result-grounded`.
32
32
  8. Every document goes through folio: results and reports through workflows that folio's run skill follows, the rest through the write skill. Checked by `folio check`.
33
33
  9. A report is frozen once `live`, and a result is permanent. A new result earns a new report, never a rewrite of an old one. folio shows a banner on the old report when a result it cites is superseded or retracted. Checked by folio's `frozen` and `permanent` checks.
@@ -36,7 +36,7 @@ You turn a finished experiment's evidence into a scorecard against its lock, the
36
36
 
37
37
  ## Steps
38
38
 
39
- 1. **Fold.** Run the experiment's fold script over each finished run's `out/`. If none exists, write one in `bin/` with a `--selftest` on a planted case, and land it as an instrument change. Never fold by eye.
39
+ 1. **Fold.** Run the experiment's fold script over each finished run's `out/`. If none exists, write one, with a test on a planted case in the lab's suite, and land it as an instrument change. Never fold by eye.
40
40
  2. **Score.** Run `lab-kit score <slug>`. Under `scores`, for every prediction `P1`..., fill HIT, MISS or INDETERMINATE, with the value and the evidence file it came from. For every decision rule `D1`..., say whether it fired, the kill rule included. Run `lab-kit check --only lab-score-exact`.
41
41
  3. **Gate.** Ask the commander for a reviewer pass, or send one yourself if you are the commander. The reviewer re-derives the scored numbers. Record its verdict where the mission keeps verdicts, and point `score.yaml` to it: `review.verdict` and `review.record`.
42
42
  4. **Choose what to record.** For each scored number, ask: is this a citable fact? A null counts. Add each one to `score.yaml` under `record`, keyed by a short name. Give it the result's fields: `title`, `protocol`, `number`, `baseline`, `bound`, `evidence` and `rederive`. The `number` is exactly what the re-derive command prints, and the evidence lies inside the run. Name every number you leave out.
@@ -55,7 +55,7 @@ No defensive fallbacks. No silent degradation. An arm whose tool fails is invali
55
55
 
56
56
  An apparatus failure is a result to report, not a thing to patch around. Judged, not checked.
57
57
 
58
- Every script ships a `--selftest`, and the gate runs it. Checked by `lab-selftest`.
58
+ Every piece of code a run executes is tested by the lab's own test suite, and the lab's gate runs it. lab-kit runs no lab code in its checks: it checks the record, the lab tests its code. Judged, not checked.
59
59
 
60
60
  Every fold is tested against a planted case with a known answer. A fold that looks fine can still be blind to a renamed field. Judged, not checked.
61
61
 
@@ -1,6 +1,5 @@
1
- lab-kit: 0.4.0 # the version this lab is checked with
1
+ lab-kit: 0.5.0 # the version this lab is checked with
2
2
  library: docs # where folio.yaml is; "." for the root
3
3
  front: lab # the front door's id: a project document
4
4
  frozen: [substrate/] # surfaces never edited in place; record each with `lab-kit freeze`
5
- tools: [] # lab-wide scripts; each must pass --selftest
6
5
  rederive_timeout: 120 # seconds per re-derive command
@@ -55,7 +55,7 @@ No defensive fallbacks. No silent degradation. An arm whose tool fails is invali
55
55
 
56
56
  An apparatus failure is a result to report, not a thing to patch around. Judged, not checked.
57
57
 
58
- Every script ships a `--selftest`, and the gate runs it. Checked by `lab-selftest`.
58
+ Every piece of code a run executes is tested by the lab's own test suite, and the lab's gate runs it. lab-kit runs no lab code in its checks: it checks the record, the lab tests its code. Judged, not checked.
59
59
 
60
60
  Every fold is tested against a planted case with a known answer. A fold that looks fine can still be blind to a renamed field. Judged, not checked.
61
61
 
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  dynamic = ["readme"]
7
7
  name = "lab-kit-cli"
8
- version = "0.4.0"
8
+ version = "0.5.0"
9
9
  description = "A research lab's method and machinery on top of folio: pre-register, lock, run, score, re-derive."
10
10
  license = "MIT"
11
11
  authors = [{ name = "Piergiuseppe Mallozzi" }]
@@ -30,7 +30,7 @@ You take one question from a draft protocol to a finished run with its evidence
30
30
  7. Fail loud. An arm whose tool fails is invalid, never downgraded. Undecidable is not a pass. Judged, not checked.
31
31
  8. Name every move the agent under test may make, under the protocol's allowed moves. A move the list does not name is one it may never use. The section is checked by the protocol genre's required parts; its completeness is judged.
32
32
  9. No live spend without the operator's word, recorded in a mission with a cap. Checked by `lab-spend-recorded`.
33
- 10. Every script in `bin/` has a `--selftest`. Checked by `lab-selftest`.
33
+ 10. The code a run executes is tested by the lab's own test suite. Prefer a command that calls the lab's own tested code (its package or its tools) over a script written for one experiment; keep in `bin/` only what is particular to this experiment, and test it there too. Judged, not checked.
34
34
  11. Evidence is committed once, at the end of the run. Scratch and logs stay out of git. Checked by `lab-evidence-sealed`; the rest is judged.
35
35
  12. Every document goes through the write skill. You never write one by hand. Checked by `folio check`.
36
36
 
@@ -45,9 +45,9 @@ You take one question from a draft protocol to a finished run with its evidence
45
45
  - the decision rules `D1`..., with the kill rule marked `(kill)`;
46
46
  - the predictions `P1`..., each with a confidence;
47
47
  - what it cannot show.
48
- 2. **Make its folder.** Run `lab-kit experiment <slug>`. Put the lab's scripts in `experiments/<slug>/bin/`, each with a `--selftest`. Run `lab-kit check --only lab-selftest`.
48
+ 2. **Make its folder.** Run `lab-kit experiment <slug>`. The run's command calls the lab's own tested code; anything particular to this experiment goes in `experiments/<slug>/bin/`, with its tests in the lab's suite. An experiment that needs nothing of its own leaves `bin/` empty. Run the lab's tests.
49
49
  3. **Review the draft.** Send a reviewer with fresh context. Fold its points into the draft through the write skill. A protocol is cheap to fix before the lock and impossible to fix after.
50
- 4. **Lock.** Commit `bin/` first: the lock hashes it, and `lab-lock-intact` fails if it changes after. Through the write skill, set the protocol's status to `locked`. Run `lab-kit lock <slug>`. Record it: `folio journal add --title .. --description .. --body .. --kind lock --about <slug>,<Q-n>`. Run `folio index`, then `lab-kit check`. Commit exactly the protocol, `lock.json`, the `lock` journal entry and `.folio/` together; that commit is the lock. From here folio's `frozen` check and `lab-lock-intact` hold it.
50
+ 4. **Lock.** Commit `bin/` and the code the command calls first: the lock hashes `bin/` and records the commit, and `lab-lock-intact` fails if `bin/` changes after. The lab's code outside `bin/` may change later; the lock's commit says which version the run used, so a protocol that needs it fixed pins it by commit. Through the write skill, set the protocol's status to `locked`. Run `lab-kit lock <slug>`. Record it: `folio journal add --title .. --description .. --body .. --kind lock --about <slug>,<Q-n>`. Run `folio index`, then `lab-kit check`. Commit exactly the protocol, `lock.json`, the `lock` journal entry and `.folio/` together; that commit is the lock. From here folio's `frozen` check and `lab-lock-intact` hold it.
51
51
  5. **De-risk.** Run the token-free stages first, with `lab-kit run`. Fix the apparatus only before the lock. After it, an apparatus fault ends the run as invalid.
52
52
  6. **Launch.** Run `lab-kit run <slug> -- <command>`. Add `--spend --mission <file>` for a run that spends. Watch it at once: arm one watcher on its log that fires on the end marker or an error signature. A silent launch failure can waste a whole night.
53
53
  7. **Supervise.** Write a journal entry of kind `run` about the protocol for each launch, checkpoint, surprise and termination, with `folio journal add`. Keep each entry to what changed. Record a deviation the moment you see it. Commit each entry with `.folio/` after `folio index`; never stage the run's working files.
@@ -27,7 +27,7 @@ You turn a finished experiment's evidence into a scorecard against its lock, the
27
27
  3. Score exactly what the lock names: every prediction and every rule, no more and no fewer. Checked by `lab-score-exact`.
28
28
  4. A badly chosen rule is still the rule. Record the flaw as a lesson; never rescore. Judged, not checked.
29
29
  5. A miss is a result. Nulls, fired kill rules and invalid arms are recorded at the same length as wins. Checked in part by `lab-scored-reported`; the rest is judged.
30
- 6. Every fold script has a `--selftest` on a planted case with a known answer. Checked by `lab-selftest`.
30
+ 6. Every fold is tested against a planted case with a known answer, in the lab's own test suite. Judged, not checked.
31
31
  7. You score; the reviewer gates. Nothing is recorded as a result before a reviewer pass. Checked by `lab-result-grounded`.
32
32
  8. Every document goes through folio: results and reports through workflows that folio's run skill follows, the rest through the write skill. Checked by `folio check`.
33
33
  9. A report is frozen once `live`, and a result is permanent. A new result earns a new report, never a rewrite of an old one. folio shows a banner on the old report when a result it cites is superseded or retracted. Checked by folio's `frozen` and `permanent` checks.
@@ -36,7 +36,7 @@ You turn a finished experiment's evidence into a scorecard against its lock, the
36
36
 
37
37
  ## Steps
38
38
 
39
- 1. **Fold.** Run the experiment's fold script over each finished run's `out/`. If none exists, write one in `bin/` with a `--selftest` on a planted case, and land it as an instrument change. Never fold by eye.
39
+ 1. **Fold.** Run the experiment's fold script over each finished run's `out/`. If none exists, write one, with a test on a planted case in the lab's suite, and land it as an instrument change. Never fold by eye.
40
40
  2. **Score.** Run `lab-kit score <slug>`. Under `scores`, for every prediction `P1`..., fill HIT, MISS or INDETERMINATE, with the value and the evidence file it came from. For every decision rule `D1`..., say whether it fired, the kill rule included. Run `lab-kit check --only lab-score-exact`.
41
41
  3. **Gate.** Ask the commander for a reviewer pass, or send one yourself if you are the commander. The reviewer re-derives the scored numbers. Record its verdict where the mission keeps verdicts, and point `score.yaml` to it: `review.verdict` and `review.record`.
42
42
  4. **Choose what to record.** For each scored number, ask: is this a citable fact? A null counts. Add each one to `score.yaml` under `record`, keyed by a short name. Give it the result's fields: `title`, `protocol`, `number`, `baseline`, `bound`, `evidence` and `rederive`. The `number` is exactly what the re-derive command prints, and the evidence lies inside the run. Name every number you leave out.
@@ -1,3 +1,3 @@
1
1
  """lab-kit: a research lab's method and machinery on top of folio."""
2
2
 
3
- __version__ = "0.4.0"
3
+ __version__ = "0.5.0"
@@ -1,18 +1,15 @@
1
- """Checks on the lab's own files: ids, frozen surfaces, selftests, spend, history, method and state."""
1
+ """Checks on the lab's own files: ids, frozen surfaces, spend, history, method and state."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import re
7
- import subprocess
8
- import sys
9
7
  from pathlib import Path
10
8
  from typing import Any
11
9
 
12
10
  from folio.checks.rules import measurements
13
11
 
14
12
  from .. import __version__, budgets, data, frozen, gitlog, ops, records
15
- from ..records import script_env
16
13
  from ..errors import LabError
17
14
  from ..lab import Lab
18
15
  from .base import Reporter
@@ -112,49 +109,6 @@ def frozen_intact(lab: Lab, rep: Reporter) -> None:
112
109
  rep.add(path, f"changed: frozen surface `{surface}` is never edited in place")
113
110
 
114
111
 
115
- def _command(path: Path) -> list[str] | None:
116
- if path.suffix == ".py":
117
- return [sys.executable, str(path)]
118
- if path.suffix == ".sh":
119
- return ["bash", str(path)]
120
- if path.stat().st_mode & 0o111:
121
- return [str(path)]
122
- return None
123
-
124
-
125
- def scripts(lab: Lab) -> list[Path]:
126
- found: list[Path] = []
127
- for slug in lab.experiment_slugs():
128
- folder = lab.experiments / slug / "bin"
129
- if folder.is_dir():
130
- found.extend(p for p in sorted(folder.iterdir())
131
- if p.is_file() and not p.name.startswith(".") and p.suffix not in (".pyc", ".md"))
132
- found.extend(lab.root / t for t in lab.settings.tools)
133
- return found
134
-
135
-
136
- def selftest(lab: Lab, rep: Reporter) -> None:
137
- """Every script in experiments/*/bin/ and under `tools:` passes --selftest."""
138
- for path in scripts(lab):
139
- where = lab.rel(path) if path.exists() else path.relative_to(lab.root).as_posix()
140
- if not path.is_file():
141
- rep.add("lab.yaml", f"tool `{where}` does not exist")
142
- continue
143
- command = _command(path)
144
- if command is None:
145
- rep.add(where, "is neither a .py or .sh script nor executable, so it cannot run --selftest")
146
- continue
147
- try:
148
- done = subprocess.run([*command, "--selftest"], cwd=lab.root, capture_output=True, text=True,
149
- timeout=lab.settings.rederive_timeout, check=False, env=script_env())
150
- except subprocess.TimeoutExpired:
151
- rep.add(where, f"--selftest ran past {lab.settings.rederive_timeout}s")
152
- continue
153
- if done.returncode != 0:
154
- tail = (done.stderr.strip() or done.stdout.strip()).splitlines()[-1:] or [""]
155
- rep.add(where, f"--selftest exited {done.returncode}: {tail[0]}".rstrip(": "))
156
-
157
-
158
112
  def mission_approved(lab: Lab, rep: Reporter) -> None:
159
113
  """Missions are draft, active or concluded; an active or concluded one records who approved it and when;
160
114
  nothing runs under a draft, and the state never names a draft as active. A mission under a standing
@@ -23,7 +23,6 @@ CHECKS: tuple[LabCheck, ...] = (
23
23
  LabCheck("lab-score-exact", "error", results.score_exact),
24
24
  LabCheck("lab-ids-resolve", "error", files.ids_resolve),
25
25
  LabCheck("lab-frozen-intact", "error", files.frozen_intact),
26
- LabCheck("lab-selftest", "error", files.selftest),
27
26
  LabCheck("lab-mission-approved", "error", files.mission_approved),
28
27
  LabCheck("lab-spend-recorded", "error", files.spend_recorded),
29
28
  LabCheck("lab-append-only", "error", files.append_only),
@@ -26,7 +26,6 @@ lab-kit: {version} # the version this lab is checked with
26
26
  library: {library} # where folio.yaml is; "." for the root
27
27
  front: # the front door's id: a project document
28
28
  frozen: [] # surfaces never edited in place; record each with `lab-kit freeze`
29
- tools: [] # lab-wide scripts; each must pass --selftest
30
29
  rederive_timeout: 120 # seconds per re-derive command
31
30
  """
32
31
 
@@ -14,7 +14,7 @@ from folio.library import Library
14
14
  from .errors import LabError
15
15
 
16
16
  LAB_YAML = "lab.yaml"
17
- _KEYS = ("lab-kit", "library", "front", "frozen", "tools", "rederive_timeout", "store")
17
+ _KEYS = ("lab-kit", "library", "front", "frozen", "rederive_timeout", "store")
18
18
 
19
19
 
20
20
  @dataclass
@@ -23,7 +23,6 @@ class Settings:
23
23
  library: str
24
24
  front: str | None
25
25
  frozen: list[str]
26
- tools: list[str]
27
26
  rederive_timeout: int
28
27
  store: str | None = None
29
28
 
@@ -92,6 +91,9 @@ def find_root(start: Path) -> Path:
92
91
  def parse_settings(raw: Any, where: str) -> Settings:
93
92
  if not isinstance(raw, dict):
94
93
  raise LabError(f"{where}: must be a mapping")
94
+ if "tools" in raw:
95
+ raise LabError(f"{where}: `tools` was removed in lab-kit 0.5.0, which no longer runs scripts' "
96
+ "--selftest; delete the key and test those scripts in the lab's own test suite")
95
97
  unknown = sorted(set(raw) - set(_KEYS))
96
98
  if unknown:
97
99
  raise LabError(f"{where}: unknown key(s) {', '.join(unknown)}; the keys are {', '.join(_KEYS)}")
@@ -105,7 +107,7 @@ def parse_settings(raw: Any, where: str) -> Settings:
105
107
  if front is not None and not isinstance(front, str):
106
108
  raise LabError(f"{where}: `front` must be a document id")
107
109
  lists = {}
108
- for key in ("frozen", "tools"):
110
+ for key in ("frozen",):
109
111
  value = raw.get(key) or []
110
112
  if not isinstance(value, list) or not all(isinstance(v, str) and v for v in value):
111
113
  raise LabError(f"{where}: `{key}` must be a list of paths from the lab root")
@@ -119,7 +121,7 @@ def parse_settings(raw: Any, where: str) -> Settings:
119
121
  store = raw.get("store")
120
122
  if store is not None and (not isinstance(store, str) or not Path(store).is_absolute()):
121
123
  raise LabError(f"{where}: `store` must be an absolute path, such as /labs/<lab>")
122
- return Settings(version, library, front or None, lists["frozen"], lists["tools"], timeout, store or None)
124
+ return Settings(version, library, front or None, lists["frozen"], timeout, store or None)
123
125
 
124
126
 
125
127
  def load_at(root: Path) -> Lab:
@@ -138,11 +138,19 @@ def test_frozen_intact(make_lab, lab_kit) -> None:
138
138
  assert code == 1 and named(found, "lab-frozen-intact")
139
139
 
140
140
 
141
- def test_selftest(make_lab, lab_kit) -> None:
141
+ def test_lab_code_is_not_run(make_lab, lab_kit) -> None:
142
+ # The lab tests its own code; lab-kit checks only the record, so a script that fails when run passes.
142
143
  root = make_lab()
143
- (root / EXP / "bin" / "broken.py").write_text("raise SystemExit('no selftest here')\n", encoding="utf-8")
144
- code, found = problems(lab_kit)
145
- assert code == 1 and named(found, "lab-selftest")
144
+ (root / EXP / "bin" / "broken.py").write_text("raise SystemExit('never run by the gate')\n", encoding="utf-8")
145
+ assert problems(lab_kit) == (0, [])
146
+
147
+
148
+ def test_tools_key_is_refused(make_lab, lab_kit) -> None:
149
+ root = make_lab()
150
+ with (root / "lab.yaml").open("a", encoding="utf-8") as handle:
151
+ handle.write("tools: [tools/fold.py]\n")
152
+ code, out = lab_kit("check")
153
+ assert code != 0 and "`tools` was removed in lab-kit 0.5.0" in out
146
154
 
147
155
 
148
156
  def test_spend_recorded(make_lab, lab_kit) -> None:
@@ -292,7 +300,7 @@ def test_scored_reported(make_lab, lab_kit) -> None:
292
300
  @pytest.mark.parametrize("name", [
293
301
  "lab-lock-recorded", "lab-lock-intact", "lab-run-after-lock", "lab-roster-frozen", "lab-evidence-sealed",
294
302
  "lab-rederive", "lab-result-grounded", "lab-score-exact", "lab-ids-resolve", "lab-frozen-intact",
295
- "lab-selftest", "lab-spend-recorded", "lab-append-only", "lab-method-current", "lab-state-pointer",
303
+ "lab-spend-recorded", "lab-append-only", "lab-method-current", "lab-state-pointer",
296
304
  "lab-scored-reported",
297
305
  ])
298
306
  def test_every_check_is_registered(name) -> None:
@@ -65,10 +65,6 @@ Anything about files with no line ending.
65
65
  COUNTER = """\
66
66
  import os, sys
67
67
  from pathlib import Path
68
- if sys.argv[1:] == ["--selftest"]:
69
- assert len("a\\nb\\n".splitlines()) == 2
70
- print("selftest passed")
71
- raise SystemExit(0)
72
68
  if sys.argv[1:2] == ["--fold"]:
73
69
  print(sum(1 for _ in Path(sys.argv[2]).read_text().splitlines()))
74
70
  raise SystemExit(0)
@@ -154,7 +150,6 @@ def test_init_to_recorded_result(tmp_path: Path, monkeypatch, lab_kit, folio) ->
154
150
 
155
151
  assert lab_kit("experiment", "line-count")[0] == 0
156
152
  (root / "experiments/line-count/bin/count.py").write_text(COUNTER, encoding="utf-8")
157
- assert lab_kit("check", "--only", "lab-selftest")[0] == 0
158
153
 
159
154
  # No run and no lock record before the lock.
160
155
  code, out = lab_kit("run", "line-count", "--", "python3", "x.py")
@@ -18,7 +18,7 @@ def test_check_json_and_only(make_lab, lab_kit) -> None:
18
18
  make_lab()
19
19
  code, out = lab_kit("check", "--json")
20
20
  assert code == 0 and json.loads(out) == {"problems": [], "errors": 0, "warnings": 0}
21
- code, out = lab_kit("check", "--only", "lab-selftest", "--only", "folio")
21
+ code, out = lab_kit("check", "--only", "lab-frozen-intact", "--only", "folio")
22
22
  assert code == 0, out
23
23
  code, out = lab_kit("check", "--only", "lab-nothing")
24
24
  assert code == 2 and "no check named lab-nothing" in out
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes