lab-kit-cli 1.11.1__tar.gz → 1.13.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 (46) hide show
  1. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/CHANGELOG.md +28 -0
  2. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/PKG-INFO +2 -2
  3. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/README.md +1 -1
  4. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/docs/model.md +64 -3
  5. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/method/METHOD.md +13 -3
  6. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/pyproject.toml +1 -1
  7. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/skills/lab-review/SKILL.md +2 -1
  8. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/skills/lab-set-up/SKILL.md +9 -2
  9. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/skills/lab-talk/SKILL.md +12 -1
  10. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/skills/lab-work/SKILL.md +41 -2
  11. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/__init__.py +1 -1
  12. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/checks.py +4 -1
  13. lab_kit_cli-1.13.0/src/lab_kit/storylines.py +230 -0
  14. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/views.py +2 -1
  15. lab_kit_cli-1.13.0/tests/test_storylines.py +189 -0
  16. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/.github/workflows/ci.yml +0 -0
  17. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/.github/workflows/policy.yml +0 -0
  18. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/.github/workflows/release.yml +0 -0
  19. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/.gitignore +0 -0
  20. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/AGENTS.md +0 -0
  21. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/CLAUDE.md +0 -0
  22. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/CONTRIBUTING.md +0 -0
  23. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/LICENSE +0 -0
  24. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/agents/reviewer.md +0 -0
  25. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/skills/lab-mission/SKILL.md +0 -0
  26. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/cli.py +0 -0
  27. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/history.py +0 -0
  28. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/record.py +0 -0
  29. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/runs.py +0 -0
  30. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/site.py +0 -0
  31. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/supervise.py +0 -0
  32. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/src/lab_kit/write.py +0 -0
  33. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_drafts.py +0 -0
  34. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_flow.py +0 -0
  35. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_held.py +0 -0
  36. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_integrity.py +0 -0
  37. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_mission.py +0 -0
  38. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_needs.py +0 -0
  39. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_order.py +0 -0
  40. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_parked.py +0 -0
  41. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_refusals.py +0 -0
  42. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_site.py +0 -0
  43. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_states.py +0 -0
  44. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_vocabulary.py +0 -0
  45. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tests/test_wording.py +0 -0
  46. {lab_kit_cli-1.11.1 → lab_kit_cli-1.13.0}/tools/import_run.py +0 -0
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.0
4
+
5
+ - **A scope page is a storyline.** A storyline is one argument the lab is building from its findings, for one
6
+ audience: what a paper, a talk or a report is later written from, never the finished artifact. The table in
7
+ `lab.toml` is `[storylines]`, `lab now` has a Storylines section and a "Serving no active storyline" list, and
8
+ the method, the model and the skills say storyline throughout. 1.12.0's table of the same shape, `[papers]`,
9
+ is no longer read: no lab had turned it on. Run `lab init` in a lab after upgrading.
10
+
11
+ ## 1.12.0
12
+
13
+ - **Storylines drive the work; the record names no storyline** (method rule 8, model section 4). A lab keeps one
14
+ overview page of the whole trail and one page per active storyline, written as that argument and opening with
15
+ a scope table: audience, thesis, experiments included, excluded or superseded, and open. The storylines' open
16
+ rows and their reviewers' criticisms say what is proposed, ordered, parked or dropped, and a result revises the
17
+ overview and every storyline it touches. So far gives the current finding, never the story of the bugs on the
18
+ way. Adding, merging or retiring a storyline is direction.
19
+ - **A table in `lab.toml`** (`[papers]` in this release, `[storylines]` from 1.13.0) names the overview and the
20
+ active storyline pages, as library paths. It is optional: a lab without it is unchanged. With it, each
21
+ storyline page marks its scope cells `data-scope="included"`, `"excluded"` and `"open"`, and `lab check`
22
+ refuses an id that is not in the lab, a step under included that is not done or is void, a step under open
23
+ that is finished, a question or goal under open that is done, a parked or dropped question or goal in either,
24
+ and a goal, question or step listed in two rows of one page. It notes a storyline page committed before a
25
+ result about something it lists under included or open.
26
+ - **`lab now` lists the storylines**: each active one with the open work its scope names, then the live steps
27
+ that none lists, by themselves or by their question or goal.
28
+ - The skills `lab-set-up`, `lab-work`, `lab-talk` and `lab-review` and the method changed: run `lab init` in a lab
29
+ after upgrading.
30
+
3
31
  ## 1.11.1
4
32
 
5
33
  - **A run in progress in another checkout no longer fails `lab check`.** A run stays in the `.lab/running` of the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lab-kit-cli
3
- Version: 1.11.1
3
+ Version: 1.13.0
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
@@ -75,5 +75,5 @@ where folio serves the lab, which brings `folio-kb` 0.5.0 or later, and list `la
75
75
  ## Read more
76
76
 
77
77
  - [docs/model.md](https://github.com/pierg/lab-kit/blob/main/docs/model.md): the contract. What you read, how a number becomes a result, who decides, the commands, the files.
78
- - [method/METHOD.md](https://github.com/pierg/lab-kit/blob/main/method/METHOD.md): the seven rules every lab keeps.
78
+ - [method/METHOD.md](https://github.com/pierg/lab-kit/blob/main/method/METHOD.md): the eight rules every lab keeps.
79
79
  - [skills/](https://github.com/pierg/lab-kit/blob/main/skills/): lab-set-up, lab-work, lab-review, lab-talk and lab-mission. [agents/](https://github.com/pierg/lab-kit/blob/main/agents/): the reviewer.
@@ -56,5 +56,5 @@ where folio serves the lab, which brings `folio-kb` 0.5.0 or later, and list `la
56
56
  ## Read more
57
57
 
58
58
  - [docs/model.md](docs/model.md): the contract. What you read, how a number becomes a result, who decides, the commands, the files.
59
- - [method/METHOD.md](method/METHOD.md): the seven rules every lab keeps.
59
+ - [method/METHOD.md](method/METHOD.md): the eight rules every lab keeps.
60
60
  - [skills/](skills/): lab-set-up, lab-work, lab-review, lab-talk and lab-mission. [agents/](agents/): the reviewer.
@@ -255,7 +255,7 @@ in points. When a named result belongs to a replaced experiment, the page says s
255
255
  You decide two things: **direction** and **resources**. You decide them in a discussion with the agent,
256
256
  not by approving requests.
257
257
 
258
- - **Direction.** The goals and the questions.
258
+ - **Direction.** The goals, the questions, and the storylines they serve.
259
259
  - **Resources.** Everything outside the lab that it may touch: what it may use, how much, and what it
260
260
  may do there.
261
261
 
@@ -376,6 +376,38 @@ is a resource and a cap, nothing else. A lower cap is the agent's to write. A hi
376
376
  rule, a new resource or a larger grant comes out of a decision: one that lists that experiment, or
377
377
  that resource, under `about:`.
378
378
 
379
+ **Storylines drive the work; the record names no storyline.** A **storyline** is one argument the lab is
380
+ building from its findings, for one audience: what a paper, a talk or a report will later be written from. It is
381
+ the argument, never the finished artifact, and it keeps moving while the work runs. A lab that keeps storylines
382
+ keeps two layers apart. The record (`goals/`, `decisions/`, `runs/`) is the trail: every question, run, failed
383
+ attempt and replaced experiment, so that every number has an origin. No card names a storyline, because
384
+ storylines change, split, merge and are dropped while the record stays as it is and is read by each of them.
385
+ Above the record, the lab's library holds one **overview** page that keeps the whole trail in one place,
386
+ whatever storyline it serves: the words on one running example, the workflow, every related-work row, every
387
+ established finding, every criticism and what answers it. Beside it, each **active storyline** has its own page,
388
+ written as that storyline's technical argument and nothing else: it never talks about the lab or how it works. A
389
+ storyline page opens, under its thesis, with a **scope table** of five rows: the target audience and venues, the
390
+ core thesis, the experiments included (the clean runs each claim rests on), the experiments excluded or
391
+ superseded (a run that hit a harness bug, a subset a full run replaced, work that belongs to another storyline),
392
+ and the open experiments the storyline still needs. Then come its words on one running example, its pipeline,
393
+ its comparison with the published work of its community, its established results citing only included work, the
394
+ criticisms a reviewer in that community will raise with what answers each, and what remains to run. When the
395
+ time comes to write the paper, the talk or the report itself, it is written from this page.
396
+
397
+ The control runs from the storylines to the lab, not the other way. Which questions and experiments are
398
+ proposed, ordered, parked or dropped follows the open rows and the criticisms on the active storyline pages: a
399
+ decision says which storyline row it serves, and a step that serves none is a candidate to park or drop. When
400
+ a result lands, the overview and every storyline it touches are revised; a run that a newer one supersedes
401
+ moves from included to excluded. Adding, merging or retiring a storyline is direction, so it is decided with
402
+ you. A question's or an experiment's So far gives the current finding, not the story of the bugs on the way:
403
+ the replaced experiments and the reasons they were replaced keep that story.
404
+
405
+ A lab opts in by naming the pages in `lab.toml` (section 9). Then `lab check` holds each scope table:
406
+ included lists only finished work that is not void, replaced or dropped, open only work still to do, nothing
407
+ parked or dropped is in either, and a goal, a question or a step sits in one row; a storyline page committed
408
+ before a result about something it lists under included or open is noted. `lab now` lists each storyline's
409
+ open experiments, and the live steps no storyline lists, by themselves or by their question or goal.
410
+
379
411
  ## 5. What the agent uses
380
412
 
381
413
  - **To look:** `lab now`, `lab show <id or path>`, `lab brief <question>`, `lab since`, `lab define <term>`. Each shows one level,
@@ -449,7 +481,7 @@ Five skills: `lab-set-up`, `lab-work`, `lab-review`, `lab-talk` (tell you where
449
481
  a decision to you, record what was decided), and `lab-mission` (save, launch, resume and close a mission). One
450
482
  role: the reviewer.
451
483
 
452
- Seven rules:
484
+ Eight rules:
453
485
 
454
486
  1. Say what would refute it before you run.
455
487
  2. A number counts only as a reviewed result of a locked plan.
@@ -462,11 +494,13 @@ Seven rules:
462
494
  6. Record what was decided and why, in the lab's words, and show the operator the text as recorded.
463
495
  Never record a decision that was not discussed with them.
464
496
  7. Say what you are on. When you start on a card, log what you are doing and why now.
497
+ 8. Storylines drive the work; the record names no storyline. The storylines' open rows and criticisms say
498
+ what to propose, order, park or drop, and a result revises the overview and every storyline it touches.
465
499
 
466
500
  `lab check` holds what can be held mechanically: ids and links, the goal's vocabulary being terms of the glossary, a title and a description on every
467
501
  card, short cards that write only their own front matter, a test on every line, a reason on every
468
502
  replacement, unchanged locks, sealed runs, results that still re-derive and were reviewed, use inside
469
- the resources' amounts, a decision behind every goal, question and metered amount, an experiment
503
+ the resources' amounts, what each storyline's scope table lists when the lab names its storylines, a decision behind every goal, question and metered amount, an experiment
470
504
  behind every answer, the method and the skills as the kit installed them, and a history that only
471
505
  grows. What it cannot read as this page describes (a mistyped folder, a list written as one value, a
472
506
  file that is not text) is a problem it reports; no command stops on it.
@@ -903,6 +937,33 @@ holds the line `launched`, else next, and `lab check` asks for the status to be
903
937
  reports a mission that breaks any of this, one whose `carries:` is not a decision, and a current mission whose
904
938
  decision is still open.
905
939
 
940
+ **Storylines.** `lab.toml` names the library's storyline pages in a table, as library paths (the path under
941
+ `content/`, as `see:` writes it):
942
+
943
+ ```
944
+ [storylines]
945
+ overview = "entries/where-the-results-stand"
946
+ active = ["entries/storyline-a", "entries/storyline-b"]
947
+ ```
948
+
949
+ `overview` is the page that keeps the whole trail; it is never an active storyline. Each page under `active` is
950
+ in the library and marks the three cells of its scope table that list work, `data-scope="included"`,
951
+ `data-scope="excluded"` and `data-scope="open"`, empty when it lists nothing:
952
+
953
+ ```
954
+ <tr><th>Experiments included</th><td data-scope="included"><a href="/lab/G1.Q1.4/">G1.Q1.4</a>, ...</td></tr>
955
+ ```
956
+
957
+ A cell lists what its `/lab/<id>/` links name, written from the site's root; any other text in it is prose. A
958
+ cell whose closing tag is left out ends where the next cell or row begins. The rules hold for the ids written in
959
+ the cells. Under included, a step is done and not void, and a question or a goal is not parked or dropped;
960
+ under open, a step is open, waiting or running, and a question or a goal is not done, parked or dropped. A goal,
961
+ a question or a step has one row on a page: where another row needs to mention it, it is named in words,
962
+ without its link. A question written in one row and a step under it written in another is allowed: the open
963
+ question with its one finished step included is the usual case. A decision may be cited in any row. In
964
+ `lab now` and in the note on a stale page, a goal or a question written under included or open stands for
965
+ every step under it. A lab without `[storylines]` has none of this.
966
+
906
967
  **Worked-out states.** A goal is open until `reached: true` makes it done or `dropped:` drops it. A
907
968
  question is waiting while the decision it came from is open, then open, then done with its answer; it
908
969
  is parked while the last settled decision that parks or brings it back parks it. A step is waiting while
@@ -1,6 +1,6 @@
1
1
  # The method
2
2
 
3
- Seven rules every lab keeps. Each says what holds it: a command that refuses, a check, or a reviewer's
3
+ Eight rules every lab keeps. Each says what holds it: a command that refuses, a check, or a reviewer's
4
4
  judgement. The lab's own `AGENTS.md` adds only what is local.
5
5
 
6
6
  1. **Say what would refute it before you run.** An experiment states what it compares, what would
@@ -25,13 +25,14 @@ judgement. The lab's own `AGENTS.md` adds only what is local.
25
25
  4. **Write for a reader who was not there.** Every page stands on its own: it says what each thing it
26
26
  mentions is, names each arm of an experiment and what it is, names another page by its exact
27
27
  title, and uses a term only as the glossary defines it, the one place a word is defined. A number is said once: it lives in its result row, and a card names it. A state is
28
- worked out, never written, and So far says what was learned, never where a step stands. Every
28
+ worked out, never written, and So far says what is learned now, never where a step stands and never the story of
29
+ the bugs on the way: the replaced experiments keep that. Every
29
30
  card has one of the same states: open, waiting, running, parked, done, replaced or dropped. A
30
31
  number's label says what it counts and of how many, in one set of cases named once: "of the 20
31
32
  checks the solver leaves open", not "of 20". *The numbers and the budgets are held by `lab check`; whether a page
32
33
  can be read cold is judged, and the reviewer reads for it.*
33
34
  5. **Decide everything that is not direction or resources, and never wait idle.** Direction is the
34
- goals and the questions. Resources are what `resources.toml` lists and how much. For those two,
35
+ goals, the questions and the active storylines. Resources are what `resources.toml` lists and how much. For those two,
35
36
  open a decision that says what was seen, the options and what you recommend, and work on what it
36
37
  does not hold. What a decision settled needs no further yes. Everything else is yours: decide,
37
38
  record it, go on. A mission (`missions/`) carries out what a settled decision settled across sessions, and approves
@@ -49,3 +50,12 @@ judgement. The lab's own `AGENTS.md` adds only what is local.
49
50
  should never have to ask you. When you start on a card or move to another, log it:
50
51
  `lab log <id> doing "<what>" "<why now>"`. The line stands on the front page until a result, a
51
52
  stuck line or a choice about the same card ends it. *Judged.*
53
+ 8. **Storylines drive the work; the record names no storyline.** The record is the trail, and no card names a storyline.
54
+ When the lab keeps storylines (the arguments its papers, talks or reports will be written from), its
55
+ library keeps one overview of the whole trail, and one page per active
56
+ storyline that is that storyline's argument and nothing else. A storyline page opens with its scope table: audience,
57
+ thesis, the experiments included, those excluded or superseded, and those still open. What you propose,
58
+ order, park or drop follows the storylines' open rows and their reviewers' criticisms; when a result lands,
59
+ revise the overview and every storyline it touches, and move what a newer run supersedes to excluded. Adding,
60
+ merging or retiring a storyline is direction. *Held by `lab check` when `lab.toml` names the storylines; otherwise
61
+ judged.*
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  dynamic = ["readme"]
7
7
  name = "lab-kit-cli"
8
- version = "1.11.1"
8
+ version = "1.13.0"
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" }]
@@ -44,7 +44,8 @@ A failed plan is fixed by its author and read again.
44
44
  the first sentence and folds the rest.
45
45
 
46
46
  A failed results review is final for that experiment. Say in the note what a replacement must do
47
- differently.
47
+ differently. Its numbers can then be cited nowhere: if a storyline page lists it under included, `lab check`
48
+ says so, and the author takes it off.
48
49
 
49
50
  When you read a plan, also read the card as someone who was not there. If an arm is named and not
50
51
  explained, or the card points at something it does not say, say so in the note: it does not fail the
@@ -43,8 +43,15 @@ You set the lab up in one discussion with the operator, so that everything it se
43
43
  here first.
44
44
  11. The site: the lab's `docs/` folder is a folio library whose charter lists `lab_kit.site` under
45
45
  `views:`. Set it up with folio's own skill if it is not there.
46
-
47
- 12. Commit. Git is what holds the record: nothing is held before the first commit, and
46
+ 12. If the lab will argue its findings to an audience (a paper, a talk, a report), ask the operator which
47
+ storylines it aims at now, for whom and where (it is direction, and may stay empty). A storyline is the
48
+ argument such an output is written from, not the output itself. Write the overview page (for example `entries/where-the-results-stand`) with folio's
49
+ write skill: the words on one running example, the workflow, the related work, and empty sections for the
50
+ findings and the criticisms. For each storyline, write `entries/storyline-<slug>`: its thesis, then the scope table
51
+ (target audience and venues, core thesis, experiments included, excluded or superseded, open), with the
52
+ last three cells marked `data-scope="included"`, `"excluded"` and `"open"`. Name them in `lab.toml` under
53
+ `[storylines]` (`overview`, `active`). No card names a storyline (method rule 8).
54
+ 13. Commit. Git is what holds the record: nothing is held before the first commit, and
48
55
  `lab check --strict` says so.
49
56
 
50
57
  Done when `lab check --strict` passes and `lab now` shows each question as open.
@@ -33,7 +33,9 @@ from the record, shortest first. A decision is a discussion, not a request for a
33
33
  comes up, give its definition from `lab define` in a few words. Never use a word in its everyday
34
34
  sense when it is also a lab term. Compare items in a table.
35
35
  - For "where are we": each goal in a line, each open question with what is known so far, what is
36
- running, what is next, what there is to discuss. No more than a screen.
36
+ running, what is next, what there is to discuss. No more than a screen. When the lab names its storylines,
37
+ lead with them: each active storyline by its title, with what its open row still needs, then the steps
38
+ serving no storyline.
37
39
  - `lab brief` is the question's page as text. Give it as it is, cut to what they asked. If what you
38
40
  want to say is not in it, the card is missing something: fix the card, then answer.
39
41
  - If the record does not say, say so. Never fill a gap from memory.
@@ -64,6 +66,15 @@ that resource or that experiment under `about:` before it is decided: `lab new d
64
66
  --about <resource or id>`. What a locked decision is about cannot be changed afterwards, and a
65
67
  resource's new amount names the decision in `from`.
66
68
 
69
+ ## Storylines
70
+
71
+ When the lab names its storylines, they set the direction: the options you bring follow their open rows and
72
+ their reviewers' criticisms, and an order of work (`order:`) is built from the open rows, the storyline the
73
+ operator cares about first. Adding, splitting, merging or retiring a storyline is a decision like a question's:
74
+ `lab new decision "<what it is about>"`, with the storyline named in Seen and Decided by its page's title. Then
75
+ change the pages and `[storylines]` in `lab.toml` (the lab-work skill, The storylines and the overview). A
76
+ retired storyline's open work is parked or dropped in the same decision, or moved to another storyline's open row.
77
+
67
78
  ## When they decide something nobody raised
68
79
 
69
80
  `lab new decision "<what it is about>" --about <id>`, fill **Seen** with what prompted it, then
@@ -21,6 +21,11 @@ When a decision has set the order of the work, **Yours next** is already in that
21
21
  decision set it; follow it, and bring a change of order to the operator rather than skipping ahead.
22
22
  `lab show <id>` before you touch anything.
23
23
 
24
+ When the lab names its storylines (`lab now` has a **Storylines** section), read each active storyline page's open row
25
+ and its criticisms before you choose what to propose: they say what the lab is for now. A step listed under
26
+ **Serving no active storyline** is a candidate to park or drop, which you bring to the operator in a decision,
27
+ or it belongs on a storyline's open row, which you add.
28
+
24
29
  When `lab now` lists a current mission and you were started to run it, or the operator asks to save,
25
30
  launch or resume one, follow the lab-mission skill: it starts sessions on the steps, and each of them
26
31
  works as this skill says.
@@ -96,6 +101,35 @@ the plan in fixed boxes, then the steps and the record. Write the card for that
96
101
  - **Options are named in words, never letters.** "Read `sll` apart", not "(a)". A decision's options
97
102
  are a list, each item opening with its name in bold.
98
103
 
104
+ ## The storylines and the overview
105
+
106
+ When `lab.toml` names storylines (`[storylines]`), the library holds two kinds of page above the record (method
107
+ rule 8). The record itself never names a storyline: no card, no title, no So far says "Storyline A".
108
+
109
+ - **The overview** (`overview`) keeps the whole trail, whatever storyline it serves: the words on one running
110
+ example, the workflow, every related-work row, every established finding, every criticism and what answers
111
+ it, and what runs now. Nothing is left off it for being off a storyline.
112
+ - **A storyline page** (each of `active`) is that storyline's technical argument, in its community's voice: the
113
+ page a paper, a talk or a report is later written from. It never talks about the lab, its method or itself
114
+ ("this page shows", "the lab's record"). It opens, under its thesis, with the scope table: target audience and
115
+ venues, core thesis, experiments included, experiments excluded or superseded, open experiments. The last
116
+ three cells carry `data-scope="included"`, `"excluded"` and `"open"`, and list ids as links
117
+ (`<a href="/lab/G1.Q1.4/">G1.Q1.4</a>`). Then: its words on one running example, its pipeline, the published work
118
+ of its community compared, its established results citing only included work, the criticisms its reviewers
119
+ will raise (for each: what is true in it, what the record shows, what remains to run), and last what remains
120
+ to run.
121
+ - **A step or a question has one row on a page.** Where another row needs to mention it (excluded because
122
+ a newer run superseded it), name it in words, without its link. A decision may be cited anywhere.
123
+
124
+ When a result lands: bring the overview's findings up to date, then each storyline whose argument it touches.
125
+ If it supersedes an included run, move the old one to excluded and cite the new one. If it closes an open
126
+ row, move it to included, or to excluded if it is void or no longer serves the argument. A result's review
127
+ that fails makes the experiment void: take it off every included row. `lab check` refuses what a row may
128
+ not list, and notes a storyline committed before a result about something it lists.
129
+
130
+ Adding, splitting, merging or retiring a storyline is direction: bring it to the operator (the lab-talk skill),
131
+ then change the pages and `[storylines]`. A retired storyline's page leaves `active` and stays in the library.
132
+
99
133
  ## When to open a decision
100
134
 
101
135
  Open one when a question is answered or an experiment refutes what was expected, when a result
@@ -109,7 +143,9 @@ parked question, and never take it up because it looks open: it is listed under
109
143
 
110
144
  1. `lab new decision "<what it is about>" --about <the goals, questions or experiments it concerns>`.
111
145
  2. On its card write **Seen** (what was observed, naming results), **Options** (a list of two or
112
- three, each item an option with what it costs and what it changes) and **Recommendation**. Put under `holds:` only the
146
+ three, each item an option with what it costs and what it changes) and **Recommendation**. When the
147
+ lab names its storylines, say which storyline's open row or criticism each option serves, by the storyline's exact
148
+ title; an option that serves none says so. Put under `holds:` only the
113
149
  experiments that should not start before it is settled.
114
150
  3. Keep working on everything it does not hold. The lab-talk skill takes it to the operator and
115
151
  records what was decided.
@@ -182,10 +218,13 @@ until that decision is settled; after that it needs no further yes.
182
218
  of typing its number: `{attack-success}`. It is shown the way its row says it reads. Bring the
183
219
  experiment's **So far** up to date, and rewrite the question's **So far** the same way, with full names: `{G1.Q1.2:attack-success}`.
184
220
  So far says what was learned, never where a step stands ("is running", "is next", "no result yet"):
185
- the pages draw each step's state. `lab check` reports a question's So far that was last committed
221
+ the pages draw each step's state. It says what is known now, from the clean runs. When a newer
222
+ experiment fixes a harness bug or replaces an earlier setup, rewrite So far as the current finding; do
223
+ not retell the earlier bug, which the replaced experiment and its `because:` keep. `lab check` reports a question's So far that was last committed
186
224
  before a result under it, or one it names. Give each result a label that says what it counts and
187
225
  of how many, in a set of cases the lab names once ("of the 20 checks the solver leaves open").
188
226
  10. `lab log <experiment> result "<what was found, in a sentence, without numbers>" "<so what>"`.
227
+ 11. When the lab names its storylines, revise them in the same sitting (next section).
189
228
 
190
229
  The outcome is worked out from the lines: you never write it.
191
230
 
@@ -1,2 +1,2 @@
1
1
  """lab-kit: a research lab's record, its method, and the command that keeps both."""
2
- __version__ = "1.11.1"
2
+ __version__ = "1.13.0"
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
 
4
4
  import glob, os, re
5
5
 
6
- from . import history, record as R, runs as runs_, write
6
+ from . import history, storylines, record as R, runs as runs_, write
7
7
 
8
8
  KEYS = { # what a card's front matter may hold; a state is never among them
9
9
  "goal": {"title", "from", "reached", "dropped", "see"},
@@ -427,6 +427,9 @@ def run(lab, rederive=True):
427
427
  for t in sorted({t for t in terms if terms.count(t) > 1}):
428
428
  bad("glossary", "GLOSSARY.md", f"{t!r} is defined twice")
429
429
 
430
+ # storylines: each active storyline's scope lists only what it may
431
+ storylines.check(lab, bad, notes)
432
+
430
433
  # clean: the plans and the store stay out of default searches
431
434
  ignore = R.read(f"{root}/.ignore") if os.path.exists(f"{root}/.ignore") else ""
432
435
  if "plan/" not in ignore or "runs/" not in ignore:
@@ -0,0 +1,230 @@
1
+ """Storylines: the library's pages that each argue one line of the lab's findings, above a record that names no storyline.
2
+
3
+ A storyline is what a paper, a talk or a report will be written from; it is the argument, not the artifact.
4
+
5
+ A lab opts in with `[storylines]` in `lab.toml`: `overview`, the page that keeps the whole trail, and `active`, the page
6
+ of each storyline being written. Each storyline page opens with a scope table whose cells are marked
7
+ `data-scope="included"`, `"excluded"` and `"open"`; the `/lab/<id>/` links inside a cell are what it lists.
8
+ `lab check` holds what a cell may list, and `lab now` says what each storyline still has open and which live steps
9
+ serve no storyline.
10
+ """
11
+ from __future__ import annotations
12
+
13
+ import os, re
14
+ from html.parser import HTMLParser
15
+
16
+ from . import record as R
17
+
18
+ ROWS = ("included", "excluded", "open")
19
+ LINK = re.compile(r"^/lab/(G\d+(?:\.Q\d+(?:\.\d+)?)?|D\d+)/?(?:[#?].*)?$")
20
+ LIVE = ("open", "waiting", "running")
21
+
22
+
23
+ class _Scope(HTMLParser):
24
+ """The page's title and, for each marked cell, the ids its links name, in order."""
25
+
26
+ def __init__(self):
27
+ super().__init__(convert_charrefs=True)
28
+ self.title, self.cells, self.marked, self.unknown = "", {r: [] for r in ROWS}, set(), []
29
+ self._title, self._row, self._tag, self._depth, self._tables = False, None, None, 0, 0
30
+
31
+ def handle_starttag(self, tag, attrs):
32
+ a = dict(attrs)
33
+ if tag == "title":
34
+ self._title = True
35
+ if self._row and ("data-scope" in a or (self._depth == 1 and not self._tables and self._tag in ("td", "th") and tag in ("td", "th", "tr"))):
36
+ self._row = None # a cell whose closing tag is left out ends where the next cell or row begins
37
+ if self._row:
38
+ self._depth += tag == self._tag
39
+ self._tables += tag == "table" # a table inside the cell has rows and cells of its own
40
+ m = LINK.match(a.get("href") or "") if tag == "a" else None
41
+ if m and m.group(1) not in self.cells[self._row]:
42
+ self.cells[self._row].append(m.group(1))
43
+ return
44
+ row = a.get("data-scope")
45
+ if row is None:
46
+ return
47
+ if row not in ROWS:
48
+ self.unknown.append(row)
49
+ return
50
+ self._row, self._tag, self._depth, self._tables = row, tag, 1, 0
51
+ self.marked.add(row)
52
+
53
+ def handle_endtag(self, tag):
54
+ if tag == "title":
55
+ self._title = False
56
+ if self._row and tag == "table" and self._tables:
57
+ self._tables -= 1
58
+ if self._row and tag == self._tag:
59
+ self._depth -= 1
60
+ if not self._depth:
61
+ self._row = None
62
+
63
+ def handle_data(self, data):
64
+ if self._title:
65
+ self.title += data
66
+
67
+
68
+ def page_file(lab, path):
69
+ return os.path.join(lab.root, lab.cfg.get("library", "docs"), "content", path.strip("/"), "index.html")
70
+
71
+
72
+ def config(lab):
73
+ """(overview, active pages, problems). (None, [], []) when the lab keeps no storylines."""
74
+ p = lab.cfg.get("storylines")
75
+ if p is None:
76
+ return None, [], []
77
+ if not isinstance(p, dict):
78
+ return None, [], ["`[storylines]` is a table that names `overview` and `active`"]
79
+ problems = [f"`[storylines]` holds `{k}`; it names only `overview` and `active`" for k in sorted(set(p) - {"overview", "active"})]
80
+ overview, active = p.get("overview"), p.get("active", [])
81
+ if not isinstance(overview, str) or not overview.strip():
82
+ problems.append("`[storylines]` names its `overview`: the library page that keeps the whole trail, such as \"entries/where-the-results-stand\"")
83
+ overview = None
84
+ if not isinstance(active, list) or not all(isinstance(a, str) and a.strip() for a in active):
85
+ problems.append("`[storylines]` lists its `active` storyline pages as library paths, such as [\"entries/storyline-a\"]")
86
+ active = []
87
+ active = [a.strip("/") for a in active]
88
+ for path in ([overview] if overview else []) + active:
89
+ if ".." in path.split("/"):
90
+ problems.append(f"`[storylines]` names {path}; a page is a path inside the library's content, without `..`")
91
+ for a in sorted({a for a in active if active.count(a) > 1}):
92
+ problems.append(f"`[storylines]` lists {a} more than once")
93
+ return (overview.strip("/") if overview else None), list(dict.fromkeys(active)), problems
94
+
95
+
96
+ def read(lab):
97
+ """Each active storyline page as read: path, title, its cells' ids, the rows it marks; `missing` when not there."""
98
+ if getattr(lab, "_storylines", None) is not None:
99
+ return lab._storylines
100
+ _, active, _ = config(lab)
101
+ out = []
102
+ for path in active:
103
+ f = page_file(lab, path)
104
+ if not os.path.exists(f):
105
+ out.append({"path": path, "title": path, "cells": {r: [] for r in ROWS}, "marked": set(), "unknown": [], "missing": True})
106
+ continue
107
+ s = _Scope()
108
+ s.feed(R.read(f))
109
+ out.append({"path": path, "title": " ".join(s.title.split()) or path, "cells": s.cells, "marked": s.marked, "unknown": s.unknown, "missing": False})
110
+ lab._storylines = out
111
+ return out
112
+
113
+
114
+ def _covered(lab, ident):
115
+ """The ids a cell's id stands for: itself, and every question and step under a goal or a question."""
116
+ n = lab.nodes.get(ident)
117
+ if not n:
118
+ return {ident}
119
+ if n["type"] == "goal":
120
+ return {ident} | {q["id"] for q in n.get("questions", [])} | {x["id"] for q in n.get("questions", []) for x in q["items"]}
121
+ if n["type"] == "question":
122
+ return {ident} | {x["id"] for x in n["items"]}
123
+ return {ident}
124
+
125
+
126
+ def serving(lab):
127
+ """The live steps that no active storyline lists under included or open, by themselves or by their question or goal."""
128
+ named = set()
129
+ for p in read(lab):
130
+ for row in ("included", "open"):
131
+ for i in p["cells"][row]:
132
+ named |= _covered(lab, lab.folded.get(i, i))
133
+ return [x for x in lab.items if x["state"] in LIVE and not {x["id"], x["question"], x.get("goal")} & named]
134
+
135
+
136
+ def _say(n):
137
+ return "void: its results review failed, so no page uses its numbers" if n.get("label") == "void" else n["state"]
138
+
139
+
140
+ def check(lab, bad, notes):
141
+ """What `lab check` holds about the storylines: the table in `lab.toml`, each page's scope, and what each row lists."""
142
+ overview, active, problems = config(lab)
143
+ for p in problems:
144
+ bad("storylines", "lab.toml", p)
145
+ if overview is None and not active:
146
+ return
147
+ if overview and not os.path.exists(page_file(lab, overview)):
148
+ bad("storylines", "lab.toml", f"`overview` names {overview}, which is not a page of the library")
149
+ if overview and overview in active:
150
+ bad("storylines", "lab.toml", f"{overview} is the overview and an active storyline: the overview keeps the whole trail, a storyline only what it argues")
151
+ for p in read(lab):
152
+ where = lab.rel(page_file(lab, p["path"]))
153
+ if p["missing"]:
154
+ bad("storylines", "lab.toml", f"`active` names {p['path']}, which is not a page of the library")
155
+ continue
156
+ for row in ROWS:
157
+ if row not in p["marked"]:
158
+ bad("storylines", where, f"has no scope cell marked data-scope=\"{row}\": a storyline page opens with its scope table, and each of included, excluded and open is a marked cell, empty if it lists nothing")
159
+ for row in p["unknown"]:
160
+ bad("storylines", where, f"marks a cell data-scope=\"{row}\"; a scope cell is included, excluded or open")
161
+ rows = {row: [lab.folded.get(i, i) for i in p["cells"][row]] for row in ROWS}
162
+ for row, ids in rows.items():
163
+ for i in ids:
164
+ n = lab.nodes.get(i)
165
+ if not n:
166
+ bad("storylines", where, f"lists {i} under {row}, which is not a goal, a question, a step or a decision of the lab")
167
+ continue
168
+ if row == "included":
169
+ if n["type"] in R.STEPS and (n["state"] != "done" or n.get("label") == "void"):
170
+ to = "open" if n["state"] in LIVE else "excluded"
171
+ bad("storylines", where, f"lists {i} under included, which is {_say(n)}: a storyline includes only finished work that is not void, replaced or dropped; list it under {to}")
172
+ elif n["type"] in ("question", "goal") and n["state"] in ("parked", "dropped"):
173
+ bad("storylines", where, f"lists {i} under included, which is {n['state']}: list it under excluded")
174
+ elif row == "open":
175
+ if n["type"] in R.STEPS and n["state"] not in LIVE:
176
+ to = "included or excluded" if n["state"] == "done" and n.get("label") != "void" else "excluded"
177
+ bad("storylines", where, f"lists {i} under open, which is {_say(n)}: open holds only work still to do; list it under {to}")
178
+ elif n["type"] in ("question", "goal") and n["state"] in ("done", "parked", "dropped"):
179
+ bad("storylines", where, f"lists {i} under open, which is {n['state']}: open holds only work still to do")
180
+ for a, b in (("included", "excluded"), ("included", "open"), ("open", "excluded")):
181
+ for i in sorted(i for i in set(rows[a]) & set(rows[b]) if lab.nodes.get(i, {}).get("type") != "decision"): # a decision may be cited wherever it explains a row
182
+ bad("storylines", where, f"lists {i} under both {a} and {b}: a step or a question has one row; where another row needs it, name it in words, without its link")
183
+ for q, step, at in stale(lab):
184
+ notes.append(f"storylines: {q} was last committed before the result of {step} ({at}): bring the storyline's argument up to date with it")
185
+
186
+
187
+ def stale(lab):
188
+ """[(page, step, when)]: an active storyline page last committed before the newest `result` line about a step it lists
189
+ under included or open, or under a question or goal it lists there. Nothing where git cannot tell."""
190
+ from . import history
191
+ root, out = lab.root, []
192
+ if not history.committed(root):
193
+ return out
194
+ for p in read(lab):
195
+ if p["missing"]:
196
+ continue
197
+ f = os.path.relpath(page_file(lab, p["path"]), root)
198
+ if (history.git(root, "status", "--porcelain", "--", f) or "").strip():
199
+ continue # being brought up to date now
200
+ last = R.moment((history.git(root, "log", "-1", "--format=%cI", "--", f) or "").strip())
201
+ if not last:
202
+ continue
203
+ mine = set()
204
+ for row in ("included", "open"):
205
+ for i in p["cells"][row]:
206
+ mine |= _covered(lab, lab.folded.get(i, i))
207
+ newer = [l for l in lab.lines if l["kind"] == "result" and l["about"] in mine and l["time"] and (R.moment(l["at"]) or last) > last]
208
+ if newer:
209
+ out.append((p["path"], newer[-1]["about"], f"{newer[-1]['day']} {newer[-1]['time']}"))
210
+ return out
211
+
212
+
213
+ def now_lines(lab):
214
+ """The lines `lab now` gives the storylines: each active storyline with what it has open, then the steps no storyline serves."""
215
+ _, active, _ = config(lab)
216
+ if not active:
217
+ return []
218
+ out = ["", "Storylines (direction comes from their open rows and their criticisms)"]
219
+ for p in read(lab):
220
+ if p["missing"]:
221
+ out.append(f"- {p['path']}: not in the library")
222
+ continue
223
+ left = [lab.nodes[i] for i in (lab.folded.get(i, i) for i in p["cells"]["open"]) if i in lab.nodes and lab.nodes[i]["type"] != "decision"]
224
+ todo = ", ".join(f"{n['id']} {n['title']} ({n['state']})" for n in left) or "nothing"
225
+ out.append(f"- {p['title']} ({p['path']}): open {todo}")
226
+ idle = serving(lab)
227
+ if idle:
228
+ out += ["", "Serving no active storyline (add to a storyline's open row, or bring parking or dropping it to the operator)"]
229
+ out += [f"- {x['id']} {x['title']} ({x['state']})" for x in idle]
230
+ return out
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
 
4
4
  import os
5
5
 
6
- from . import record as R
6
+ from . import storylines, record as R
7
7
 
8
8
 
9
9
  def num(x):
@@ -91,6 +91,7 @@ def _now(lab):
91
91
  key = x["label"] if x["state"] == "done" and x.get("label") else x["state"]
92
92
  counts[key] = counts.get(key, 0) + 1
93
93
  out += [f"- {q['id']} ({state(q)}): {q['title']} [{', '.join(f'{n} {k}' for k, n in counts.items()) or 'nothing under it'}]"]
94
+ out += storylines.now_lines(lab)
94
95
  aside = lab.set_aside()
95
96
  if any(aside.values()):
96
97
  out += ["", "Set aside"] + [f"- {q['id']} (parked by {lab.parked_by(q['id'])['id']}): {q['title']}" for q in aside["parked"]]
@@ -0,0 +1,189 @@
1
+ """Storylines drive the work: the record names no storyline, and each active storyline's page opens with a scope table whose
2
+ included, excluded and open cells `lab check` holds, and whose open row `lab now` puts before the agent."""
3
+ import os
4
+
5
+ from test_flow import experiment, lab, open_question, results
6
+ from test_integrity import WRITES, commit, done
7
+ from test_states import PAST, git_env
8
+
9
+ PAGE = """<!DOCTYPE html>
10
+ <html><head><title>{title}</title></head>
11
+ <body><main>
12
+ <p class="thesis">The error falls with the square root of the sample.</p>
13
+ <section id="scope"><table><tbody>
14
+ <tr><th>Experiments included</th><td data-scope="included">{included}</td></tr>
15
+ <tr><th>Experiments excluded / superseded</th><td data-scope="excluded">{excluded}</td></tr>
16
+ <tr><th>Open experiments</th><td data-scope="open">{open}</td></tr>
17
+ </tbody></table></section>
18
+ </main></body></html>
19
+ """
20
+
21
+
22
+ def links(*ids):
23
+ return ", ".join(f'<a href="/lab/{i}/">{i}</a>' for i in ids)
24
+
25
+
26
+ def page(root, path, title="Storyline A: The square-root law", included=(), excluded=(), open_=()):
27
+ d = os.path.join(root, "docs", "content", path)
28
+ os.makedirs(d, exist_ok=True)
29
+ open(f"{d}/index.html", "w").write(PAGE.format(title=title, included=links(*included), excluded=links(*excluded), open=links(*open_)))
30
+
31
+
32
+ def storylines(root, overview="entries/where-the-results-stand", active=("entries/storyline-a",)):
33
+ text = open(f"{root}/lab.toml").read().split("[storylines]")[0]
34
+ open(f"{root}/lab.toml", "w").write(text + f'[storylines]\noverview = "{overview}"\nactive = [{", ".join(chr(34) + a + chr(34) for a in active)}]\n')
35
+
36
+
37
+ def two_experiments(root):
38
+ """G1.Q1.1 done and confirmed, G1.Q1.2 done and void, G1.Q1.3 still open."""
39
+ open_question(root)
40
+ first, d1, c1 = experiment(root, command=WRITES % "0.5")
41
+ lab(root, "lock", first)
42
+ lab(root, "run", first, "--wait", "--", *c1)
43
+ done(root, first, d1)
44
+ void, d2, c2 = experiment(root, title="Error at 100 and at 1600 flips", command=WRITES % "0.25")
45
+ lab(root, "lock", void)
46
+ lab(root, "run", void, "--wait", "--", *c2)
47
+ results(d2, "0.25")
48
+ lab(root, "review", void, "results", "fail", "The seed was fixed after a first look.")
49
+ later, _, _ = experiment(root, title="Error at 400 and at 1600 flips")
50
+ page(root, "entries/where-the-results-stand", title="Where the results stand")
51
+ return first, void, later
52
+
53
+
54
+ def test_a_lab_without_storylines_is_unchanged(tmp_path):
55
+ root = str(tmp_path)
56
+ two_experiments(root)
57
+ assert "Storylines" not in lab(root, "now")
58
+ assert "storylines:" not in lab(root, "check", "--no-rederive")
59
+
60
+
61
+ def test_a_storyline_includes_only_finished_work_and_lists_each_id_once(tmp_path):
62
+ root = str(tmp_path)
63
+ first, void, later = two_experiments(root)
64
+ storylines(root)
65
+ page(root, "entries/storyline-a", included=(first, void, later), excluded=(first,), open_=("G1.Q9.1",))
66
+ out = lab(root, "check", "--no-rederive", ok=False)
67
+ assert f"lists {void} under included, which is void" in out and "list it under excluded" in out
68
+ assert f"lists {later} under included, which is open" in out and "list it under open" in out
69
+ assert f"lists {first} under both included and excluded" in out
70
+ assert "lists G1.Q9.1 under open, which is not a goal, a question, a step or a decision of the lab" in out
71
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(first,))
72
+ assert f"lists {first} under open, which is done" in lab(root, "check", "--no-rederive", ok=False)
73
+ page(root, "entries/storyline-a", included=(first, "D1"), excluded=(void,), open_=(later,))
74
+ assert "the record is sound" in lab(root, "check", "--no-rederive")
75
+
76
+
77
+ def test_the_storylines_table_names_pages_that_are_there_each_with_its_scope(tmp_path):
78
+ root = str(tmp_path)
79
+ two_experiments(root)
80
+ storylines(root, active=("entries/storyline-a", "entries/storyline-b", "entries/where-the-results-stand"))
81
+ os.makedirs(f"{root}/docs/content/entries/storyline-a", exist_ok=True)
82
+ open(f"{root}/docs/content/entries/storyline-a/index.html", "w").write("<html><body><td data-scope=\"kept\"></td></body></html>")
83
+ out = lab(root, "check", "--no-rederive", ok=False)
84
+ assert "`active` names entries/storyline-b, which is not a page of the library" in out
85
+ assert "is the overview and an active storyline" in out
86
+ assert 'has no scope cell marked data-scope="included"' in out and 'marks a cell data-scope="kept"' in out
87
+ storylines(root, overview="entries/nowhere")
88
+ assert "`overview` names entries/nowhere, which is not a page of the library" in lab(root, "check", "--no-rederive", ok=False)
89
+
90
+
91
+ def test_a_card_never_names_a_storyline(tmp_path):
92
+ root = str(tmp_path)
93
+ first, _, _ = two_experiments(root)
94
+ from test_flow import folder, front
95
+ front(f"{folder(root, first)}/experiment.md", storyline="storyline-a")
96
+ assert "`storyline:` is not something a experiment card holds" in lab(root, "check", "--no-rederive", ok=False)
97
+
98
+
99
+ def test_now_puts_each_storylines_open_row_first_and_names_what_serves_no_storyline(tmp_path):
100
+ root = str(tmp_path)
101
+ first, void, later = two_experiments(root)
102
+ storylines(root)
103
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,))
104
+ now = lab(root, "now")
105
+ assert "Storyline A: The square-root law (entries/storyline-a): open nothing" in now
106
+ assert "Serving no active storyline" in now and f"- {later} Error at 400 and at 1600 flips (open)" in now
107
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(later,))
108
+ now = lab(root, "now")
109
+ assert f"open {later} Error at 400 and at 1600 flips (open)" in now and "Serving no active storyline" not in now
110
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=("G1.Q1",)) # a question stands for every step under it
111
+ assert "Serving no active storyline" not in lab(root, "now")
112
+
113
+
114
+ def test_a_storyline_older_than_a_result_it_lists_is_noted(tmp_path):
115
+ root = str(tmp_path)
116
+ first, void, later = two_experiments(root)
117
+ storylines(root)
118
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(later,))
119
+ git_env(root, "init", "-q")
120
+ git_env(root, "add", "-A")
121
+ git_env(root, "commit", "-qm", "the storyline", GIT_AUTHOR_DATE=PAST, GIT_COMMITTER_DATE=PAST)
122
+ lab(root, "log", first, "result", "The error halves.", "It converges as the theory says.")
123
+ commit(root, "the result")
124
+ out = lab(root, "check", "--no-rederive", ok=False) # the question's So far is stale too, which is a problem
125
+ assert f"note: storylines: entries/storyline-a was last committed before the result of {first}" in out
126
+ assert "storylines:" not in out.split("note: storylines:")[1].split("\n", 1)[1] # a note, never a problem
127
+
128
+
129
+ def test_every_rule_on_a_row_and_on_the_table_has_a_refusal(tmp_path):
130
+ root = str(tmp_path)
131
+ first, void, later = two_experiments(root)
132
+ storylines(root)
133
+ from test_flow import folder, front
134
+ front(f"{folder(root, later)}/experiment.md", dropped="the first comparison answers the question")
135
+ lab(root, "answer", "G1.Q1", "yes", "It halves at 400 flips.")
136
+ page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=("G1.Q1",))
137
+ assert "lists G1.Q1 under open, which is done" in lab(root, "check", "--no-rederive", ok=False)
138
+ page(root, "entries/storyline-a", included=("G1", first), excluded=(void,), open_=("G1",))
139
+ assert "lists G1 under both included and open" in lab(root, "check", "--no-rederive", ok=False)
140
+ # a question written in one row and a step under it in another is allowed
141
+ page(root, "entries/storyline-a", included=("G1.Q1",), excluded=(void, later), open_=())
142
+ assert "storylines:" not in lab(root, "check", "--no-rederive")
143
+ page(root, "entries/storyline-a", included=(first,), excluded=("G1.Q1", void), open_=())
144
+ assert "storylines:" not in lab(root, "check", "--no-rederive")
145
+ for table, said in (('storylines = "entries/storyline-a"', "`[storylines]` is a table"),
146
+ ('[storylines]\noverview = "entries/where-the-results-stand"\nkept = 1', "`[storylines]` holds `kept`"),
147
+ ('[storylines]\noverview = 3', "`[storylines]` names its `overview`"),
148
+ ('[storylines]\noverview = "entries/where-the-results-stand"\nactive = "entries/storyline-a"', "lists its `active` storyline pages"),
149
+ ('[storylines]\noverview = "entries/where-the-results-stand"\nactive = ["entries/storyline-a", "entries/storyline-a/"]', "lists entries/storyline-a more than once"),
150
+ ('[storylines]\noverview = "../outside"', "without `..`")):
151
+ text = open(f"{root}/lab.toml").read().split("[storylines]")[0].split("storylines =")[0]
152
+ open(f"{root}/lab.toml", "w").write(text + table + "\n")
153
+ assert said in lab(root, "check", "--no-rederive", ok=False), table
154
+
155
+
156
+ def test_a_parked_or_dropped_question_is_in_neither_included_nor_open(tmp_path):
157
+ root = str(tmp_path)
158
+ first, void, later = two_experiments(root)
159
+ from test_parked import park
160
+ card, d = park(root, "G1.Q1", "Set the first sizes aside", "")
161
+ lab(root, "decide", d, "--with", "Ada", "Set the first sizes aside until the sampler is fixed.")
162
+ storylines(root)
163
+ page(root, "entries/storyline-a", included=("G1.Q1",), excluded=(void,))
164
+ assert "lists G1.Q1 under included, which is parked" in lab(root, "check", "--no-rederive", ok=False)
165
+ page(root, "entries/storyline-a", excluded=(void,), open_=("G1.Q1",))
166
+ assert "lists G1.Q1 under open, which is parked" in lab(root, "check", "--no-rederive", ok=False)
167
+
168
+
169
+ def test_a_cell_left_open_ends_where_the_next_cell_begins(tmp_path):
170
+ root = str(tmp_path)
171
+ first, void, later = two_experiments(root)
172
+ storylines(root)
173
+ d = f"{root}/docs/content/entries/storyline-a"
174
+ os.makedirs(d, exist_ok=True)
175
+ open(f"{d}/index.html", "w").write(f'<html><head><title>Storyline A</title></head><body><table><tr><td data-scope="included">{links(first)}'
176
+ f'<tr><td data-scope="excluded">{links(void)}<tr><td data-scope="open">{links(later)}</table></body></html>')
177
+ assert "storylines:" not in lab(root, "check", "--no-rederive")
178
+ assert f"open {later} Error at 400 and at 1600 flips (open)" in lab(root, "now")
179
+
180
+
181
+ def test_a_table_inside_a_scope_cell_is_read_as_part_of_it(tmp_path):
182
+ root = str(tmp_path)
183
+ first, void, later = two_experiments(root)
184
+ storylines(root)
185
+ d = f"{root}/docs/content/entries/storyline-a"
186
+ os.makedirs(d, exist_ok=True)
187
+ open(f"{d}/index.html", "w").write(f'<html><body><table><tr><td data-scope="included"><table><tr><td>{links(first, void)}</td></tr></table></td>'
188
+ f'<td data-scope="excluded"></td><td data-scope="open">{links(later)}</td></tr></table></body></html>')
189
+ assert f"lists {void} under included, which is void" in lab(root, "check", "--no-rederive", ok=False)
File without changes
File without changes
File without changes
File without changes