Skip to content

fix(roadmap): the job record reader takes a record block quoted in a code span as the record, and the next write deletes the quote #2538

Description

@dan-petty

Problem Description

split_record (src/devops_cli/roadmap/store.py:340) finds the job record with a regular expression anywhere in the body: an HTML comment opener, a space, the marker devops-roadmap-record, a space, any text, and the comment closer. It does not know Markdown. So text that only quotes the record format in a code span or a code block is read as the record block:

  • The read takes the first quote as the record. The quote holds no JSON object, so the record reads as empty, with a warning.
  • _RECORD_BLOCK.sub("", ...) removes every quote from the body that the read returns. The next write of the record writes that body, so it deletes the text that a person wrote, and adds a real block.

The roadmap store reads issues?state=all, so it reads pull requests too. In the cluster on 2026-10-28, the bodies of #2507 and #2435 quote the format in a code span, and the Service warned for each of them in each round. An issue that quotes the format, such as an issue about the record itself, loses that text at the next write.

Reproduction Steps

  1. Put a line in an issue body that quotes the record block in a code span: a backtick, an HTML comment opener, a space, the marker devops-roadmap-record, a space, {...}, a space, the comment closer and a backtick.
  2. Call split_record(body).
  3. The returned body no longer holds the quoted text, and the record is {} with a warning.

Expected vs Actual Behavior

Expected: only a real HTML comment counts as the record block, and only at the end of the body, where with_record writes it. A quote in a code span or a code block stays in the body, as text. markdown-it-py, which refine already uses for body questions, gives the block structure: an html_block token is a real comment, and a code_inline or fence token is not.

Actual: the quote is taken as the record and removed from the body.

Environment Diagnostics

Image from main at 657b03d.

Logs, Traces, or Terminal Output

The job record block of #2507 holds no JSON object of text values, so it reads as empty, and the next write of its record replaces it.
The job record block of #2435 holds no JSON object of text values, so it reads as empty, and the next write of its record replaces it.

Each line appeared 3 times in 23 minutes in pod roadmap-service-9f4d8fd6d-2qwfd. #2525 is a different defect in the same area: refine's sanitizing of the model's text.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

The defect reproduced on this issue. The body that devops roadmap intake filed quoted the record format two times, in code spans. The intake write removed both quotes, so this body now describes them in words (edit history of this issue).

Proposed design

Problem statement

split_record in store.py uses a regex that matches the record marker anywhere in the body. It does not know Markdown. A code span or code block that quotes the record format is read as the record block, reads as empty with a warning, and is then deleted from the body on the next write. This is silent data loss of user-written text.

Acceptance criteria

  • Criterion 1: A body that quotes the record format in a code span retains that text after split_record is called.
    Verification: Call split_record on a body containing a backtick-quoted record block. Assert the returned body still holds the quoted text and the record is None or empty without a warning.
  • Criterion 2: A body that quotes the record format in a fenced code block retains that text after split_record is called.
    Verification: Call split_record on a body containing a fenced code block with the record marker. Assert the returned body still holds the fenced block and no warning is emitted.
  • Criterion 3: A body with a real HTML comment record block at the end still reads the record correctly.
    Verification: Call split_record on a body ending with a real <!-- devops-roadmap-record {...} --> comment. Assert the returned record holds the JSON values and the body no longer holds the comment.
  • Criterion 4: The record block is only recognized at the end of the body.
    Verification: Call split_record on a body that has a real HTML comment record block in the middle followed by more text. Assert the record is not extracted and the body is unchanged.
  • Criterion 5: No warning is emitted for a body that only quotes the format.
    Verification: Call split_record on a body with a code-span quote of the record format. Assert no warning log line is produced.

Key questions

  • How does split_record distinguish a real record block from a quoted one?: Parse the body with markdown-it-py using the commonmark preset. An html_block token is a real HTML comment. A code_inline or fence token is a quote and is not the record block. Only an html_block token that contains the devops-roadmap-record marker is treated as the record. (best practice) [sources: src/devops_cli/roadmap/refine.py:888, openspec/changes/archive/2026-10-28-2478-refine-outside-author/proposal.md:43, openspec/changes/archive/2026-10-28-2525-refine-sanitize-code-spans/design.md:35]
    • Chosen: Use markdown-it-py to parse the body and inspect token types. markdown-it-py is already a dependency used in refine.py. It gives the block structure: html_block is a real comment, code_inline and fence are quotes. This is the approach the issue body names.
    • Rejected: Keep the regex and add a check that the match is not inside a code span or fence. A regex cannot reliably detect code span boundaries in all Markdown edge cases. It would duplicate the parser logic and miss nested or multi-line spans.
    • Rejected: Require the record block to be the only HTML comment in the body. Too restrictive. A body may legitimately hold other HTML comments. The position (end of body) is the correct discriminator.
  • Where in the body is the record block valid?: Only at the end of the body, where with_record writes it. A record block in the middle of the body is not the job record. (best practice) [sources: src/devops_cli/roadmap/store.py:340]
    • Chosen: Accept the record block only at the end of the body. with_record appends the record block at the end. This is the only position the system writes it. Accepting it elsewhere would still match quoted examples that happen to be at the end.
    • Rejected: Accept the record block anywhere in the body. This is the current behavior and is the source of the defect. It matches quoted examples.
  • Is markdown-it-py already a dependency of this project?: Yes. refine.py uses it to inspect code_inline tokens in the body. The archived proposal for fix(roadmap): refine leaves an issue from an outside account waiting on a person, and neutralizes comment markers, bare links and cross-repository references #2478 confirms markdown-it-py 4.2.0 with the commonmark preset is in use. [sources: src/devops_cli/roadmap/refine.py:888, openspec/changes/archive/2026-10-28-2478-refine-outside-author/proposal.md:43]
  • How should the removal of the record block from the body work after the fix?: Remove only the specific html_block token that was identified as the record block, not every regex match. The body text of all other tokens, including code spans and fences, is preserved. (best practice) [sources: src/devops_cli/roadmap/store.py:340]
    • Chosen: Remove only the identified html_block token from the body. This preserves all other text, including quoted examples in code spans and fences. It targets the exact block that was read as the record.
    • Rejected: Keep the current _RECORD_BLOCK.sub removal of all regex matches. This is the current behavior and is the source of the data loss. It removes quoted examples.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    status/new
    value/high
    effort/medium
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The regex in split_record matches quoted examples as real record blocks and deletes user text on the next write.
    • Priority: P1-High. The defect deletes user-written text from live issues in production, as shown by the pod logs on 2026-10-28.
    • Value: High. Users lose text they wrote in issue bodies, which is silent data loss.
    • Effort: Medium. The fix targets one function and can use markdown-it-py, already a dependency, to distinguish real HTML comments from code spans.
    • Related: fix(roadmap): refine sanitizing breaks the model's code spans and misses references that GitHub links #2525, which asks for a different change. Both items handle code spans in roadmap issue bodies, but this fixes split_record in store.py while #2525 fixes sanitize_text in refine.py.
  3. added
    priority/p1-high
    on Oct 28, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  5. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at b32348a (see proposed design in issue body).

  6. added a commit that references this issue on Oct 29, 2026
  7. removed
    status/ready
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions