Skip to content

fix(roadmap): a record write keeps job blocks readable - #6800

Merged
dan-petty merged 5 commits into
mainfrom
fix/6799-record-write-keeps-job-blocks
Nov 22, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/6799-record-write-keeps-job-blocks

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The test job of main fails since #6794 merged after #6792. closed_body closed a block that the body leaves open at its end. The readers of #6736 end such a block at the job blocks at its end. So a record write closed the open block of a person after the refine block, the block became a quote, and the next refine round added a second section.

Now closed_body first calls close_blocks_before_markers, so the close goes before the job blocks, where the readers end the open block. Then it closes a block that is still open at the end, as before. A body with no open block keeps its text. The round test of an open fence and an open <pre> now asserts one write that replaces the section in place, as its docstring asked once a round reads the record.

Closes #6799

Change: openspec/changes/archive/2026-11-22-6799-record-write-keeps-job-blocks/

@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 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Advisory review: PR #6800 (issue #6799)

Recommendation: fix-minor-first. One minor finding stands: the closed_body docstring is not correct. Fix the docstring, then mark the PR ready. The code change is correct. No finding is a major or a blocker.

Lenses and checks that ran

Three lenses ran on head fe67d8301: correctness, tests and standards. No refute verdict came back, and each finding below has evidence.

  • Tests: pytest -n 4 passed on tests/roadmap/stores, tests/roadmap/refine, tests/roadmap/intake, the body hash tests and the alternatives tests (1485 passed, 2 snapshots passed).
  • Local checks: devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures passed.
  • Probe: 85 bodies (43 LF bodies and their CRLF copies) went through closed_body and with_record. These properties held for each body:
    • The close is idempotent.
    • The record reads back (round trip).
    • A second write keeps the body.
    • The two lost-edit checks of _edit_issue hold.
    • The job block markers, the refine section and the alternatives section stay the same.
    • The hashes become stable after the first write, so no job loops.
  • Live data: we compared with_record on main and on head for 838 open issues. The results had 0 differences and 0 failures.
  • PR and commits: the PR is a draft. The body has Closes #6799 and the claims in the body are true. The commits are Conventional Commits. The archived OpenSpec delta agrees with the base spec.

Fail-to-pass

devops ci fail-to-pass --base origin/main: four tests fail on the base and pass on head:

  • test_a_record_write_keeps_a_job_block_in_an_open_block_readable[fence] and [pre]
  • test_a_block_that_a_person_opens_above_the_section_leaves_one_section_over_three_rounds[fence] and [pre]

On the base, the round test gives two sections in each round. This agrees with the red main. The new assertion is the same as the assertion of the open-comment test. It is stricter than the old assertion, not looser. The old docstring of the test asked for this change.

Standing findings

1. Minor: the closed_body docstring is not correct.

2. Nit: a record write now removes the trailing spaces and blank lines of an open block above a job block.

  • Where: closed_body, then _closed in src/devops_cli/roadmap/body_hash.py.
  • Problem: _closed calls rstrip() on the open block. Before this change, only a refine write did this. Now each record write does it.
  • Evidence: from code \n\n\n above the refine block, the write gives code\n```\n\n. The body hashes do not change, and the lost-edit check accepts the result.
  • Fix (optional): remove only the line breaks at the end, as _LAST_LINE_BREAK does. Alternatively, say in the spec that the close can remove the blank lines at the end of the open block.

3. Nit: the close uses LF in a CRLF body (this problem was there before the PR).

  • Where: _closed and close_open_block in src/devops_cli/roadmap/body_hash.py.
  • Problem: the close and the blank line after it use LF, so the body gets mixed line breaks.
  • Evidence: the probe showed the mixed line breaks. The round trip, the idempotence and the hashes still hold. Of the 838 live bodies, 0 contain CRLF.
  • Fix (optional): use the line break of the body for the close. No action is necessary in this PR.

4. Nit: a stale record can now look like a real record block (this interacts with open issue #6785).

  • Where: with_record in src/devops_cli/roadmap/stores/store.py.
  • Problem: a person can open a fence above the refine block and the old record. Then the head write closes the fence before the refine block. The old record becomes a top-level comment one block above the new record. On main, the old record stayed as visible code. On head and on main, the old keys are lost, and this is fix(roadmap): read a record below a block a person opens #6785.
  • Evidence: the read of the written body gives {'refine_body_hash': 'a'} on head and on main.
  • Fix: no change in this PR. Add a comment to fix(roadmap): read a record below a block a person opens #6785 so that its fix also handles a stale record comment that is not the last block.

5. Nit: the new unit test does not use job_block_bounds, which is the function that the acceptance criterion names.

  • Where: tests/roadmap/stores/test_roadmap_store_record_block.py, the new test.
  • Problem: the criterion of fix(roadmap): a record write keeps job blocks readable #6799 says that job_block_bounds finds the job block in the written body. The test calls extract_section_and_outside, which closes the open blocks again before it cuts the section.
  • Evidence: the test fails on the base, so it finds the defect. A scratch run shows that job_block_bounds(written) is not None on head for the fence case and the pre case.
  • Fix (optional): add job_block_bounds(written) is not None to the assertion.

6. Nit: two round tests have the same body.

  • Where: tests/roadmap/refine/test_roadmap_refine_block_markers.py, the open-block round test and the open-comment round test.
  • Problem: after the change, the two function bodies are the same. Only the parameters and the docstrings are different.
  • Evidence: a diff of the two bodies without their docstrings shows no difference.
  • Fix (optional): merge the two tests into one test with four parameters. Keep the two reasons in the parameter IDs or in the docstring.

7. Nit: the workflow document does not mention the new close position.

Fixed after the review (6f8d351)

@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 22:11
@dan-petty
dan-petty merged commit b1d4852 into main Nov 22, 2026
29 checks passed
@dan-petty
dan-petty deleted the fix/6799-record-write-keeps-job-blocks branch November 22, 2026 22:35
dan-petty pushed a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.195.3](v0.195.2...v0.195.3)
(2026-11-22)


### Bug Fixes

* **roadmap:** a record write keeps job blocks readable
([#6800](#6800))
([b1d4852](b1d4852))
* **roadmap:** every job block reader uses one marker rule
([#6794](#6794))
([9dfe03e](9dfe03e)),
closes [#6736](#6736)

---
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): a record write keeps job blocks readable

1 participant