diff --git a/planning/workflow/templates/design.md b/planning/workflow/templates/design.md index 758e0de7eb..fbd9091163 100644 --- a/planning/workflow/templates/design.md +++ b/planning/workflow/templates/design.md @@ -1,6 +1,6 @@ # Meta design template -Use at S0 (`request-intake`): `init` writes a package's first `design.md` in this shape, the intake agent writes the first-pass review order, and S5 (`issue-handoff` fanout) fills "Initial research stages". After intake it changes only through PRs. Waves and the run table are generated views (`ready`, `render`, `status --live`); never type a run status by hand. +Use at S0 (`request-intake`): `init` writes a package's first `design.md` in this shape, the intake agent writes the first-pass review order, and S5 (`issue-handoff` fanout) fills "Initial research stages". After intake it changes only through PRs. Waves and run status are generated views (`ready`, `render`, `status --live`); never type a run status by hand. ```markdown # Meta design: @@ -11,7 +11,7 @@ Use at S0 (`request-intake`): `init` writes a package's first `design.md` in thi ## Review order -First pass at the order in which to prepare, research and design the concepts. Default, when nothing blocks anything and nothing stands out: run one agent per concept, all at once, and track each in the run table. +First pass at the order in which to prepare, research and design the concepts. Default, when nothing blocks anything and nothing stands out: run one agent per concept, all at once, and track each in run status. 1. **C001** — <why here: crucial, horizon now, required by C002>. 2. **C002** <title> — requires C001: <reason>. @@ -21,19 +21,24 @@ First pass at the order in which to prepare, research and design the concepts. D <!-- workflow:view waves --> -- **Wave 1**: C001, C003 -- **Wave 2**: C002 (requires C001) +- Wave 1 can start now: everything it requires is done. Later waves assume the earlier ones finish. Concepts that share files never share a wave. Leases and open branches are live data, so run `ready` before dispatching. +- **Done:** none +- **Running:** none +- **Wave 1:** [C001](main.md#c001), [C003](main.md#c003) +- **Wave 2:** [C002](main.md#c002) + - [C002](main.md#c002) is better after [C001](main.md#c001): <rework if C002 starts early> <!-- /workflow:view waves --> -## Run table +## Review status -<!-- workflow:view run-table --> +<!-- workflow:view run-status --> -- **C001** <title> — S1 `not-started` · branch none · PR none · updated <UTC> -- **C002** <title> — S1 `not-started` · branch none · PR none · updated <UTC> +- S0 is `validated` when `render` runs, because render only runs on a package that passes `check`. Other stages show the `tasks` entries that record `concept`, `stage` and `status`. `pushed`, `pr-open` and `merged` come from git and GitHub through `status --live`, so they never appear here. +- **C001** [<title>](main.md#c001): S0 `validated` · S1–S8 `not-started` +- **C002** [<title>](main.md#c002): S0 `validated` · S1 `blocked` (requires C001) · S2–S8 `not-started` -<!-- /workflow:view run-table --> +<!-- /workflow:view run-status --> ## Initial research stages diff --git a/planning/workflow/templates/main.md b/planning/workflow/templates/main.md index 5fabc45e39..0528c2c04e 100644 --- a/planning/workflow/templates/main.md +++ b/planning/workflow/templates/main.md @@ -8,7 +8,7 @@ Use at S0 (`request-intake`): `init` writes a package's first `main.md` in this <Introduction: one paragraph restating what was asked and why, in plain words. The exact words are in the transcript; anything that interprets them starts with "Inference:".> - Transcript: [transcript.txt](transcript.txt) (sha256 `<sha256>`, <bytes> bytes, <visibility>; source: <source>) -- Meta design: [design.md](design.md) (review order, waves, run table, research stages) +- Meta design: [design.md](design.md) (review order, waves, run status, research stages) - Change log: [changes.md](changes.md) - Human review: [human-review.md](human-review.md) (from S6) - Workflow: [stages](/planning/workflow/stages.md), [records](/planning/workflow/records.md), [collaboration](/planning/workflow/collaboration.md) @@ -26,14 +26,15 @@ Tokens in the transcript that look mistyped or mistranscribed, and the reading a - `<token>` (`T014`) — Inference: read as "<reading>" because <reason>. Confidence: <high, medium or low>. -## C001 <title> +## C001: <title> <!-- workflow:view concept-C001 --> -- **State**: S0 `created` · `proposed` · priority `<priority>` · horizon `<horizon>` -- **Goal**: <end goal this concept serves> -- **Relations**: none -- **Issues and PRs**: none yet +- **State:** `proposed` · stage S0 · priority `<priority>` · horizon `<horizon>` +- **Goal:** <end goal this concept serves> +- **Items:** none yet +- **Relations:** none +- **Issues and PRs:** none yet <!-- /workflow:view concept-C001 --> @@ -41,8 +42,8 @@ Tokens in the transcript that look mistyped or mistranscribed, and the reading a - **C001.1** `created` · S0 · <UTC> — <a statement from the transcript, restated>. - **C001.1.1** `created` · S0 · <UTC> — <a detail of C001.1, directly below it>. -- **C001.2** `clarified` · S2 · <UTC> — The situation is more nuanced than first read; see C001.2.1. ← `created` · S0 · <UTC> - - **C001.2.1** `created` · S2 · <UTC> — <the nuance, directly below the item it refines>. +- **C001.2** `clarified` · S2 · <UTC> — The situation is more nuanced than first read; see C001.2.1. ← `created` · S0 · <UTC> — <original statement> + - **C001.2.1** `created` · S2 · <UTC> — <the nuance, directly below the item it refines> ## G: process directives @@ -54,17 +55,14 @@ Segments in the global bucket `G`: instructions about how to work, not what to b <!-- workflow:view issues-and-prs --> -### C001 <title> - -- None yet. - -### C002 <title> - -- None yet. +- [C001](#c001) <title> + - Issue [#<n>](https://github.com/<issue_repository>/issues/<n>) · S1 · `open` — <title> (for C001.2); <reason> +- [C002](#c002) <title> + - PR [#<n>](https://github.com/<issue_repository>/pull/<n>) · S5 · `merged` — <title>; <reason> <!-- /workflow:view issues-and-prs --> ``` - Concept sections follow the order in `design.md`. Write prose above the item list; never inside a view. - Items: new status in front, the earlier trail after `←`, nothing deleted. A refinement goes directly below the item it refines, with the next child ID. Statuses: `created`, `clarified`, `confirmed`, `superseded`, `retracted` ([records](../records.md)). -- `render` lists each issue or PR once in its concept's view and again under "Issues and PRs", in the form `- [#<n>](https://github.com/<issue_repository>/issues/<n>) <title> — `<state>` · S<n> · covers C001.2 — <why it was implemented, declined or changed>`. +- `render` lists each issue or PR once in its concept's view and again under "Issues and PRs". The grouped view is flat and concept-linked. An issue reference has this shape: Issue [#<n>](https://github.com/<issue_repository>/issues/<n>) · S<n> · `state` — title (for C001.2); reason. A PR uses the same shape with `PR` and a pull URL. With no references, the generated line is `No issues or PRs are recorded yet. Each one will be listed here under its concept.` diff --git a/scripts/tests/test_research_workflow_items.py b/scripts/tests/test_research_workflow_items.py index 68016e7b32..3ef632e571 100644 --- a/scripts/tests/test_research_workflow_items.py +++ b/scripts/tests/test_research_workflow_items.py @@ -402,6 +402,58 @@ def test_render_is_idempotent_and_replaces_init_placeholders(self): ) self.check() + def test_template_generated_views_render_and_check(self): + repo = Path(__file__).resolve().parents[2] + main_template = (repo / "planning/workflow/templates/main.md").read_text( + encoding="utf-8" + ) + design_template = (repo / "planning/workflow/templates/design.md").read_text( + encoding="utf-8" + ) + + def template_views(text): + pattern = re.compile( + r"<!-- workflow:view (?P<name>[A-Za-z0-9._-]+) -->.*?" + r"<!-- /workflow:view (?P=name) -->", + re.DOTALL, + ) + return {match["name"]: match[0] for match in pattern.finditer(text)} + + main_views = template_views(main_template) + design_views = template_views(design_template) + self.assertEqual(set(main_views), {"concept-C001", "issues-and-prs"}) + self.assertEqual(set(design_views), {"waves", "run-status"}) + self.assertIn("## C001: <title>", main_template) + self.assertIn("- **State:**", main_template) + self.assertIn("Issue [#<n>]", main_template) + self.assertIn("PR [#<n>]", main_template) + self.assertNotIn("- None yet.", main_template) + self.assertIn( + "## Review status\n\n<!-- workflow:view run-status -->", design_template + ) + self.assertNotIn("run-table", design_template) + + package = self.rendered() + + def install_template_views(path, replacements): + text = path.read_text(encoding="utf-8") + for name, block in replacements.items(): + pattern = re.compile( + rf"<!-- workflow:view {re.escape(name)} -->.*?" + rf"<!-- /workflow:view {re.escape(name)} -->", + re.DOTALL, + ) + text, count = pattern.subn( + lambda _, replacement=block: replacement, text, count=1 + ) + self.assertEqual(count, 1, name) + path.write_text(text, encoding="utf-8") + + install_template_views(package / "main.md", main_views) + install_template_views(package / "design.md", design_views) + self.cli("render", "--package", package) + self.check() + def test_check_fails_when_a_view_is_stale_missing_or_unknown(self): package = self.rendered() self.check()