diff --git a/CHANGELOG.md b/CHANGELOG.md index 4386878..6a35049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,30 @@ # Changelog +## 1.13.0 + +- **A scope page is a storyline.** A storyline is one argument the lab is building from its findings, for one + audience: what a paper, a talk or a report is later written from, never the finished artifact. The table in + `lab.toml` is `[storylines]`, `lab now` has a Storylines section and a "Serving no active storyline" list, and + the method, the model and the skills say storyline throughout. 1.12.0's table of the same shape, `[papers]`, + is no longer read: no lab had turned it on. Run `lab init` in a lab after upgrading. + ## 1.12.0 -- **Papers drive the work; the record names no paper** (method rule 8, model section 4). A lab that writes - papers keeps one overview page of the whole trail and one page per active paper, written as that paper's - argument and opening with a scope table: audience, thesis, experiments included, excluded or superseded, and - open. The papers' open rows and their reviewers' criticisms say what is proposed, ordered, parked or dropped, - and a result revises the overview and every paper it touches. So far gives the current finding, never the - story of the bugs on the way. Adding, merging or retiring a paper is direction. -- **`[papers]` in `lab.toml`** names the overview and the active paper pages, as library paths. It is optional: - a lab without it is unchanged. With it, each paper page marks its scope cells `data-scope="included"`, - `"excluded"` and `"open"`, and `lab check` refuses an id that is not in the lab, a step under included that is - not done or is void, a step under open that is finished, a question or goal under open that is done, a parked - or dropped question or goal in either, and a goal, question or step listed in two rows of one page. It notes a - paper page committed before a result about something it lists under included or open. -- **`lab now` lists the papers**: each active paper with the open work its scope names, then the live steps - that no paper lists, by themselves or by their question or goal. +- **Storylines drive the work; the record names no storyline** (method rule 8, model section 4). A lab keeps one + overview page of the whole trail and one page per active storyline, written as that argument and opening with + a scope table: audience, thesis, experiments included, excluded or superseded, and open. The storylines' open + rows and their reviewers' criticisms say what is proposed, ordered, parked or dropped, and a result revises the + overview and every storyline it touches. So far gives the current finding, never the story of the bugs on the + way. Adding, merging or retiring a storyline is direction. +- **A table in `lab.toml`** (`[papers]` in this release, `[storylines]` from 1.13.0) names the overview and the + active storyline pages, as library paths. It is optional: a lab without it is unchanged. With it, each + storyline page marks its scope cells `data-scope="included"`, `"excluded"` and `"open"`, and `lab check` + refuses an id that is not in the lab, a step under included that is not done or is void, a step under open + that is finished, a question or goal under open that is done, a parked or dropped question or goal in either, + and a goal, question or step listed in two rows of one page. It notes a storyline page committed before a + result about something it lists under included or open. +- **`lab now` lists the storylines**: each active one with the open work its scope names, then the live steps + that none lists, by themselves or by their question or goal. - The skills `lab-set-up`, `lab-work`, `lab-talk` and `lab-review` and the method changed: run `lab init` in a lab after upgrading. diff --git a/docs/model.md b/docs/model.md index f3d091e..5a0b705 100644 --- a/docs/model.md +++ b/docs/model.md @@ -255,7 +255,7 @@ in points. When a named result belongs to a replaced experiment, the page says s You decide two things: **direction** and **resources**. You decide them in a discussion with the agent, not by approving requests. -- **Direction.** The goals, the questions, and the papers they serve. +- **Direction.** The goals, the questions, and the storylines they serve. - **Resources.** Everything outside the lab that it may touch: what it may use, how much, and what it may do there. @@ -376,35 +376,37 @@ is a resource and a cap, nothing else. A lower cap is the agent's to write. A hi rule, a new resource or a larger grant comes out of a decision: one that lists that experiment, or that resource, under `about:`. -**Papers drive the work; the record names no paper.** A lab that writes papers keeps two layers apart. The -record (`goals/`, `decisions/`, `runs/`) is the trail: every question, run, failed attempt and replaced -experiment, so that every number has an origin. No card names a paper, because papers change, split, merge -and are dropped while the record stays as it is and is read by each of them. Above the record, the lab's -library holds one **overview** page that keeps the whole trail in one place, whatever paper it serves: the -words on one running example, the workflow, every related-work row, every established finding, every -criticism and what answers it. Beside it, each **active paper** has its own page, written as that paper's -technical argument and nothing else: it never talks about the lab or how it works. A paper page opens, under -its thesis, with a **scope table** of five rows: the target audience and venues, the core thesis, the -experiments included (the clean runs each claim rests on), the experiments excluded or superseded (a run -that hit a harness bug, a subset a full run replaced, work that belongs to another paper), and the open -experiments the paper still needs. Then come its words on one running example, its pipeline, its -comparison with the published work of its community, its established results citing only included work, -the criticisms a reviewer in that community will raise with what answers each, and what remains to run. - -The control runs from the papers to the lab, not the other way. Which questions and experiments are -proposed, ordered, parked or dropped follows the open rows and the criticisms on the active paper pages: a -decision says which paper row it serves, and a step that serves none is a candidate to park or drop. When a -result lands, the overview and every paper it touches are revised; a run that a newer one supersedes moves -from included to excluded. Adding, merging or retiring a paper is direction, so it is decided with you. A -question's or an experiment's So far gives the current finding, not the story of the bugs on the way: the -replaced experiments and the reasons they were replaced keep that story. +**Storylines drive the work; the record names no storyline.** A **storyline** is one argument the lab is +building from its findings, for one audience: what a paper, a talk or a report will later be written from. It is +the argument, never the finished artifact, and it keeps moving while the work runs. A lab that keeps storylines +keeps two layers apart. The record (`goals/`, `decisions/`, `runs/`) is the trail: every question, run, failed +attempt and replaced experiment, so that every number has an origin. No card names a storyline, because +storylines change, split, merge and are dropped while the record stays as it is and is read by each of them. +Above the record, the lab's library holds one **overview** page that keeps the whole trail in one place, +whatever storyline it serves: the words on one running example, the workflow, every related-work row, every +established finding, every criticism and what answers it. Beside it, each **active storyline** has its own page, +written as that storyline's technical argument and nothing else: it never talks about the lab or how it works. A +storyline page opens, under its thesis, with a **scope table** of five rows: the target audience and venues, the +core thesis, the experiments included (the clean runs each claim rests on), the experiments excluded or +superseded (a run that hit a harness bug, a subset a full run replaced, work that belongs to another storyline), +and the open experiments the storyline still needs. Then come its words on one running example, its pipeline, +its comparison with the published work of its community, its established results citing only included work, the +criticisms a reviewer in that community will raise with what answers each, and what remains to run. When the +time comes to write the paper, the talk or the report itself, it is written from this page. + +The control runs from the storylines to the lab, not the other way. Which questions and experiments are +proposed, ordered, parked or dropped follows the open rows and the criticisms on the active storyline pages: a +decision says which storyline row it serves, and a step that serves none is a candidate to park or drop. When +a result lands, the overview and every storyline it touches are revised; a run that a newer one supersedes +moves from included to excluded. Adding, merging or retiring a storyline is direction, so it is decided with +you. A question's or an experiment's So far gives the current finding, not the story of the bugs on the way: +the replaced experiments and the reasons they were replaced keep that story. A lab opts in by naming the pages in `lab.toml` (section 9). Then `lab check` holds each scope table: included lists only finished work that is not void, replaced or dropped, open only work still to do, nothing -parked or dropped is in either, and a goal, a question or a step sits in one row; a paper page committed -before a result about something it lists under included or open is noted. `lab now` lists each paper's open -experiments, and the live steps no paper lists, by themselves or -by their question or goal. +parked or dropped is in either, and a goal, a question or a step sits in one row; a storyline page committed +before a result about something it lists under included or open is noted. `lab now` lists each storyline's +open experiments, and the live steps no storyline lists, by themselves or by their question or goal. ## 5. What the agent uses @@ -492,13 +494,13 @@ Eight rules: 6. Record what was decided and why, in the lab's words, and show the operator the text as recorded. Never record a decision that was not discussed with them. 7. Say what you are on. When you start on a card, log what you are doing and why now. -8. Papers drive the work; the record names no paper. The papers' open rows and criticisms say what to - propose, order, park or drop, and a result revises the overview and every paper it touches. +8. Storylines drive the work; the record names no storyline. The storylines' open rows and criticisms say + what to propose, order, park or drop, and a result revises the overview and every storyline it touches. `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 card, short cards that write only their own front matter, a test on every line, a reason on every replacement, unchanged locks, sealed runs, results that still re-derive and were reviewed, use inside -the resources' amounts, what each paper's scope table lists when the lab names its papers, a decision behind every goal, question and metered amount, an experiment +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 behind every answer, the method and the skills as the kit installed them, and a history that only grows. What it cannot read as this page describes (a mistyped folder, a list written as one value, a file that is not text) is a problem it reports; no command stops on it. @@ -935,16 +937,16 @@ holds the line `launched`, else next, and `lab check` asks for the status to be reports a mission that breaks any of this, one whose `carries:` is not a decision, and a current mission whose decision is still open. -**Papers.** `lab.toml` names the library's paper pages in a table, as library paths (the path under +**Storylines.** `lab.toml` names the library's storyline pages in a table, as library paths (the path under `content/`, as `see:` writes it): ``` -[papers] +[storylines] overview = "entries/where-the-results-stand" -active = ["entries/paper-a", "entries/paper-b"] +active = ["entries/storyline-a", "entries/storyline-b"] ``` -`overview` is the page that keeps the whole trail; it is never an active paper. Each page under `active` is +`overview` is the page that keeps the whole trail; it is never an active storyline. Each page under `active` is in the library and marks the three cells of its scope table that list work, `data-scope="included"`, `data-scope="excluded"` and `data-scope="open"`, empty when it lists nothing: @@ -960,7 +962,7 @@ a question or a step has one row on a page: where another row needs to mention i without its link. A question written in one row and a step under it written in another is allowed: the open question with its one finished step included is the usual case. A decision may be cited in any row. In `lab now` and in the note on a stale page, a goal or a question written under included or open stands for -every step under it. A lab without `[papers]` has none of this. +every step under it. A lab without `[storylines]` has none of this. **Worked-out states.** A goal is open until `reached: true` makes it done or `dropped:` drops it. A question is waiting while the decision it came from is open, then open, then done with its answer; it diff --git a/method/METHOD.md b/method/METHOD.md index 6613526..8daa4df 100644 --- a/method/METHOD.md +++ b/method/METHOD.md @@ -32,7 +32,7 @@ judgement. The lab's own `AGENTS.md` adds only what is local. checks the solver leaves open", not "of 20". *The numbers and the budgets are held by `lab check`; whether a page can be read cold is judged, and the reviewer reads for it.* 5. **Decide everything that is not direction or resources, and never wait idle.** Direction is the - goals, the questions and the active papers. Resources are what `resources.toml` lists and how much. For those two, + goals, the questions and the active storylines. Resources are what `resources.toml` lists and how much. For those two, open a decision that says what was seen, the options and what you recommend, and work on what it does not hold. What a decision settled needs no further yes. Everything else is yours: decide, record it, go on. A mission (`missions/`) carries out what a settled decision settled across sessions, and approves @@ -50,11 +50,12 @@ judgement. The lab's own `AGENTS.md` adds only what is local. should never have to ask you. When you start on a card or move to another, log it: `lab log doing "" ""`. The line stands on the front page until a result, a stuck line or a choice about the same card ends it. *Judged.* -8. **Papers drive the work; the record names no paper.** The record is the trail, and no card names a paper. - When the lab writes papers, its library keeps one overview of the whole trail, and one page per active - paper that is that paper's argument and nothing else. A paper page opens with its scope table: audience, +8. **Storylines drive the work; the record names no storyline.** The record is the trail, and no card names a storyline. + When the lab keeps storylines (the arguments its papers, talks or reports will be written from), its + library keeps one overview of the whole trail, and one page per active + storyline that is that storyline's argument and nothing else. A storyline page opens with its scope table: audience, thesis, the experiments included, those excluded or superseded, and those still open. What you propose, - order, park or drop follows the papers' open rows and their reviewers' criticisms; when a result lands, - revise the overview and every paper it touches, and move what a newer run supersedes to excluded. Adding, - merging or retiring a paper is direction. *Held by `lab check` when `lab.toml` names the papers; otherwise + order, park or drop follows the storylines' open rows and their reviewers' criticisms; when a result lands, + revise the overview and every storyline it touches, and move what a newer run supersedes to excluded. Adding, + merging or retiring a storyline is direction. *Held by `lab check` when `lab.toml` names the storylines; otherwise judged.* diff --git a/pyproject.toml b/pyproject.toml index c26407e..513854e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] dynamic = ["readme"] name = "lab-kit-cli" -version = "1.12.0" +version = "1.13.0" description = "A research lab's record, its method, and the command that keeps both." license = "MIT" authors = [{ name = "Piergiuseppe Mallozzi" }] diff --git a/skills/lab-review/SKILL.md b/skills/lab-review/SKILL.md index 20148d3..5071531 100644 --- a/skills/lab-review/SKILL.md +++ b/skills/lab-review/SKILL.md @@ -44,7 +44,7 @@ A failed plan is fixed by its author and read again. the first sentence and folds the rest. A failed results review is final for that experiment. Say in the note what a replacement must do -differently. Its numbers can then be cited nowhere: if a paper page lists it under included, `lab check` +differently. Its numbers can then be cited nowhere: if a storyline page lists it under included, `lab check` says so, and the author takes it off. When you read a plan, also read the card as someone who was not there. If an arm is named and not diff --git a/skills/lab-set-up/SKILL.md b/skills/lab-set-up/SKILL.md index 86bc7df..ce9db85 100644 --- a/skills/lab-set-up/SKILL.md +++ b/skills/lab-set-up/SKILL.md @@ -43,13 +43,14 @@ You set the lab up in one discussion with the operator, so that everything it se here first. 11. The site: the lab's `docs/` folder is a folio library whose charter lists `lab_kit.site` under `views:`. Set it up with folio's own skill if it is not there. -12. If the lab will write papers, ask the operator which papers it aims at now, for whom and where (it is - direction, and may stay empty). Write the overview page (for example `entries/where-the-results-stand`) with folio's +12. If the lab will argue its findings to an audience (a paper, a talk, a report), ask the operator which + storylines it aims at now, for whom and where (it is direction, and may stay empty). A storyline is the + 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 write skill: the words on one running example, the workflow, the related work, and empty sections for the - findings and the criticisms. For each paper, write `entries/paper-`: its thesis, then the scope table + findings and the criticisms. For each storyline, write `entries/storyline-`: its thesis, then the scope table (target audience and venues, core thesis, experiments included, excluded or superseded, open), with the last three cells marked `data-scope="included"`, `"excluded"` and `"open"`. Name them in `lab.toml` under - `[papers]` (`overview`, `active`). No card names a paper (method rule 8). + `[storylines]` (`overview`, `active`). No card names a storyline (method rule 8). 13. Commit. Git is what holds the record: nothing is held before the first commit, and `lab check --strict` says so. diff --git a/skills/lab-talk/SKILL.md b/skills/lab-talk/SKILL.md index e5ac42e..4f92d99 100644 --- a/skills/lab-talk/SKILL.md +++ b/skills/lab-talk/SKILL.md @@ -33,9 +33,9 @@ from the record, shortest first. A decision is a discussion, not a request for a comes up, give its definition from `lab define` in a few words. Never use a word in its everyday sense when it is also a lab term. Compare items in a table. - For "where are we": each goal in a line, each open question with what is known so far, what is - running, what is next, what there is to discuss. No more than a screen. When the lab names its papers, - lead with them: each active paper by its title, with what its open row still needs, then the steps - serving no paper. + running, what is next, what there is to discuss. No more than a screen. When the lab names its storylines, + lead with them: each active storyline by its title, with what its open row still needs, then the steps + serving no storyline. - `lab brief` is the question's page as text. Give it as it is, cut to what they asked. If what you want to say is not in it, the card is missing something: fix the card, then answer. - If the record does not say, say so. Never fill a gap from memory. @@ -66,14 +66,14 @@ that resource or that experiment under `about:` before it is decided: `lab new d --about `. What a locked decision is about cannot be changed afterwards, and a resource's new amount names the decision in `from`. -## Papers +## Storylines -When the lab names its papers, they set the direction: the options you bring follow their open rows and -their reviewers' criticisms, and an order of work (`order:`) is built from the open rows, the paper the -operator cares about first. Adding, splitting, merging or retiring a paper is a decision like a question's: -`lab new decision ""`, with the paper named in Seen and Decided by its page's title. Then -change the pages and `[papers]` in `lab.toml` (the lab-work skill, The papers and the overview). A -retired paper's open work is parked or dropped in the same decision, or moved to another paper's open row. +When the lab names its storylines, they set the direction: the options you bring follow their open rows and +their reviewers' criticisms, and an order of work (`order:`) is built from the open rows, the storyline the +operator cares about first. Adding, splitting, merging or retiring a storyline is a decision like a question's: +`lab new decision ""`, with the storyline named in Seen and Decided by its page's title. Then +change the pages and `[storylines]` in `lab.toml` (the lab-work skill, The storylines and the overview). A +retired storyline's open work is parked or dropped in the same decision, or moved to another storyline's open row. ## When they decide something nobody raised diff --git a/skills/lab-work/SKILL.md b/skills/lab-work/SKILL.md index e92f14d..3f26404 100644 --- a/skills/lab-work/SKILL.md +++ b/skills/lab-work/SKILL.md @@ -21,10 +21,10 @@ When a decision has set the order of the work, **Yours next** is already in that decision set it; follow it, and bring a change of order to the operator rather than skipping ahead. `lab show ` before you touch anything. -When the lab names its papers (`lab now` has a **Papers** section), read each active paper page's open row +When the lab names its storylines (`lab now` has a **Storylines** section), read each active storyline page's open row and its criticisms before you choose what to propose: they say what the lab is for now. A step listed under -**Serving no active paper** is a candidate to park or drop, which you bring to the operator in a decision, -or it belongs on a paper's open row, which you add. +**Serving no active storyline** is a candidate to park or drop, which you bring to the operator in a decision, +or it belongs on a storyline's open row, which you add. When `lab now` lists a current mission and you were started to run it, or the operator asks to save, launch or resume one, follow the lab-mission skill: it starts sessions on the steps, and each of them @@ -101,33 +101,34 @@ the plan in fixed boxes, then the steps and the record. Write the card for that - **Options are named in words, never letters.** "Read `sll` apart", not "(a)". A decision's options are a list, each item opening with its name in bold. -## The papers and the overview +## The storylines and the overview -When `lab.toml` names papers (`[papers]`), the library holds two kinds of page above the record (method -rule 8). The record itself never names a paper: no card, no title, no So far says "Paper A". +When `lab.toml` names storylines (`[storylines]`), the library holds two kinds of page above the record (method +rule 8). The record itself never names a storyline: no card, no title, no So far says "Storyline A". -- **The overview** (`overview`) keeps the whole trail, whatever paper it serves: the words on one running +- **The overview** (`overview`) keeps the whole trail, whatever storyline it serves: the words on one running example, the workflow, every related-work row, every established finding, every criticism and what answers - it, and what runs now. Nothing is left off it for being off a paper. -- **A paper page** (each of `active`) is that paper's technical argument, in its community's voice, and - never talks about the lab, its method or itself ("this page shows", "the lab's record"). It opens, under its - thesis, with the scope table: target audience and venues, core thesis, experiments included, experiments - excluded or superseded, open experiments. The last three cells carry `data-scope="included"`, - `"excluded"` and `"open"`, and list ids as links (`G1.Q1.4`). Then: its words - on one running example, its pipeline, the published work of its community compared, its established - results citing only included work, the criticisms its reviewers will raise (for each: what is true in - it, what the record shows, what remains to run), and last what remains to run. + it, and what runs now. Nothing is left off it for being off a storyline. +- **A storyline page** (each of `active`) is that storyline's technical argument, in its community's voice: the + page a paper, a talk or a report is later written from. It never talks about the lab, its method or itself + ("this page shows", "the lab's record"). It opens, under its thesis, with the scope table: target audience and + venues, core thesis, experiments included, experiments excluded or superseded, open experiments. The last + three cells carry `data-scope="included"`, `"excluded"` and `"open"`, and list ids as links + (`G1.Q1.4`). Then: its words on one running example, its pipeline, the published work + of its community compared, its established results citing only included work, the criticisms its reviewers + will raise (for each: what is true in it, what the record shows, what remains to run), and last what remains + to run. - **A step or a question has one row on a page.** Where another row needs to mention it (excluded because a newer run superseded it), name it in words, without its link. A decision may be cited anywhere. -When a result lands: bring the overview's findings up to date, then each paper whose argument it touches. +When a result lands: bring the overview's findings up to date, then each storyline whose argument it touches. If it supersedes an included run, move the old one to excluded and cite the new one. If it closes an open row, move it to included, or to excluded if it is void or no longer serves the argument. A result's review that fails makes the experiment void: take it off every included row. `lab check` refuses what a row may -not list, and notes a paper committed before a result about something it lists. +not list, and notes a storyline committed before a result about something it lists. -Adding, splitting, merging or retiring a paper is direction: bring it to the operator (the lab-talk skill), -then change the pages and `[papers]`. A retired paper's page leaves `active` and stays in the library. +Adding, splitting, merging or retiring a storyline is direction: bring it to the operator (the lab-talk skill), +then change the pages and `[storylines]`. A retired storyline's page leaves `active` and stays in the library. ## When to open a decision @@ -143,7 +144,7 @@ parked question, and never take it up because it looks open: it is listed under 1. `lab new decision "" --about `. 2. On its card write **Seen** (what was observed, naming results), **Options** (a list of two or three, each item an option with what it costs and what it changes) and **Recommendation**. When the - lab names its papers, say which paper's open row or criticism each option serves, by the paper's exact + lab names its storylines, say which storyline's open row or criticism each option serves, by the storyline's exact title; an option that serves none says so. Put under `holds:` only the experiments that should not start before it is settled. 3. Keep working on everything it does not hold. The lab-talk skill takes it to the operator and @@ -223,7 +224,7 @@ until that decision is settled; after that it needs no further yes. before a result under it, or one it names. Give each result a label that says what it counts and of how many, in a set of cases the lab names once ("of the 20 checks the solver leaves open"). 10. `lab log result "" ""`. -11. When the lab names its papers, revise them in the same sitting (next section). +11. When the lab names its storylines, revise them in the same sitting (next section). The outcome is worked out from the lines: you never write it. diff --git a/src/lab_kit/__init__.py b/src/lab_kit/__init__.py index 2d5c844..85a9c41 100644 --- a/src/lab_kit/__init__.py +++ b/src/lab_kit/__init__.py @@ -1,2 +1,2 @@ """lab-kit: a research lab's record, its method, and the command that keeps both.""" -__version__ = "1.12.0" +__version__ = "1.13.0" diff --git a/src/lab_kit/checks.py b/src/lab_kit/checks.py index b10d338..b47703d 100644 --- a/src/lab_kit/checks.py +++ b/src/lab_kit/checks.py @@ -3,7 +3,7 @@ import glob, os, re -from . import history, papers, record as R, runs as runs_, write +from . import history, storylines, record as R, runs as runs_, write KEYS = { # what a card's front matter may hold; a state is never among them "goal": {"title", "from", "reached", "dropped", "see"}, @@ -427,8 +427,8 @@ def see(where, page, who=""): for t in sorted({t for t in terms if terms.count(t) > 1}): bad("glossary", "GLOSSARY.md", f"{t!r} is defined twice") - # papers: each active paper's scope lists only what it may - papers.check(lab, bad, notes) + # storylines: each active storyline's scope lists only what it may + storylines.check(lab, bad, notes) # clean: the plans and the store stay out of default searches ignore = R.read(f"{root}/.ignore") if os.path.exists(f"{root}/.ignore") else "" diff --git a/src/lab_kit/papers.py b/src/lab_kit/storylines.py similarity index 66% rename from src/lab_kit/papers.py rename to src/lab_kit/storylines.py index 27cdaee..f33cdba 100644 --- a/src/lab_kit/papers.py +++ b/src/lab_kit/storylines.py @@ -1,10 +1,12 @@ -"""Papers: the library's pages that argue for one target paper each, above a record that names no paper. +"""Storylines: the library's pages that each argue one line of the lab's findings, above a record that names no storyline. -A lab opts in with `[papers]` in `lab.toml`: `overview`, the page that keeps the whole trail, and `active`, the page -of each paper being written. Each paper page opens with a scope table whose cells are marked +A storyline is what a paper, a talk or a report will be written from; it is the argument, not the artifact. + +A lab opts in with `[storylines]` in `lab.toml`: `overview`, the page that keeps the whole trail, and `active`, the page +of each storyline being written. Each storyline page opens with a scope table whose cells are marked `data-scope="included"`, `"excluded"` and `"open"`; the `/lab//` links inside a cell are what it lists. -`lab check` holds what a cell may list, and `lab now` says what each paper still has open and which live steps -serve no paper. +`lab check` holds what a cell may list, and `lab now` says what each storyline still has open and which live steps +serve no storyline. """ from __future__ import annotations @@ -68,33 +70,33 @@ def page_file(lab, path): def config(lab): - """(overview, active pages, problems). (None, [], []) when the lab keeps no papers.""" - p = lab.cfg.get("papers") + """(overview, active pages, problems). (None, [], []) when the lab keeps no storylines.""" + p = lab.cfg.get("storylines") if p is None: return None, [], [] if not isinstance(p, dict): - return None, [], ["`[papers]` is a table that names `overview` and `active`"] - problems = [f"`[papers]` holds `{k}`; it names only `overview` and `active`" for k in sorted(set(p) - {"overview", "active"})] + return None, [], ["`[storylines]` is a table that names `overview` and `active`"] + problems = [f"`[storylines]` holds `{k}`; it names only `overview` and `active`" for k in sorted(set(p) - {"overview", "active"})] overview, active = p.get("overview"), p.get("active", []) if not isinstance(overview, str) or not overview.strip(): - problems.append("`[papers]` names its `overview`: the library page that keeps the whole trail, such as \"entries/where-the-results-stand\"") + problems.append("`[storylines]` names its `overview`: the library page that keeps the whole trail, such as \"entries/where-the-results-stand\"") overview = None if not isinstance(active, list) or not all(isinstance(a, str) and a.strip() for a in active): - problems.append("`[papers]` lists its `active` paper pages as library paths, such as [\"entries/paper-a\"]") + problems.append("`[storylines]` lists its `active` storyline pages as library paths, such as [\"entries/storyline-a\"]") active = [] active = [a.strip("/") for a in active] for path in ([overview] if overview else []) + active: if ".." in path.split("/"): - problems.append(f"`[papers]` names {path}; a page is a path inside the library's content, without `..`") + problems.append(f"`[storylines]` names {path}; a page is a path inside the library's content, without `..`") for a in sorted({a for a in active if active.count(a) > 1}): - problems.append(f"`[papers]` lists {a} more than once") + problems.append(f"`[storylines]` lists {a} more than once") return (overview.strip("/") if overview else None), list(dict.fromkeys(active)), problems def read(lab): - """Each active paper page as read: path, title, its cells' ids, the rows it marks; `missing` when not there.""" - if getattr(lab, "_papers", None) is not None: - return lab._papers + """Each active storyline page as read: path, title, its cells' ids, the rows it marks; `missing` when not there.""" + if getattr(lab, "_storylines", None) is not None: + return lab._storylines _, active, _ = config(lab) out = [] for path in active: @@ -105,7 +107,7 @@ def read(lab): s = _Scope() s.feed(R.read(f)) out.append({"path": path, "title": " ".join(s.title.split()) or path, "cells": s.cells, "marked": s.marked, "unknown": s.unknown, "missing": False}) - lab._papers = out + lab._storylines = out return out @@ -122,7 +124,7 @@ def _covered(lab, ident): def serving(lab): - """The live steps that no active paper lists under included or open, by themselves or by their question or goal.""" + """The live steps that no active storyline lists under included or open, by themselves or by their question or goal.""" named = set() for p in read(lab): for row in ("included", "open"): @@ -136,54 +138,54 @@ def _say(n): def check(lab, bad, notes): - """What `lab check` holds about the papers: the table in `lab.toml`, each page's scope, and what each row lists.""" + """What `lab check` holds about the storylines: the table in `lab.toml`, each page's scope, and what each row lists.""" overview, active, problems = config(lab) for p in problems: - bad("papers", "lab.toml", p) + bad("storylines", "lab.toml", p) if overview is None and not active: return if overview and not os.path.exists(page_file(lab, overview)): - bad("papers", "lab.toml", f"`overview` names {overview}, which is not a page of the library") + bad("storylines", "lab.toml", f"`overview` names {overview}, which is not a page of the library") if overview and overview in active: - bad("papers", "lab.toml", f"{overview} is the overview and an active paper: the overview keeps the whole trail, a paper only what it argues") + 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") for p in read(lab): where = lab.rel(page_file(lab, p["path"])) if p["missing"]: - bad("papers", "lab.toml", f"`active` names {p['path']}, which is not a page of the library") + bad("storylines", "lab.toml", f"`active` names {p['path']}, which is not a page of the library") continue for row in ROWS: if row not in p["marked"]: - bad("papers", where, f"has no scope cell marked data-scope=\"{row}\": a paper page opens with its scope table, and each of included, excluded and open is a marked cell, empty if it lists nothing") + 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") for row in p["unknown"]: - bad("papers", where, f"marks a cell data-scope=\"{row}\"; a scope cell is included, excluded or open") + bad("storylines", where, f"marks a cell data-scope=\"{row}\"; a scope cell is included, excluded or open") rows = {row: [lab.folded.get(i, i) for i in p["cells"][row]] for row in ROWS} for row, ids in rows.items(): for i in ids: n = lab.nodes.get(i) if not n: - bad("papers", where, f"lists {i} under {row}, which is not a goal, a question, a step or a decision of the lab") + bad("storylines", where, f"lists {i} under {row}, which is not a goal, a question, a step or a decision of the lab") continue if row == "included": if n["type"] in R.STEPS and (n["state"] != "done" or n.get("label") == "void"): to = "open" if n["state"] in LIVE else "excluded" - bad("papers", where, f"lists {i} under included, which is {_say(n)}: a paper includes only finished work that is not void, replaced or dropped; list it under {to}") + 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}") elif n["type"] in ("question", "goal") and n["state"] in ("parked", "dropped"): - bad("papers", where, f"lists {i} under included, which is {n['state']}: list it under excluded") + bad("storylines", where, f"lists {i} under included, which is {n['state']}: list it under excluded") elif row == "open": if n["type"] in R.STEPS and n["state"] not in LIVE: to = "included or excluded" if n["state"] == "done" and n.get("label") != "void" else "excluded" - bad("papers", where, f"lists {i} under open, which is {_say(n)}: open holds only work still to do; list it under {to}") + bad("storylines", where, f"lists {i} under open, which is {_say(n)}: open holds only work still to do; list it under {to}") elif n["type"] in ("question", "goal") and n["state"] in ("done", "parked", "dropped"): - bad("papers", where, f"lists {i} under open, which is {n['state']}: open holds only work still to do") + bad("storylines", where, f"lists {i} under open, which is {n['state']}: open holds only work still to do") for a, b in (("included", "excluded"), ("included", "open"), ("open", "excluded")): 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 - bad("papers", 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") + 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") for q, step, at in stale(lab): - notes.append(f"papers: {q} was last committed before the result of {step} ({at}): bring the paper's argument up to date with it") + notes.append(f"storylines: {q} was last committed before the result of {step} ({at}): bring the storyline's argument up to date with it") def stale(lab): - """[(page, step, when)]: an active paper page last committed before the newest `result` line about a step it lists + """[(page, step, when)]: an active storyline page last committed before the newest `result` line about a step it lists under included or open, or under a question or goal it lists there. Nothing where git cannot tell.""" from . import history root, out = lab.root, [] @@ -209,11 +211,11 @@ def stale(lab): def now_lines(lab): - """The lines `lab now` gives the papers: each active paper with what it has open, then the steps no paper serves.""" + """The lines `lab now` gives the storylines: each active storyline with what it has open, then the steps no storyline serves.""" _, active, _ = config(lab) if not active: return [] - out = ["", "Papers (direction comes from their open rows and their criticisms)"] + out = ["", "Storylines (direction comes from their open rows and their criticisms)"] for p in read(lab): if p["missing"]: out.append(f"- {p['path']}: not in the library") @@ -223,6 +225,6 @@ def now_lines(lab): out.append(f"- {p['title']} ({p['path']}): open {todo}") idle = serving(lab) if idle: - out += ["", "Serving no active paper (add to a paper's open row, or bring parking or dropping it to the operator)"] + out += ["", "Serving no active storyline (add to a storyline's open row, or bring parking or dropping it to the operator)"] out += [f"- {x['id']} {x['title']} ({x['state']})" for x in idle] return out diff --git a/src/lab_kit/views.py b/src/lab_kit/views.py index b863ad5..929e46f 100644 --- a/src/lab_kit/views.py +++ b/src/lab_kit/views.py @@ -3,7 +3,7 @@ import os -from . import papers, record as R +from . import storylines, record as R def num(x): @@ -91,7 +91,7 @@ def _now(lab): key = x["label"] if x["state"] == "done" and x.get("label") else x["state"] counts[key] = counts.get(key, 0) + 1 out += [f"- {q['id']} ({state(q)}): {q['title']} [{', '.join(f'{n} {k}' for k, n in counts.items()) or 'nothing under it'}]"] - out += papers.now_lines(lab) + out += storylines.now_lines(lab) aside = lab.set_aside() if any(aside.values()): out += ["", "Set aside"] + [f"- {q['id']} (parked by {lab.parked_by(q['id'])['id']}): {q['title']}" for q in aside["parked"]] diff --git a/tests/test_papers.py b/tests/test_storylines.py similarity index 53% rename from tests/test_papers.py rename to tests/test_storylines.py index 8bee2c3..201b95f 100644 --- a/tests/test_papers.py +++ b/tests/test_storylines.py @@ -1,4 +1,4 @@ -"""Papers drive the work: the record names no paper, and each active paper's page opens with a scope table whose +"""Storylines drive the work: the record names no storyline, and each active storyline's page opens with a scope table whose included, excluded and open cells `lab check` holds, and whose open row `lab now` puts before the agent.""" import os @@ -23,15 +23,15 @@ def links(*ids): return ", ".join(f'{i}' for i in ids) -def page(root, path, title="Paper A: The square-root law", included=(), excluded=(), open_=()): +def page(root, path, title="Storyline A: The square-root law", included=(), excluded=(), open_=()): d = os.path.join(root, "docs", "content", path) os.makedirs(d, exist_ok=True) open(f"{d}/index.html", "w").write(PAGE.format(title=title, included=links(*included), excluded=links(*excluded), open=links(*open_))) -def papers(root, overview="entries/where-the-results-stand", active=("entries/paper-a",)): - text = open(f"{root}/lab.toml").read().split("[papers]")[0] - open(f"{root}/lab.toml", "w").write(text + f'[papers]\noverview = "{overview}"\nactive = [{", ".join(chr(34) + a + chr(34) for a in active)}]\n') +def storylines(root, overview="entries/where-the-results-stand", active=("entries/storyline-a",)): + text = open(f"{root}/lab.toml").read().split("[storylines]")[0] + open(f"{root}/lab.toml", "w").write(text + f'[storylines]\noverview = "{overview}"\nactive = [{", ".join(chr(34) + a + chr(34) for a in active)}]\n') def two_experiments(root): @@ -51,104 +51,104 @@ def two_experiments(root): return first, void, later -def test_a_lab_without_papers_is_unchanged(tmp_path): +def test_a_lab_without_storylines_is_unchanged(tmp_path): root = str(tmp_path) two_experiments(root) - assert "Papers" not in lab(root, "now") - assert "papers:" not in lab(root, "check", "--no-rederive") + assert "Storylines" not in lab(root, "now") + assert "storylines:" not in lab(root, "check", "--no-rederive") -def test_a_paper_includes_only_finished_work_and_lists_each_id_once(tmp_path): +def test_a_storyline_includes_only_finished_work_and_lists_each_id_once(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) - page(root, "entries/paper-a", included=(first, void, later), excluded=(first,), open_=("G1.Q9.1",)) + storylines(root) + page(root, "entries/storyline-a", included=(first, void, later), excluded=(first,), open_=("G1.Q9.1",)) out = lab(root, "check", "--no-rederive", ok=False) assert f"lists {void} under included, which is void" in out and "list it under excluded" in out assert f"lists {later} under included, which is open" in out and "list it under open" in out assert f"lists {first} under both included and excluded" in out assert "lists G1.Q9.1 under open, which is not a goal, a question, a step or a decision of the lab" in out - page(root, "entries/paper-a", included=(first,), excluded=(void,), open_=(first,)) + page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(first,)) assert f"lists {first} under open, which is done" in lab(root, "check", "--no-rederive", ok=False) - page(root, "entries/paper-a", included=(first, "D1"), excluded=(void,), open_=(later,)) + page(root, "entries/storyline-a", included=(first, "D1"), excluded=(void,), open_=(later,)) assert "the record is sound" in lab(root, "check", "--no-rederive") -def test_the_papers_table_names_pages_that_are_there_each_with_its_scope(tmp_path): +def test_the_storylines_table_names_pages_that_are_there_each_with_its_scope(tmp_path): root = str(tmp_path) two_experiments(root) - papers(root, active=("entries/paper-a", "entries/paper-b", "entries/where-the-results-stand")) - os.makedirs(f"{root}/docs/content/entries/paper-a", exist_ok=True) - open(f"{root}/docs/content/entries/paper-a/index.html", "w").write("") + storylines(root, active=("entries/storyline-a", "entries/storyline-b", "entries/where-the-results-stand")) + os.makedirs(f"{root}/docs/content/entries/storyline-a", exist_ok=True) + open(f"{root}/docs/content/entries/storyline-a/index.html", "w").write("") out = lab(root, "check", "--no-rederive", ok=False) - assert "`active` names entries/paper-b, which is not a page of the library" in out - assert "is the overview and an active paper" in out + assert "`active` names entries/storyline-b, which is not a page of the library" in out + assert "is the overview and an active storyline" in out assert 'has no scope cell marked data-scope="included"' in out and 'marks a cell data-scope="kept"' in out - papers(root, overview="entries/nowhere") + storylines(root, overview="entries/nowhere") assert "`overview` names entries/nowhere, which is not a page of the library" in lab(root, "check", "--no-rederive", ok=False) -def test_a_card_never_names_a_paper(tmp_path): +def test_a_card_never_names_a_storyline(tmp_path): root = str(tmp_path) first, _, _ = two_experiments(root) from test_flow import folder, front - front(f"{folder(root, first)}/experiment.md", paper="paper-a") - assert "`paper:` is not something a experiment card holds" in lab(root, "check", "--no-rederive", ok=False) + front(f"{folder(root, first)}/experiment.md", storyline="storyline-a") + assert "`storyline:` is not something a experiment card holds" in lab(root, "check", "--no-rederive", ok=False) -def test_now_puts_each_papers_open_row_first_and_names_what_serves_no_paper(tmp_path): +def test_now_puts_each_storylines_open_row_first_and_names_what_serves_no_storyline(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) - page(root, "entries/paper-a", included=(first,), excluded=(void,)) + storylines(root) + page(root, "entries/storyline-a", included=(first,), excluded=(void,)) now = lab(root, "now") - assert "Paper A: The square-root law (entries/paper-a): open nothing" in now - assert "Serving no active paper" in now and f"- {later} Error at 400 and at 1600 flips (open)" in now - page(root, "entries/paper-a", included=(first,), excluded=(void,), open_=(later,)) + assert "Storyline A: The square-root law (entries/storyline-a): open nothing" in now + assert "Serving no active storyline" in now and f"- {later} Error at 400 and at 1600 flips (open)" in now + page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(later,)) now = lab(root, "now") - assert f"open {later} Error at 400 and at 1600 flips (open)" in now and "Serving no active paper" not in now - page(root, "entries/paper-a", included=(first,), excluded=(void,), open_=("G1.Q1",)) # a question stands for every step under it - assert "Serving no active paper" not in lab(root, "now") + assert f"open {later} Error at 400 and at 1600 flips (open)" in now and "Serving no active storyline" not in now + page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=("G1.Q1",)) # a question stands for every step under it + assert "Serving no active storyline" not in lab(root, "now") -def test_a_paper_older_than_a_result_it_lists_is_noted(tmp_path): +def test_a_storyline_older_than_a_result_it_lists_is_noted(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) - page(root, "entries/paper-a", included=(first,), excluded=(void,), open_=(later,)) + storylines(root) + page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=(later,)) git_env(root, "init", "-q") git_env(root, "add", "-A") - git_env(root, "commit", "-qm", "the paper", GIT_AUTHOR_DATE=PAST, GIT_COMMITTER_DATE=PAST) + git_env(root, "commit", "-qm", "the storyline", GIT_AUTHOR_DATE=PAST, GIT_COMMITTER_DATE=PAST) lab(root, "log", first, "result", "The error halves.", "It converges as the theory says.") commit(root, "the result") out = lab(root, "check", "--no-rederive", ok=False) # the question's So far is stale too, which is a problem - assert f"note: papers: entries/paper-a was last committed before the result of {first}" in out - assert "papers:" not in out.split("note: papers:")[1].split("\n", 1)[1] # a note, never a problem + assert f"note: storylines: entries/storyline-a was last committed before the result of {first}" in out + assert "storylines:" not in out.split("note: storylines:")[1].split("\n", 1)[1] # a note, never a problem def test_every_rule_on_a_row_and_on_the_table_has_a_refusal(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) + storylines(root) from test_flow import folder, front front(f"{folder(root, later)}/experiment.md", dropped="the first comparison answers the question") lab(root, "answer", "G1.Q1", "yes", "It halves at 400 flips.") - page(root, "entries/paper-a", included=(first,), excluded=(void,), open_=("G1.Q1",)) + page(root, "entries/storyline-a", included=(first,), excluded=(void,), open_=("G1.Q1",)) assert "lists G1.Q1 under open, which is done" in lab(root, "check", "--no-rederive", ok=False) - page(root, "entries/paper-a", included=("G1", first), excluded=(void,), open_=("G1",)) + page(root, "entries/storyline-a", included=("G1", first), excluded=(void,), open_=("G1",)) assert "lists G1 under both included and open" in lab(root, "check", "--no-rederive", ok=False) # a question written in one row and a step under it in another is allowed - page(root, "entries/paper-a", included=("G1.Q1",), excluded=(void, later), open_=()) - assert "papers:" not in lab(root, "check", "--no-rederive") - page(root, "entries/paper-a", included=(first,), excluded=("G1.Q1", void), open_=()) - assert "papers:" not in lab(root, "check", "--no-rederive") - for table, said in (('papers = "entries/paper-a"', "`[papers]` is a table"), - ('[papers]\noverview = "entries/where-the-results-stand"\nkept = 1', "`[papers]` holds `kept`"), - ('[papers]\noverview = 3', "`[papers]` names its `overview`"), - ('[papers]\noverview = "entries/where-the-results-stand"\nactive = "entries/paper-a"', "lists its `active` paper pages"), - ('[papers]\noverview = "entries/where-the-results-stand"\nactive = ["entries/paper-a", "entries/paper-a/"]', "lists entries/paper-a more than once"), - ('[papers]\noverview = "../outside"', "without `..`")): - text = open(f"{root}/lab.toml").read().split("[papers]")[0].split("papers =")[0] + page(root, "entries/storyline-a", included=("G1.Q1",), excluded=(void, later), open_=()) + assert "storylines:" not in lab(root, "check", "--no-rederive") + page(root, "entries/storyline-a", included=(first,), excluded=("G1.Q1", void), open_=()) + assert "storylines:" not in lab(root, "check", "--no-rederive") + for table, said in (('storylines = "entries/storyline-a"', "`[storylines]` is a table"), + ('[storylines]\noverview = "entries/where-the-results-stand"\nkept = 1', "`[storylines]` holds `kept`"), + ('[storylines]\noverview = 3', "`[storylines]` names its `overview`"), + ('[storylines]\noverview = "entries/where-the-results-stand"\nactive = "entries/storyline-a"', "lists its `active` storyline pages"), + ('[storylines]\noverview = "entries/where-the-results-stand"\nactive = ["entries/storyline-a", "entries/storyline-a/"]', "lists entries/storyline-a more than once"), + ('[storylines]\noverview = "../outside"', "without `..`")): + text = open(f"{root}/lab.toml").read().split("[storylines]")[0].split("storylines =")[0] open(f"{root}/lab.toml", "w").write(text + table + "\n") assert said in lab(root, "check", "--no-rederive", ok=False), table @@ -159,30 +159,30 @@ def test_a_parked_or_dropped_question_is_in_neither_included_nor_open(tmp_path): from test_parked import park card, d = park(root, "G1.Q1", "Set the first sizes aside", "") lab(root, "decide", d, "--with", "Ada", "Set the first sizes aside until the sampler is fixed.") - papers(root) - page(root, "entries/paper-a", included=("G1.Q1",), excluded=(void,)) + storylines(root) + page(root, "entries/storyline-a", included=("G1.Q1",), excluded=(void,)) assert "lists G1.Q1 under included, which is parked" in lab(root, "check", "--no-rederive", ok=False) - page(root, "entries/paper-a", excluded=(void,), open_=("G1.Q1",)) + page(root, "entries/storyline-a", excluded=(void,), open_=("G1.Q1",)) assert "lists G1.Q1 under open, which is parked" in lab(root, "check", "--no-rederive", ok=False) def test_a_cell_left_open_ends_where_the_next_cell_begins(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) - d = f"{root}/docs/content/entries/paper-a" + storylines(root) + d = f"{root}/docs/content/entries/storyline-a" os.makedirs(d, exist_ok=True) - open(f"{d}/index.html", "w").write(f'Paper A
{links(first)}' + open(f"{d}/index.html", "w").write(f'Storyline A
{links(first)}' f'
{links(void)}
{links(later)}
') - assert "papers:" not in lab(root, "check", "--no-rederive") + assert "storylines:" not in lab(root, "check", "--no-rederive") assert f"open {later} Error at 400 and at 1600 flips (open)" in lab(root, "now") def test_a_table_inside_a_scope_cell_is_read_as_part_of_it(tmp_path): root = str(tmp_path) first, void, later = two_experiments(root) - papers(root) - d = f"{root}/docs/content/entries/paper-a" + storylines(root) + d = f"{root}/docs/content/entries/storyline-a" os.makedirs(d, exist_ok=True) open(f"{d}/index.html", "w").write(f'' f'
{links(first, void)}
{links(later)}
')