Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions openspec/changes/6627-find-a-job-block-marker-only/design.md

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Design

## Decisions

- **One helper in the body hash module, `src/devops_cli/roadmap/body_hash.py:24:def extract_section_and_outside(`, finds a marker, and the four markers live in one set there.**: body_hash is imported by refine, the alternatives check, the repair pass and the stage job, so one rule serves the section ending, the block writing and the block reading, and two copies of the marker set cannot drift.
- **The helper returns the character span of a marker only where the marker is a whole `html_block` token or the whole last line of a comment.**: markdown-it-py gives `html_block` tokens with a line map. A marker in a code span, a fenced code block or a paragraph is another token. The record block already reads the body in this way, at `src/devops_cli/roadmap/stores/store.py:949:if last is None or last.type != "html_block" or last.map is None:`.
- **The span is the text of the marker inside the block, not the whole line.**: The outside and inside slices of a real block stay byte for byte what they were, so the body hash that a job recorded for an existing item still matches.
- **The unpaired-marker guard counts only HTML-block markers.**: It follows the rule of #6613 that only an HTML block counts, so a quoted pair is the person's text and the check adds its block at the end.
- **A writer adds its block at the end of a body that holds no HTML-block marker pair.**: The alternatives spec says replace the block or add it at the end, and refine already builds its new body as the outside text plus its section at the end.
- **The stage criteria reader cuts the refine block with the same helper, at `src/devops_cli/roadmap/stage/stage_criteria.py:117:def _without_refine_block(`.**: That reader removes the block with `body.find`, so a quoted pair loses the criteria between the markers, and the expected behavior of the issue covers the readers of the block.
- **The marker set moves from the refine module to the body hash module under the name `JOB_BLOCK_MARKERS`, beside `src/devops_cli/roadmap/body_hash.py:43:def hash_text(`.**: refine imports body_hash, so body_hash cannot import refine, and one public set keeps the section ending and the block functions on the same rule.
- **A writer closes a code fence or an HTML block that is open before a marker that it writes, with `close_open_block` at `src/devops_cli/roadmap/body_hash.py:139:def close_open_block(`.**: CommonMark reads all text after an open fenced code block as part of that block. The same rule applies to an open HTML block of kinds 1 to 5: `<pre>`, a comment, `<?`, `<!X` and CDATA. A marker there is no HTML block of its own. Thus the next read finds no block, and the write adds a second one. The advisory review of PR #6720 ran three refine rounds. In each round, the problem statement of the model opened a fence and did not close it. At the head of the PR, the body held 1, 2 and 1 sections, and the item never read as unchanged. With `body.find`, the body held 1 section, and the item read as unchanged on each round. The helper parses the text with a probe marker after it. When the probe is in an open block, the last token gives the fence markup or the first line of the HTML block. The helper then adds the close on a line of its own.
- **A marker that is the whole last line of a comment bounds a block, in `_bounding_marker` at `src/devops_cli/roadmap/body_hash.py:62:def _bounding_marker(`.**: CommonMark ends a comment at the first line that holds `-->`. A person can open a comment above a job block and not close it. The start marker is then the last line of the comment of the person. The advisory re-review of PR #6720 found that the read then found no block. Refine then wrote a second section, and the old section stayed visible. Now the read finds the old block. Refine replaces it and closes the comment of the person before the new section. The alternatives check replaces its block in place. The marker must be the whole last line, and the first `-->` of the comment must be the end of the marker. A marker that a person quotes in a code span, a code block or a paragraph stays the text of the person.
- **Refine closes its own text and the text outside its section, and records the hash of the body that it writes.**: `render_proposal_section` closes the sanitized text before the moved part and the end marker (`src/devops_cli/roadmap/refine/refine.py:2412:section = close_open_block(sanitize_text("\n".join(lines), allowed_urls))`). The write closes the outside text before the start marker (`src/devops_cli/roadmap/refine/refine.py:3722:new_body = close_open_block(outside.rstrip()) + "\n\n" + rendered_section`). `refine.body_hash` is the hash of `new_body` (`src/devops_cli/roadmap/refine/refine.py:3778:body_hash=body_hashes(new_body)[0],`), so the close is no change on the next round. With no open block the two hashes are equal, so the record of an existing item does not change.
- **The alternatives check closes its own text and the body before its block, and records `alternatives.body_hash` of the body that it writes.**: One rule serves both writers. The check writes each model text on one line after a prefix (`_clean`, `Reason:`, `- `), so its own text cannot leave a fence open now. The close keeps the block readable if that form changes.
- **A job may add a close line to the text of a person.**: No base spec, no plan of #6627 and no trust rule says that a job never changes the text outside its block. Refine already strips the trailing white space of that text and moves its section to the end (`outside.rstrip()`), and the alternatives check strips it too (`body.rstrip()`). GitHub already shows the job block as code in that case, so the close fixes the display and keeps the code of the person in its block. The approval of the review holds while the body hashes as recorded (`src/devops_cli/roadmap/trust.py:61:return approved and is_unchanged(item, item.body)`), and the recorded hash includes the close, so the approval holds on the next round.
- **No body on GitHub needs a repair.**: A scan of the 828 open issues on 2026-11-22 found 749 bodies with both refine markers and 572 with both alternatives markers, and `job_block_bounds` finds the block in each of them.

## Rejected alternatives

- **One helper in body_hash with its own copy of the markers.**: Two copies of the marker set can drift, and the writer and the readers would then disagree on what a block is.
- **A separate parser in each module.**: It duplicates the CommonMark rule and lets the writer and the readers disagree.
- **A regular expression on the body.**: A regular expression cannot tell a code span, a fenced code block or a paragraph from an HTML block.
- **Keep the plain text search.**: A quoted pair would be refused as an unpaired marker, and the append of the issue's expected behavior would not happen.
- **Remove the unpaired-marker guard.**: A real start marker with no end marker would let a write replace the person's text.
- **Insert the block at the first quoted marker.**: It writes inside a person's code span and repeats the defect.
- **Write no block when the body holds no HTML-block marker.**: It leaves the item with no result from the job.
- **Require the `html_block` token to sit at the top level of the body.**: refine's section ending counts a marker at any level (#6613), and one rule for the section ending and the block functions must agree.
- **Report a marker problem and write no block when the text of a person ends in an open block.**: The item then gets no result from a job until a person closes the block. Also, no rule forbids a close line in the text of a person.
- **Close the open block before the first marker line in it.**: It reads a marker in the code of a person as a marker of a job, which the rule of #6627 forbids. A person can open a code fence or a `<pre>` block above an existing job block. The old block then stays in the code of the person, and the write adds a new block after the close. A comment is different, because CommonMark ends it at the start marker. The marker then still bounds the old block, and the write replaces that block.
- **Put a blank line before the end marker of refine.**: It changes the section of each item, so each item reads as changed and refine asks the model again for all of them. A blank line also does not end a code fence.

## Unchanged references

- `openspec/changes/archive/2026-11-21-6613-an-alternatives-block-names-no-blocker/design.md` (quoted target): An archived change records the design of #6613 as it was merged, and history is not rewritten.
- `openspec/changes/archive/2026-11-21-6613-an-alternatives-block-names-no-blocker/tasks.md` (quoted target): An archived change records the tasks of #6613 as they were merged, and history is not rewritten.
Loading