lab-kit-cli 1.10.0__tar.gz → 1.10.1__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 (44) hide show
  1. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/CHANGELOG.md +8 -0
  2. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/PKG-INFO +1 -1
  3. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/docs/model.md +2 -1
  4. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/pyproject.toml +1 -1
  5. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/__init__.py +1 -1
  6. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/history.py +13 -4
  7. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_drafts.py +36 -0
  8. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/.github/workflows/ci.yml +0 -0
  9. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/.github/workflows/policy.yml +0 -0
  10. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/.github/workflows/release.yml +0 -0
  11. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/.gitignore +0 -0
  12. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/AGENTS.md +0 -0
  13. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/CLAUDE.md +0 -0
  14. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/CONTRIBUTING.md +0 -0
  15. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/LICENSE +0 -0
  16. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/README.md +0 -0
  17. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/agents/reviewer.md +0 -0
  18. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/method/METHOD.md +0 -0
  19. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/skills/lab-mission/SKILL.md +0 -0
  20. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/skills/lab-review/SKILL.md +0 -0
  21. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/skills/lab-set-up/SKILL.md +0 -0
  22. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/skills/lab-talk/SKILL.md +0 -0
  23. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/skills/lab-work/SKILL.md +0 -0
  24. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/checks.py +0 -0
  25. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/cli.py +0 -0
  26. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/record.py +0 -0
  27. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/runs.py +0 -0
  28. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/site.py +0 -0
  29. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/supervise.py +0 -0
  30. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/views.py +0 -0
  31. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/src/lab_kit/write.py +0 -0
  32. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_flow.py +0 -0
  33. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_held.py +0 -0
  34. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_integrity.py +0 -0
  35. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_mission.py +0 -0
  36. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_needs.py +0 -0
  37. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_order.py +0 -0
  38. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_parked.py +0 -0
  39. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_refusals.py +0 -0
  40. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_site.py +0 -0
  41. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_states.py +0 -0
  42. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_vocabulary.py +0 -0
  43. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tests/test_wording.py +0 -0
  44. {lab_kit_cli-1.10.0 → lab_kit_cli-1.10.1}/tools/import_run.py +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.1
4
+
5
+ - **A fold, once committed, ends what can lock the folded decision.** `lab check` refused a draft folded into another
6
+ as soon as a run started under an order the draft once held, even when the run started after the fold was
7
+ committed. Only what acted before the commit that removed the folded decision's file now locks it; what acts later
8
+ acts on the decision that took it in. A run that started before that commit still locks it, even when its line in
9
+ `runs.tsv` is committed with the fold.
10
+
3
11
  ## 1.10.0
4
12
 
5
13
  - **A settled decision is a draft until something acts on it.** A mission that carries it is launched, or a run or a
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lab-kit-cli
3
- Version: 1.10.0
3
+ Version: 1.10.1
4
4
  Summary: A research lab's record, its method, and the command that keeps both.
5
5
  Project-URL: Homepage, https://github.com/pierg/lab-kit
6
6
  Project-URL: Issues, https://github.com/pierg/lab-kit/issues
@@ -337,7 +337,8 @@ Once something has acted on it, the decision is **locked**: its `decided:`, its
337
337
  first commit that records what acted on it (the mission's launch in the log, the run's line in `runs.tsv`), or, while
338
338
  none does, as in the last commit. An edit committed together with the act is already too late: commit the decision
339
339
  first. A change of mind is a new decision. `lab check` holds this against the lab's history, and refuses a
340
- locked decision folded into another. So a decision cannot be made, afterwards, to be about something it never
340
+ locked decision folded into another: one that something acted on before the commit that removed its file. What
341
+ acts after that commit acts on the decision that took it in. So a decision cannot be made, afterwards, to be about something it never
341
342
  discussed once anything was done on its word. `lab show` and the decision's page say whether it is a draft or locked,
342
343
  and since when.
343
344
 
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  dynamic = ["readme"]
7
7
  name = "lab-kit-cli"
8
- version = "1.10.0"
8
+ version = "1.10.1"
9
9
  description = "A research lab's record, its method, and the command that keeps both."
10
10
  license = "MIT"
11
11
  authors = [{ name = "Piergiuseppe Mallozzi" }]
@@ -1,2 +1,2 @@
1
1
  """lab-kit: a research lab's record, its method, and the command that keeps both."""
2
- __version__ = "1.10.0"
2
+ __version__ = "1.10.1"
@@ -207,11 +207,15 @@ def decisions(lab, versions=None, now=None):
207
207
  return (str(fm.get("decided")), s("about"), s("parks"), s("unparks"), s("drops"), ids(fm.get("order")), s("folds"), # its order is kept as written
208
208
  R.flat(slots.get("Decided", "")))
209
209
 
210
+ def removed(path):
211
+ """The commit that removed a file, or None while HEAD still has it and only the work tree lacks it."""
212
+ if git(root, "cat-file", "-e", f"HEAD:./{path}") is not None:
213
+ return None
214
+ return (git(root, "log", "-1", "--diff-filter=D", "--format=%H", "--", path) or "").strip() or None
215
+
210
216
  def last(path):
211
217
  """The last commit that still had a file: HEAD while only the work tree lacks it, else the one before its removal."""
212
- if git(root, "cat-file", "-e", f"HEAD:./{path}") is not None:
213
- return "HEAD"
214
- gone = (git(root, "log", "-1", "--diff-filter=D", "--format=%H", "--", path) or "").strip()
218
+ gone = removed(path)
215
219
  return f"{gone}^" if gone else "HEAD"
216
220
 
217
221
  def launched(c, ident):
@@ -252,7 +256,12 @@ def decisions(lab, versions=None, now=None):
252
256
  fm, _ = card(git(root, "show", f"{c}:./{commits[-1][1]}") or "")
253
257
  acted = None
254
258
  if fm and fm.get("decided") is not None:
255
- acts = lab.acts(ident, orders | set(ids(fm.get("order"))), lab.settled_at(ident, fm.get("decided")))
259
+ # Only what acted while it was still here locks it: an act after the commit that removed it acts on
260
+ # the decision that took it in. While the removal is not committed yet, everything so far counts.
261
+ gone = removed(commits[-1][1])
262
+ until = R.moment((git(root, "log", "-1", "--format=%cI", gone) or "").strip()) if gone else None
263
+ acts = [a for a in lab.acts(ident, orders | set(ids(fm.get("order"))), lab.settled_at(ident, fm.get("decided")))
264
+ if until is None or R.moment(a[0]) <= until]
256
265
  acted = acts[0][0] if acts else launched(c, ident)
257
266
  if not into:
258
267
  bad(commits[-1][1], "was committed and is gone; nothing recorded is removed. A draft decision is folded into another with `folds:`")
@@ -223,3 +223,39 @@ def test_a_lock_is_read_from_history_by_lab_show_and_lab_check_alike(tmp_path):
223
223
  open(mission, "w").write(text.replace(f"carries: {d2}", f"carries: {d3}"))
224
224
  assert "A draft: nothing has acted on it yet" in lab(root, "show", d3)
225
225
  assert "Locked: acted on at" in lab(root, "show", d2)
226
+
227
+
228
+ def test_what_acts_after_a_fold_is_committed_acts_on_the_decision_that_took_it_in(tmp_path):
229
+ import time
230
+ root = str(tmp_path)
231
+ open_question(root)
232
+ ident, d, command = experiment(root)
233
+ card2, d2 = settled_order(root, [ident], "The first experiment first", "The error experiment first: it is the cheapest check of the law.")
234
+ card3, d3 = settled_order(root, [ident], "The first experiment, again", "The error experiment first, and nothing else before it.")
235
+ commit(root)
236
+ # D2 is folded into D3 while both are drafts, and the fold is committed
237
+ os.remove(card2)
238
+ front(card3, folds=f"[{d2}]")
239
+ commit(root, "D2 folded into D3")
240
+ time.sleep(1.1) # a run's start is kept to the second
241
+ # a run of the step D2 once ordered starts afterwards: it acts on D3, and D2 was folded while it was a draft
242
+ lab(root, "lock", ident)
243
+ lab(root, "run", ident, "--wait", "--", *command)
244
+ commit(root, "the run")
245
+ assert "the record is sound" in lab(root, "check", "--no-rederive")
246
+ assert "Locked: acted on at" in lab(root, "show", d3)
247
+
248
+ # a run that started before the fold was committed still locks the folded decision, though its line is committed with the fold
249
+ root = str(tmp_path / "before")
250
+ os.makedirs(root)
251
+ open_question(root)
252
+ ident, d, command = experiment(root)
253
+ card2, d2 = settled_order(root, [ident], "The first experiment first", "The error experiment first: it is the cheapest check of the law.")
254
+ card3, d3 = settled_order(root, [ident], "The first experiment, again", "The error experiment first, and nothing else before it.")
255
+ commit(root)
256
+ lab(root, "lock", ident)
257
+ lab(root, "run", ident, "--wait", "--", *command)
258
+ os.remove(card2)
259
+ front(card3, folds=f"[{d2}]")
260
+ commit(root, "the run, and D2 folded into D3")
261
+ assert f"is folded into {d3}, and something acted on it" in lab(root, "check", "--no-rederive", ok=False)
File without changes
File without changes
File without changes
File without changes
File without changes