From 4985e6a2a9984f50c147c80842c86d31e8164ec1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:07:30 +0100 Subject: [PATCH 1/6] Convert ADF to markdown and back through adf-codec's lossless pair --- CHANGELOG.md | 1 + bin/adf_codec/convert.py | 52 ++++++++++++++++++++++++------ bin/adf_codec/node_shim/shim.mjs | 22 +++++++------ bin/adf_codec/test_adf_codec.py | 55 ++++++++++++++++++++++++++++++++ todo.md | 9 +++++- 5 files changed, 119 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4741c3..5b2ba7c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- A tool can now convert ADF to markdown and back without losing anything Jira stores. `adf_codec.convert` has `markdown_to_adf_lossless`, `adf_to_markdown_lossless` and `adfs_to_markdown_lossless`, which keep every block's `localId` and the empty paragraphs Jira uses for spacing, so a Jira or Confluence document read and saved back unedited comes back identical. The portable functions stay for new text and for markdown shown to a person. No tool uses the lossless functions yet. - A config whose `plan` names a Jira epic must now set `jira-score-formula` and `jira-score-bar`, and fails to load without them. `todo-item add` scores the item by them, refuses one under the bar unless it is exempt, and ranks the new issue among the issues the loop filed: questions first, then security findings, then by score. A person's issues keep their rank. - `todo-item edit` and `move` work on a plan kept in a Jira epic. They change only an issue the loop filed, and never a link. Of an issue a person filed, `edit` sets only the scores, and posts the new `--comment` on the issue to tell the team why; a plan in a file takes the flag and keeps no comment. - A release someone else cut while it still held plan items no longer stops the loop: those items count as the next release's, `chunk-preflight` tells the worker to move them there, and `loop-claude` routes on them. Where the plan names no later release and `todo.md` named none since the cut, the loop still asks which release they belong to. diff --git a/bin/adf_codec/convert.py b/bin/adf_codec/convert.py index 02fb5afd..7f2d8a0b 100644 --- a/bin/adf_codec/convert.py +++ b/bin/adf_codec/convert.py @@ -1,6 +1,10 @@ """Converts markdown to ADF (Atlassian Document Format, the rich text of Jira Cloud and Confluence) and back. It runs @larvit/adf-codec, a Node package, in a throwaway container that holds node_shim/shim.mjs; the shim's header says what its exit status means. + +adf-codec has two pairs of calls, and each function here names the one it runs: +- The lossless pair, `*_lossless`, for a document that already exists in Jira or Confluence and is edited and saved back. It keeps each block's localId and the empty paragraphs Jira uses for spacing, so a document read and saved unedited comes back identical. +- The portable pair, with no suffix, for new text written from scratch, and for markdown shown to a person. It drops both, so saving a document that exists changes it. """ import contextlib import dataclasses @@ -31,7 +35,7 @@ class Ran: err: str -# Runs the shim in the given mode (`to-adf` or `to-markdown`) on a text, or fails to run it. +# Runs the shim in the given mode (`to-adf`, `to-markdown` or either with `-lossless` after it) on a text, or fails to run it. Run = typing.Callable[[str, str], Ran | Failure] # Runs a docker command line on a text, in at most the given seconds, or fails to run it. Docker = typing.Callable[[list[str], str, int], Ran | Failure] @@ -149,9 +153,8 @@ def refusal(out: str) -> Refused | Failure: return Failure(f"the adf-codec shim refused with output that is not an error: {out.strip()}") -def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure: - """The ADF document for the markdown.""" - out = answer("to-adf", markdown, run) +def to_adf(mode: str, markdown: str, run: Run) -> dict[str, typing.Any] | Failure: + out = answer(mode, markdown, run) if isinstance(out, Refused): return out.failure if isinstance(out, Failure): @@ -163,11 +166,10 @@ def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing return document -def adfs_to_markdown(documents: list[dict[str, typing.Any]], run: Run = container_run) -> list[str] | Refused | Failure: - """The markdown for each ADF document, in their order, from one container run, so a caller with many documents pays one container start.""" +def to_markdowns(mode: str, documents: list[dict[str, typing.Any]], run: Run) -> list[str] | Refused | Failure: if not documents: return [] - out = answer("to-markdown", json.dumps(documents), run) + out = answer(mode, json.dumps(documents), run) if isinstance(out, Refused) and not 0 <= out.index < len(documents): return Failure(f"the adf-codec shim refused a document at index {out.index}, past the {len(documents)} it was handed") if isinstance(out, Refused | Failure): @@ -181,9 +183,39 @@ def adfs_to_markdown(documents: list[dict[str, typing.Any]], run: Run = containe return texts -def adf_to_markdown(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure: - """The markdown for the ADF document.""" - texts = adfs_to_markdown([document], run) +def one_markdown(texts: list[str] | Refused | Failure) -> str | Failure: if isinstance(texts, Refused): return texts.failure return texts if isinstance(texts, Failure) else texts[0] + + +def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure: + """The ADF document for new markdown, by the portable pair: for text written from scratch. It can't carry a document that exists back unchanged; use markdown_to_adf_lossless.""" + return to_adf("to-adf", markdown, run) + + +def markdown_to_adf_lossless(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure: + """The ADF document for markdown that adf_to_markdown_lossless or adfs_to_markdown_lossless wrote, by the lossless pair: for saving an existing Jira or Confluence document back. Unedited, it gives back the document that was read.""" + return to_adf("to-adf-lossless", markdown, run) + + +def adfs_to_markdown(documents: list[dict[str, typing.Any]], run: Run = container_run) -> list[str] | Refused | Failure: + """The markdown for each ADF document, in their order, by the portable pair, from one container run, so a caller with many documents pays one container start. + + For markdown shown to a person; the text can't be saved back without changing the document, so use adfs_to_markdown_lossless to edit one.""" + return to_markdowns("to-markdown", documents, run) + + +def adfs_to_markdown_lossless(documents: list[dict[str, typing.Any]], run: Run = container_run) -> list[str] | Refused | Failure: + """The markdown for each ADF document, in their order, by the lossless pair, from one container run: for documents that exist in Jira or Confluence and are edited and saved back with markdown_to_adf_lossless.""" + return to_markdowns("to-markdown-lossless", documents, run) + + +def adf_to_markdown(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure: + """The markdown for the ADF document, by the portable pair: for showing it to a person, not for saving it back.""" + return one_markdown(adfs_to_markdown([document], run)) + + +def adf_to_markdown_lossless(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure: + """The markdown for the ADF document, by the lossless pair: for editing it and saving it back with markdown_to_adf_lossless.""" + return one_markdown(adfs_to_markdown_lossless([document], run)) diff --git a/bin/adf_codec/node_shim/shim.mjs b/bin/adf_codec/node_shim/shim.mjs index eeb0b601..52a546a9 100644 --- a/bin/adf_codec/node_shim/shim.mjs +++ b/bin/adf_codec/node_shim/shim.mjs @@ -1,10 +1,12 @@ -// Converts between markdown and ADF with @larvit/adf-codec's portable calls. The mode is the one argument: +// Converts between markdown and ADF with @larvit/adf-codec. The mode is the one argument: // to-adf stdin is markdown, stdout is the ADF document as JSON // to-markdown stdin is a JSON array of ADF documents, stdout a JSON array of their markdown texts, in their order +// The portable calls behind those two drop each block's localId and empty paragraphs. The same two modes with the suffix +// -lossless, to-adf-lossless and to-markdown-lossless, call adf-codec's lossless pair, which keeps both. // Exit 0: stdout holds the answer. Exit 2: adf-codec refused the input, and stdout holds {"error": {code, message, path, position?}}, // with "index", the refused document's place in the array, beside "error" in to-markdown. // Exit 1: the shim could not run, and stderr says why. -import { adfToPortableMarkdown, portableMarkdownToAdf } from '@larvit/adf-codec' +import { adfToLosslessMarkdown, adfToPortableMarkdown, losslessMarkdownToAdf, portableMarkdownToAdf } from '@larvit/adf-codec' const REFUSED = 2 @@ -19,17 +21,17 @@ function refuse(refusal) { return REFUSED } -function toAdf(markdown) { - const result = portableMarkdownToAdf(markdown) +function toAdf(convert, markdown) { + const result = convert(markdown) if (!result.ok) return refuse({ error: result.error }) process.stdout.write(JSON.stringify(result.value)) return 0 } -function toMarkdown(documents) { +function toMarkdown(convert, documents) { const texts = [] for (const [index, document] of documents.entries()) { - const result = adfToPortableMarkdown(document) + const result = convert(document) if (!result.ok) return refuse({ index, error: result.error }) texts.push(result.value) } @@ -39,9 +41,11 @@ function toMarkdown(documents) { async function main(mode) { const input = await readStdin() - if (mode === 'to-adf') return toAdf(input) - if (mode === 'to-markdown') return toMarkdown(JSON.parse(input)) - throw new Error(`mode must be to-adf or to-markdown, not ${mode}`) + if (mode === 'to-adf') return toAdf(portableMarkdownToAdf, input) + if (mode === 'to-adf-lossless') return toAdf(losslessMarkdownToAdf, input) + if (mode === 'to-markdown') return toMarkdown(adfToPortableMarkdown, JSON.parse(input)) + if (mode === 'to-markdown-lossless') return toMarkdown(adfToLosslessMarkdown, JSON.parse(input)) + throw new Error(`mode must be to-adf, to-adf-lossless, to-markdown or to-markdown-lossless, not ${mode}`) } main(process.argv[2]).then( diff --git a/bin/adf_codec/test_adf_codec.py b/bin/adf_codec/test_adf_codec.py index 6029f0ff..b264cc24 100644 --- a/bin/adf_codec/test_adf_codec.py +++ b/bin/adf_codec/test_adf_codec.py @@ -66,6 +66,36 @@ def test_adf_to_markdown_returns_the_text_of_its_one_document(): assert run.calls == [("to-markdown", json.dumps([DOC]))] +def test_markdown_to_adf_lossless_runs_the_lossless_mode(): + run = fake(0, json.dumps(DOC)) + assert convert.markdown_to_adf_lossless("Hi\n", run) == DOC + assert run.calls == [("to-adf-lossless", "Hi\n")] + + +def test_adfs_to_markdown_lossless_sends_every_document_in_one_lossless_run(): + run = fake(0, json.dumps(["a\n", "b\n"])) + assert convert.adfs_to_markdown_lossless([DOC, DOC], run) == ["a\n", "b\n"] + assert run.calls == [("to-markdown-lossless", json.dumps([DOC, DOC]))] + + +def test_adf_to_markdown_lossless_returns_the_text_of_its_one_document(): + run = fake(0, json.dumps(["a\n"])) + assert convert.adf_to_markdown_lossless(DOC, run) == "a\n" + assert run.calls == [("to-markdown-lossless", json.dumps([DOC]))] + + +def test_adfs_to_markdown_lossless_names_a_refused_documents_index(): + refusal = {"index": 1, "error": {"code": "not-an-adf-document", "message": "no type", "path": []}} + refused = convert.adfs_to_markdown_lossless([DOC, DOC], fake(2, json.dumps(refusal))) + assert refused == convert.Refused(1, Failure("adf-codec refused the input with not-an-adf-document: no type (at the document)")) + + +def test_adfs_to_markdown_lossless_of_no_documents_runs_no_container(): + run = fake(1) + assert convert.adfs_to_markdown_lossless([], run) == [] + assert run.calls == [] + + def test_a_refusal_becomes_a_failure_with_adf_codecs_code_and_message(): refusal = {"error": {"code": "malformed-pipe-table", "message": "row has too many cells", "path": [], "position": {"line": 3, "offset": 9}}} failure = convert.markdown_to_adf("| a |\n", fake(2, json.dumps(refusal))) @@ -279,3 +309,28 @@ def test_round_trip_through_the_real_container(): assert isinstance(second, convert.Refused) and second.index == 1 and "not-an-adf-document" in second.failure.reason crashed = convert.answer("to-markdown", "not json", convert.container_run) assert isinstance(crashed, Failure) and crashed.reason.startswith("the adf-codec shim failed with exit 1: ") + + +# A Jira description as Jira stores it: every block carries a localId, and an empty paragraph spaces two blocks. +JIRA_DESCRIPTION = { + "type": "doc", "version": 1, "content": [ + {"type": "heading", "attrs": {"level": 2, "localId": "h-1"}, "content": [{"type": "text", "text": "Goal"}]}, + {"type": "paragraph", "attrs": {"localId": "p-1"}, "content": [{"type": "text", "text": "Keep "}, {"type": "text", "text": "this", "marks": [{"type": "strong"}]}]}, + {"type": "paragraph", "attrs": {"localId": "p-2"}}, + {"type": "bulletList", "attrs": {"localId": "l-1"}, "content": [ + {"type": "listItem", "attrs": {"localId": "i-1"}, "content": [{"type": "paragraph", "attrs": {"localId": "p-3"}, "content": [{"type": "text", "text": "one"}]}]}, + ]}, + ], +} + + +@pytest.mark.skipif(shutil.which("docker") is None or subprocess.run(["docker", "info"], capture_output=True, timeout=20).returncode != 0, reason="needs a docker daemon") +def test_the_lossless_pair_gives_back_a_jira_description_identical_and_the_portable_pair_does_not(): + markdown = convert.adf_to_markdown_lossless(JIRA_DESCRIPTION) + assert isinstance(markdown, str) + assert convert.markdown_to_adf_lossless(markdown) == JIRA_DESCRIPTION + assert convert.adfs_to_markdown_lossless([JIRA_DESCRIPTION, JIRA_DESCRIPTION]) == [markdown, markdown] + portable = convert.markdown_to_adf(convert.adf_to_markdown(JIRA_DESCRIPTION)) + assert portable != JIRA_DESCRIPTION + second = convert.adfs_to_markdown_lossless([JIRA_DESCRIPTION, {"type": "nope"}]) + assert isinstance(second, convert.Refused) and second.index == 1 diff --git a/todo.md b/todo.md index 64a7a0c7..6e226cb6 100644 --- a/todo.md +++ b/todo.md @@ -6,13 +6,14 @@ `Bar = 0.1` -`Next ID = 390` +`Next ID = 392` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| | 375 | 0.11.0 | | decision | **Run up to the project's configured number of chunks at once, each in its own window of one tmux session named for the project, mark a window whose chunk waits for the human, and refuse to start without tmux at the needed version.** | 4 | 2 | 3 | 7 | 7 | 1.5 by 7 | 0.6 | +| 391 | 0.12.0 | | | **Read and write a Jira epic issue's description and a Confluence record page through the lossless pair, so saving an unedited document leaves it unchanged.** | 3 | 2 | 3 | 6 | 5 | 1.6 by 6, 1.1 by 3 | 1.9 | | 319 | 0.12.0 | | | **Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 2, 1.4 by 2 | 1.2 | | 309 | 0.12.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.2 | | 299 | 0.12.0 | | | **Replay the archived judge verdicts through code rules and a classifier trained locally on the archive, and file an item for each verdict kind one of them decides with no missed interrupt.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 1.0 | @@ -83,6 +84,12 @@ Before starting anything — a worktree, a session, a window — loop-claude che The config key for the parallel limit is a syntax users write, so a panel seated from the README's audience picks its spelling (`CLAUDE.md` → "Working loop" → "Bench a syntax"). run-heavy already sizes its slots from the machine, at one per 4 CPUs and with memory from `MemTotal`, so a larger VM runs more heavy commands at once without a change here. +### 391. Read and write a Jira epic issue's description and a Confluence record page through the lossless pair, so saving an unedited document leaves it unchanged. + +Follows item 390. `plan_store/jira_epic.py` reads an issue's description and writes it back on an edit, and `record_store/confluence_page.py` reads a page and saves it back; both use the portable pair, which drops each block's `localId` and the empty paragraphs Jira uses for spacing. Use `adfs_to_markdown_lossless` and `markdown_to_adf_lossless` where a tool reads a document and writes it back. `record_store/jira_description.py` only reads, to show a person: it stays on the portable pair. + +Open before building: the lossless markdown is less readable than the portable one (upstream larvit/adf-codec#185), and agents and the judge read the plan's details from it, so the item must show how a detail stays readable, perhaps by reading portable and writing lossless only on a document an edit changes. Test that an unedited issue and page save back identical. Filed for 0.12.0 because R is above 5 and the item ships alone; the release is the human's call. + ### 319. Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session. On SWE-bench Verified with Haiku 4.5 and Opus 4.7, handing the strong model the weak model's transcript solved 69.2% at $1.61 a task; starting the strong model fresh solved 79.2% at $0.90 (arXiv 2608.24358, The Handoff Tax). A model switch also rereads the whole context uncached (Claude Code prompt caching docs). A worker that steps from Sonnet 5.5 to Opus 5.5 by `--resume` is the raw handoff; an effort-only step within one model keeps the cache and isn't. The escalated subagent, which starts fresh with the trigger's evidence, already follows the pattern that won. -- 2.52.0 From 068ab77ce3b8043f9280152c912949e6f2dc1bc1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:07:39 +0100 Subject: [PATCH 2/6] Record reading cost --- docs/reading-cost.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index e431ee3e..2574733f 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2328,3 +2328,20 @@ Read most (opens and searches): - `docs/decisions.md` 4 - `bin/plan_store/contract.py` 3 - `bin/plan_store/fakes.py` 3 + +## Reading cost, chunk 956d742d7ba4, finished 2026-11-16T02:13:55Z + +276709 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/plan_store/jira_epic.py` 14 +- `bin/project_config/test_project_config.py` 8 +- `bin/plan_store/test_jira_epic.py` 7 +- `bin/project_config/settings.py` 7 +- `bin/plan_store/stores.py` 6 +- `bin/release_plan/ranking.py` 4 +- `README.md` 3 +- `bin/larv_review/test_larv_review.py` 3 +- `bin/project_config/main.py` 3 +- `bin/release_plan/formula.py` 3 -- 2.52.0 From 880d0c63429fa7c0cc91ae534ab5dd2fcdb58bcc Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:08:38 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From bac9cf97562fe1e5e62aff7feba3608c394483c6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:08:38 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Answer=20overrides=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20the=20overr?= =?UTF-8?q?ide=20stands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From f2b7eb7fd2b7c66c740685107ec4c0d380878ffb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:16:50 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20say=20each?= =?UTF-8?q?=20pair's=20use=20once=20in=20the=20module=20docstring,=20name?= =?UTF-8?q?=20what=20the=20changelog=20entry=20keeps,=20and=20make=20item?= =?UTF-8?q?=20391=20stand=20alone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- bin/adf_codec/convert.py | 18 ++++++++---------- bin/adf_codec/node_shim/shim.mjs | 3 +-- todo.md | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b2ba7c2..2dd2de35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- A tool can now convert ADF to markdown and back without losing anything Jira stores. `adf_codec.convert` has `markdown_to_adf_lossless`, `adf_to_markdown_lossless` and `adfs_to_markdown_lossless`, which keep every block's `localId` and the empty paragraphs Jira uses for spacing, so a Jira or Confluence document read and saved back unedited comes back identical. The portable functions stay for new text and for markdown shown to a person. No tool uses the lossless functions yet. +- `adf_codec.convert` can now convert ADF to markdown and back without losing a block's `localId` or the empty paragraphs Jira uses for spacing, so a Jira or Confluence document read and saved back unedited comes back identical: `markdown_to_adf_lossless`, `adf_to_markdown_lossless` and `adfs_to_markdown_lossless`. No tool calls them yet. - A config whose `plan` names a Jira epic must now set `jira-score-formula` and `jira-score-bar`, and fails to load without them. `todo-item add` scores the item by them, refuses one under the bar unless it is exempt, and ranks the new issue among the issues the loop filed: questions first, then security findings, then by score. A person's issues keep their rank. - `todo-item edit` and `move` work on a plan kept in a Jira epic. They change only an issue the loop filed, and never a link. Of an issue a person filed, `edit` sets only the scores, and posts the new `--comment` on the issue to tell the team why; a plan in a file takes the flag and keeps no comment. - A release someone else cut while it still held plan items no longer stops the loop: those items count as the next release's, `chunk-preflight` tells the worker to move them there, and `loop-claude` routes on them. Where the plan names no later release and `todo.md` named none since the cut, the loop still asks which release they belong to. diff --git a/bin/adf_codec/convert.py b/bin/adf_codec/convert.py index 7f2d8a0b..608c8d5e 100644 --- a/bin/adf_codec/convert.py +++ b/bin/adf_codec/convert.py @@ -4,7 +4,7 @@ It runs @larvit/adf-codec, a Node package, in a throwaway container that holds n adf-codec has two pairs of calls, and each function here names the one it runs: - The lossless pair, `*_lossless`, for a document that already exists in Jira or Confluence and is edited and saved back. It keeps each block's localId and the empty paragraphs Jira uses for spacing, so a document read and saved unedited comes back identical. -- The portable pair, with no suffix, for new text written from scratch, and for markdown shown to a person. It drops both, so saving a document that exists changes it. +- The portable pair, with no suffix, for new text written from scratch, and for markdown shown to a person. It drops the localId and the empty paragraphs, so saving a document that exists changes it. """ import contextlib import dataclasses @@ -35,7 +35,7 @@ class Ran: err: str -# Runs the shim in the given mode (`to-adf`, `to-markdown` or either with `-lossless` after it) on a text, or fails to run it. +# Runs the shim in the given mode (`to-adf`, `to-markdown`, `to-adf-lossless` or `to-markdown-lossless`) on a text, or fails to run it. Run = typing.Callable[[str, str], Ran | Failure] # Runs a docker command line on a text, in at most the given seconds, or fails to run it. Docker = typing.Callable[[list[str], str, int], Ran | Failure] @@ -190,32 +190,30 @@ def one_markdown(texts: list[str] | Refused | Failure) -> str | Failure: def markdown_to_adf(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure: - """The ADF document for new markdown, by the portable pair: for text written from scratch. It can't carry a document that exists back unchanged; use markdown_to_adf_lossless.""" + """The ADF document for the markdown, by the portable pair.""" return to_adf("to-adf", markdown, run) def markdown_to_adf_lossless(markdown: str, run: Run = container_run) -> dict[str, typing.Any] | Failure: - """The ADF document for markdown that adf_to_markdown_lossless or adfs_to_markdown_lossless wrote, by the lossless pair: for saving an existing Jira or Confluence document back. Unedited, it gives back the document that was read.""" + """The ADF document for the markdown, by the lossless pair.""" return to_adf("to-adf-lossless", markdown, run) def adfs_to_markdown(documents: list[dict[str, typing.Any]], run: Run = container_run) -> list[str] | Refused | Failure: - """The markdown for each ADF document, in their order, by the portable pair, from one container run, so a caller with many documents pays one container start. - - For markdown shown to a person; the text can't be saved back without changing the document, so use adfs_to_markdown_lossless to edit one.""" + """The markdown for each ADF document, in their order, by the portable pair, from one container run, so a caller with many documents pays one container start.""" return to_markdowns("to-markdown", documents, run) def adfs_to_markdown_lossless(documents: list[dict[str, typing.Any]], run: Run = container_run) -> list[str] | Refused | Failure: - """The markdown for each ADF document, in their order, by the lossless pair, from one container run: for documents that exist in Jira or Confluence and are edited and saved back with markdown_to_adf_lossless.""" + """The markdown for each ADF document, in their order, by the lossless pair, from one container run.""" return to_markdowns("to-markdown-lossless", documents, run) def adf_to_markdown(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure: - """The markdown for the ADF document, by the portable pair: for showing it to a person, not for saving it back.""" + """The markdown for the ADF document, by the portable pair.""" return one_markdown(adfs_to_markdown([document], run)) def adf_to_markdown_lossless(document: dict[str, typing.Any], run: Run = container_run) -> str | Failure: - """The markdown for the ADF document, by the lossless pair: for editing it and saving it back with markdown_to_adf_lossless.""" + """The markdown for the ADF document, by the lossless pair.""" return one_markdown(adfs_to_markdown_lossless([document], run)) diff --git a/bin/adf_codec/node_shim/shim.mjs b/bin/adf_codec/node_shim/shim.mjs index 52a546a9..6ce46e88 100644 --- a/bin/adf_codec/node_shim/shim.mjs +++ b/bin/adf_codec/node_shim/shim.mjs @@ -1,8 +1,7 @@ // Converts between markdown and ADF with @larvit/adf-codec. The mode is the one argument: // to-adf stdin is markdown, stdout is the ADF document as JSON // to-markdown stdin is a JSON array of ADF documents, stdout a JSON array of their markdown texts, in their order -// The portable calls behind those two drop each block's localId and empty paragraphs. The same two modes with the suffix -// -lossless, to-adf-lossless and to-markdown-lossless, call adf-codec's lossless pair, which keeps both. +// to-adf-lossless, to-markdown-lossless the same, through adf-codec's lossless pair in place of its portable pair // Exit 0: stdout holds the answer. Exit 2: adf-codec refused the input, and stdout holds {"error": {code, message, path, position?}}, // with "index", the refused document's place in the array, beside "error" in to-markdown. // Exit 1: the shim could not run, and stderr says why. diff --git a/todo.md b/todo.md index 6e226cb6..77618f58 100644 --- a/todo.md +++ b/todo.md @@ -86,9 +86,9 @@ The config key for the parallel limit is a syntax users write, so a panel seated ### 391. Read and write a Jira epic issue's description and a Confluence record page through the lossless pair, so saving an unedited document leaves it unchanged. -Follows item 390. `plan_store/jira_epic.py` reads an issue's description and writes it back on an edit, and `record_store/confluence_page.py` reads a page and saves it back; both use the portable pair, which drops each block's `localId` and the empty paragraphs Jira uses for spacing. Use `adfs_to_markdown_lossless` and `markdown_to_adf_lossless` where a tool reads a document and writes it back. `record_store/jira_description.py` only reads, to show a person: it stays on the portable pair. +`plan_store/jira_epic.py` reads an issue's description and writes it back on an edit, and `record_store/confluence_page.py` reads a page and saves it back; both use the portable pair, which drops each block's `localId` and the empty paragraphs Jira uses for spacing. `record_store/jira_description.py` only reads, to show a person: it stays on the portable pair. -Open before building: the lossless markdown is less readable than the portable one (upstream larvit/adf-codec#185), and agents and the judge read the plan's details from it, so the item must show how a detail stays readable, perhaps by reading portable and writing lossless only on a document an edit changes. Test that an unedited issue and page save back identical. Filed for 0.12.0 because R is above 5 and the item ships alone; the release is the human's call. +Open before building: the lossless markdown is less readable than the portable one (upstream larvit/adf-codec#185), and agents and the judge read the plan's details from it. Decide how a detail stays readable, for example by reading lossless and showing a person a portable view. Test that an unedited issue and page save back identical. The item ships alone because its R is above 5. ### 319. Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session. -- 2.52.0 From b62dea42fcfebba61a55c7583ede0613c0979cfe Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 16 Nov 2026 13:16:54 +0100 Subject: [PATCH 6/6] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20approved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0