Answer prose round 1: 0 🔴, 6 🟡 (0 misread); the codec's docstring and the decision say which pair the loop uses and why, the entry sits in order, and item 395 names its parts once

This commit is contained in:
2026-11-17 03:12:16 +01:00
parent 432b62aa08
commit 7e3204a089
6 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
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 the localId and the empty paragraphs, so saving a document that exists changes it.
- The portable pair, with no suffix, which the loop's tools use. It drops each block's localId and the empty paragraphs Jira uses for spacing, so saving a document read by it changes the document; a tool that saves one unedited sends nothing instead (`docs/decisions.md` → `project config: the loop shows a Jira description and a Confluence page as adf-codec's portable markdown, …`).
- The lossless pair, `*_lossless`, which keeps both, so a document read and saved unedited comes back identical. Its markdown wraps every block in `!adf:` marker lines, so no tool reads by it yet.
"""
import contextlib
import dataclasses
+1 -1
View File
@@ -186,7 +186,7 @@ class JiraPlan:
return Failure(f"cannot convert the item's detail to a Jira description: {description.reason}") if isinstance(description, Failure) else description
def shows(self, issue: Issue, detail: str) -> bool:
"""Whether detail is the issue's description as a read shows it. An edit leaves such a description as Jira holds it: converting the markdown back would drop the localIds and spacing paragraphs that the markdown a read shows leaves out."""
"""Whether detail is the issue's description as a read shows it. An edit leaves such a description as Jira holds it, since converting the markdown back would drop each block's localId and Jira's spacing paragraphs."""
if issue.description is None:
return not detail.strip()
texts = self.to_markdown([issue.description])
+1 -1
View File
@@ -518,7 +518,7 @@ class Editing(unittest.TestCase):
self.edit(34, {"E": "3"})
self.assertEqual([body for _, _, body in self.writes()], [{"fields": {"summary": "Count every run."}}, {"properties": [{"key": "plan-item", "value": PROPERTY | {"E": 3}}]}])
def test_a_detail_as_the_description_reads_leaves_the_description_as_jira_holds_it(self):
def test_a_detail_unchanged_since_the_read_leaves_the_description_as_jira_holds_it(self):
# Jira's own spacing paragraph and localIds, which a description converted back from markdown would lose.
held = {"type": "doc", "version": 1, "content": [{"type": "paragraph", "attrs": {"localId": "p-1"}, "content": [{"type": "text", "text": "Why it counts."}]}, {"type": "paragraph", "attrs": {"localId": "p-2"}}]}
self.open = [issue("ABC-34", scores=PROPERTY, description=held)]
+2 -2
View File
@@ -21,7 +21,7 @@ SHAPE = "not in the shape Confluence Cloud's REST API version 2 documents"
@dataclasses.dataclass(frozen=True)
class Seen:
"""The page's version number and title as a read found them or a write left them, and the digest of the markdown it found or sent. A write needs all three, so a Held's version holds them, as JSON."""
"""The page's version number and title as a read found them or a write left them, and the digest of the markdown it found or sent. A write needs the version and title, and sends nothing where its text has that digest, so a Held's version holds all three, as JSON. The digest is None where the version came from a request that held no text."""
version: int
title: str
digest: str | None = None
@@ -88,7 +88,7 @@ class ConfluencePage:
seen = self.seen_of(over)
if isinstance(seen, Failure):
return seen
# The markdown a read shows drops the localIds and spacing paragraphs Confluence holds, so writing the text a read found back would lose them: leave the page alone. No write means no 409, so the version is read instead: a save over a teammate's edit refuses whether or not the text changed.
# A read's markdown leaves out the localIds and spacing paragraphs Confluence holds, so a write of the same text back would drop them: send nothing. Without a write Confluence answers no 409, so read the version to refuse where a teammate saved since.
if over is not None and seen.digest == digest_of(text):
current = self.fetched("")
if isinstance(current, Failure):