Skip to content

fix(roadmap): read a record below a block a person opens - #6812

Merged
dan-petty merged 7 commits into
mainfrom
fix/6785-read-record-below-open-block
Nov 23, 2026
Merged

dan-petty merged 7 commits into
mainfrom
fix/6785-read-record-below-open-block

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A job writes the record block at the end of the issue body. A person can later open a code fence, a <pre> block or a comment above the record on GitHub and not close it. CommonMark then reads the record as part of that block, so split_record read an empty record, and the item lost its job state. With a fence above the refine block, the next write also left a stale copy of the old record.

Now split_record also reads the record on the last line of the body when that line ends a block that the body opens above it. close_open_block of body_hash.py decides that the block is open, as for the job block readers. The extra parse runs only when the last block is not the record. A quote on that line reads as the record only when it holds a JSON object. The next write closes the block before the record and keeps the old keys in one record block.

Closes #6785

Change: openspec/changes/archive/2026-11-22-6785-read-record-below-open-block/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 23, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Review of #6785: read a record below a block that a person opens

Recommendation: open-and-ready. No finding above nit stands against this change. Three nits stand. One defect stands that origin/main also has, and #6791 owns its fix.

Head: 4aa7cf059. The branch is 3 commits behind origin/main (#6807, #6806 and release 0.196.0). A test merge with origin/main has no conflict. These commits do not change store.py, body_hash.py or the changed tests. They change a different paragraph of docs/ROADMAP_WORKFLOW.md. Rebase the branch before the push.

Lenses and checks

  • Lenses: fidelity (ok), tests (concerns), correctness (ok), standards (concerns), adversarial (ok). No refute verdict ran. One fix round ran, and a recheck confirmed each of its 6 actions.
  • Fail-to-pass: 32 changed tests fail on origin/main and pass on the head. The 4 cases of test_a_quote_on_the_last_line_stays_the_text_of_the_person pass on both, because they guard behavior that does not change.
  • Static checks: ruff check, ruff format --check and mypy on store.py pass. devops ci --check passes all 10 scoped rows, and devops ci docs passes. The commit hooks passed on each commit.
  • Tests: tests/roadmap/stores, the refine block-marker tests and test_roadmap_body_hash.py pass on the final head (462 and 30 passed). The callers of split_record and with_record pass (6748 passed).
  • One test of tests/roadmap failed in the build worktree: test_review_facts.py::test_the_facts_of_a_version_window. It needs the optional review extra, which was not installed there, and it does not use split_record.
  • Mutation run: a mutant of each of the 4 guards in _record_below_open_block now fails at least one test.
  • Probes: 48 adversarial bodies and 20000 random edits give the expected read and write. A live read of all open issue bodies (833 to 837) gives the same body and record on the base and the head.
  • Cost: a listing of all open issues takes the same time on the base and the head. The medians of 10 runs are 0.881 s and 0.885 s.

Standing findings

1. nit, fixed in e30e9e4ff: the property test does not check the body that the read gives

  • Where: tests/roadmap/stores/test_roadmap_store_record_block.py, test_a_block_that_a_person_opens_on_any_line_keeps_the_record.
  • Problem: the test asserts the record, the count of record blocks and the next record. It does not assert person, the body that the read gives. A read that drops text above the record can pass.
  • Evidence: the asserted tuple is (held, after.count(...), split_record(after)[1]). A probe of 20000 random edits found 0 wrong bodies, so the code is correct now.
  • Fix: add person to the tuple. Its expected value is the edited text before the record line, without the separator of the writer.

2. nit, fixed in e30e9e4ff: tasks.md has long sentences and an unclear claim

  • Where: openspec/changes/archive/2026-11-22-6785-read-record-below-open-block/tasks.md, tasks 1.1, 1.2 and 2.1.
  • Problem: some sentences are longer than 25 words. The test list of task 1.1 does not name the JSON-quote test or the list-item case. The claim "Each new test but the quote test fails on the base" is unclear, because there are now two quote tests.
  • Evidence: a word count gives 125 and 27 words in task 1.1, 53 in task 1.2 and 34 in task 2.1. A code span counts as one word. Fail-to-pass lists test_a_quote_with_a_json_object_in_an_open_block_reads_as_the_record as failed on the base.
  • Fix: write one sentence for each test group, and name the two new tests. Change the claim to "Each new test fails on the base, except test_a_quote_on_the_last_line_stays_the_text_of_the_person".

3. nit: a requirement sentence is longer than 25 words

  • Where: openspec/specs/roadmap-item-labels/spec.md:64, and line 4 of the delta spec of the archived change.
  • Problem: the last sentence of the requirement "Only the comment at the end of the body is the record block" has 36 words.
  • Evidence: the base sentence has the same structure. This change edited it and added "Each other".
  • Fix: optional. Split it into three sentences in both files. Example: "Each other quote of the block in a code span or a code block SHALL stay in the body. A comment that more text follows SHALL also stay in the body. Neither SHALL read as a record or log a warning."

4. pre-existing, minor: an HTML line of kind 6 or 7 directly above the record hides the record

  • Where: src/devops_cli/roadmap/stores/store.py, split_record. origin/main gives the same result.
  • Problem: a person can type a line such as <details> or <div> directly above the record. CommonMark then reads the record line as part of that HTML block. The read gives {}, and the next write adds a second record block and loses the old keys.
  • Evidence: the body Text, a blank line, <details> and a record with refine.body_hash gives {} on the base and on the head. After the next write, the body holds 2 record blocks, and refine.body_hash is lost. No open issue body has this form now.
  • Fix: do not fix it in this pull request. fix(roadmap): find a job block below an HTML block #6791 builds the rule for kind 6 and 7 blocks after this change merges. Add the record case to fix(roadmap): find a job block below an HTML block #6791, so that one rule covers the job block markers and the record. design.md and tasks.md of this change already state the limit.
  • Decision: this finding does not change the recommendation. This change does not cause it, and the scope of this change excludes its fix.

Fixed findings

  • tests (minor): no test covered the close_open_block guard. The list-item case now fails when the guard is removed.
  • standards (minor): three docstring sentences of _record_below_open_block had more than 25 words. The docstring now has short sentences.
  • standards (minor): sentences in design.md had up to 40 words. The recheck counts no sentence above 25 words.
  • adversarial (minor), fidelity (nit), correctness (nit): a JSON-object quote on the last line of an open fence reads as the record. No document named it. A design decision, a spec scenario and a fail-to-pass test now record it.

Design decisions

  • The second parse runs only when the last block is not the record. Reason: split_record runs for each issue of a listing, and the listing time does not change.
  • close_open_block of body_hash.py decides that a block is open. Reason: the job block readers of fix(roadmap): every job block reader uses one marker rule #6736 use the same rule, so there is no second parser.
  • The last line is a record only when CommonMark parses that line alone as the record block. Reason: fix(roadmap): every job block reader uses one marker rule #6736 applies the same test to a marker line, so an indented quote stays text.
  • A record line with no JSON object in an open block stays text, with no warning. Reason: a job always writes a JSON object, and a drop would remove a quote of a person.
  • A quote with a JSON object on the last line of an open block reads as the record. Reason: CommonMark cannot tell this quote from the record, and no open issue has this form.
  • No blank line is necessary before the record line. Reason: the fix(roadmap): every job block reader uses one marker rule #6736 readers need none before a marker line, and a person can type the opener directly above the record.
  • The separator of the writer goes with the record, as before. Reason: the next write then holds one record block with the old keys, and no stale copy stays.
  • github_store.py does not change. Reason: both lost-edit checks accept the new read-back, and a test proves 2 PATCH calls with no lost edit.
  • The rendered-form test covers fences only. Reason: an HTML block renders as its raw text, so only its close is new in the HTML.

After the review

  • The coordinator fixed nits 1 and 2. The property test now also asserts that the read gives a prefix of the edited body with no record. Five Hypothesis seeds pass.
  • The branch is rebased onto the newest main with no conflict. Fail-to-pass on the rebased head: 32 changed tests fail on the base and pass on the head.
  • Finding 4 is added to fix(roadmap): find a job block below an HTML block #6791 in a comment.

@dan-petty

Copy link
Copy Markdown
Owner Author

CI of this PR fails in shard 1 of "Tests & Coverage" on tests/docs/test_exceptions.py::test_each_error_class_declares_the_codes_of_its_catalog_row. This PR does not cause it. The error catalog leaves out the four error classes that #6806 added in devops_cli.github.onboard. The test sees them only when an onboard test runs in the same worker, and the new tests of this PR changed the shard layout. The same failure reproduces on origin/main with the onboard test first.

#6815 holds the fix. This PR stays a draft until #6815 merges. Then I rebase it and mark it ready when CI passes.

@dan-petty
dan-petty force-pushed the fix/6785-read-record-below-open-block branch from 85e2eef to 663e138 Compare November 23, 2026 01:20
@dan-petty
dan-petty marked this pull request as ready for review November 23, 2026 01:27
@dan-petty
dan-petty merged commit 54a36e9 into main Nov 23, 2026
30 checks passed
@dan-petty
dan-petty deleted the fix/6785-read-record-below-open-block branch November 23, 2026 01:29
dan-petty pushed a commit that referenced this pull request Nov 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.198.0](v0.197.0...v0.198.0)
(2026-11-23)


### Features

* **ci:** refuse changes to environment paths after the switch
([#6823](#6823))
([ad366bb](ad366bb))
* **roadmap:** Add requirement text to the stage context
([#6826](#6826))
([615bbc4](615bbc4))
* **roadmap:** Require a rejected alternative with a fact
([#6836](#6836))
([5467e22](5467e22))
* **roadmap:** The stage plan states constant claims
([#6837](#6837))
([5ea6d02](5ea6d02))


### Bug Fixes

* **deps:** update ghcr.io/dan-petty/devtools Docker tag to v1.1.1
([#6834](#6834))
([ea1b00f](ea1b00f))
* **docs:** the error catalog lists the onboard errors
([#6829](#6829))
([1846b2d](1846b2d))
* **roadmap:** name a spent provider key, not a refused key
([#6827](#6827))
([3aedb2f](3aedb2f))
* **roadmap:** read a record below a block a person opens
([#6812](#6812))
([54a36e9](54a36e9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(roadmap): read a record below a block a person opens

1 participant