Repository navigation
Description
Problem or Motivation
Each devops roadmap intake run lists every issue and pull request of the repository (4,431 entries), and split_record parses each body with markdown-it to find the job record block at its end. In three profiled --plan runs (#4404), this parse took 92 s, 68 s and 140 s (under cProfile). Offline, on one copy of the 4,431 bodies and with no other load, it takes 39.4 s.
Only 1,084 of the 4,431 bodies hold the record marker <!-- devops-roadmap-record . A body without the marker can have no record block, but the code parses it fully. The code also runs the inline parse of each body, but it reads only the top-level block tokens (level, type, map).
Proposed Solution & Architectural Design
In src/devops_cli/roadmap/stores/store.py:
split_recordreturns the body and an empty record, with no parse, when the body does not hold the marker._RECORD_BLOCKcan only match text that holds the marker, so the result does not change._BODY_MARKDOWNdisables the coreinlinerule of markdown-it. The block tokens that_record_block_spanreads come from the block parser, so the span does not change.
Offline measurement on the 4,431 real bodies: 39.4 s today, 11.1 s with both changes. The spans are the same on all 4,431 bodies. The contract tests of #2538 (tests/roadmap/stores/test_roadmap_store_contract.py) hold the behavior.
Target: the whole intake call takes 1 minute or less (#4404). This item cuts the body parse to 12 s or less offline. The listing item and the embedding item cut the rest.
Target Subsystem
roadmap
Existing Tool Considered
markdown-it-py is already the parser. MarkdownIt.disable("inline") is its public API to skip a core rule. This change adds no library. Cost: about 15,000 tokens to build, about 1,000 tokens a year to keep, and about 1 hour of elapsed time.
Source: #4404
Proposed design
Problem statement
Each devops roadmap intake run lists 4,431 issues and pull requests. It parses every body with markdown-it to find the job record block at its end. Only 1,084 bodies hold the record marker, but the code parses all of them fully, the inline rule included. Offline, on one copy of the bodies, the parse takes 39.4 s. The change cuts it to 11.1 s.
Acceptance criteria
Requirement: Skip the parse of a body with no marker
split_record SHALL return the body and an empty record without a markdown parse when the body holds no <!-- devops-roadmap-record marker.
Scenario: A body without the marker
- WHEN a test replaces
_BODY_MARKDOWNwith a parser that counts each call and callssplit_recordon a body that holds no marker - THEN the counter reads 0, and the function returns the body unchanged with an empty record.
Requirement: The body parse builds no inline tokens
_BODY_MARKDOWN MUST disable the inline core rule, so a parse builds block tokens only.
Scenario: A paragraph parse
- WHEN a test parses the text
Plain text.with_BODY_MARKDOWN - THEN the first token has the type
paragraph, and itschildrenis None.
Requirement: A record block at the end reads as before
split_record MUST return the same body text and record for a body that holds a record block at its end.
Scenario: A record block after a separator
- WHEN a test calls
split_recordonText\n\n<!-- devops-roadmap-record {"Priority": "P2-Medium"} --> - THEN the returned text is
Text, and the record holds{"Priority": "P2-Medium"}.
Requirement: A quoted marker stays in the body
split_record MUST keep a marker that a code span, a fenced code block, an indented code block or a following paragraph quotes in the body.
Scenario: A quote in a fenced code block
- WHEN a test calls
split_recordon a body whose last block is a fence that quotes the marker - THEN the returned text is the whole body, the record is empty, and no warning is logged.
Requirement: The parse runs only for the bodies that hold the marker
split_record MUST call the markdown parse at most once for each body that holds the marker.
Scenario: A batch of mixed bodies
- WHEN a test passes 100 bodies, of which 10 hold the marker, to
split_recordwith a parser that counts each call - THEN the counter reads 10.
Requirement: The contract cases of the record block pass
The contract cases of the record block MUST pass with no change to their test code.
Scenario: The contract suite of the store
- WHEN a test run collects
tests/roadmap/stores/test_roadmap_store_contract.py - THEN every case passes with no failure.
Existing Tool Considered
No alternatives check has run. markdown-it-py is already the parser in src/devops_cli/roadmap/stores/store.py. MarkdownIt.disable("inline") is its public API to skip a core rule. The change adds no library, and the tool lacks nothing for this need. Written cost: about 15,000 tokens to build, about 1,000 tokens a year to keep, and about 1 hour of elapsed time.
Key questions
- How does
split_recordskip the parse of a body with no record block?: Return the body and an empty record before the parse when the body holds no<!-- devops-roadmap-recordmarker._RECORD_BLOCKneeds that marker, so a body without it can hold no block, and the result does not change. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:644, src/devops_cli/roadmap/stores/store.py:688, src/devops_cli/roadmap/stores/store.py:689]- Chosen: Return early when the marker is absent.
_RECORD_BLOCKcan match only text with the marker, so the result is the same, and 3,347 of the 4,431 bodies skip the parse. - Rejected: Parse every body and then check the span. It keeps the 39.4 s cost on the bodies that hold no record.
- Rejected: Cache the parse result by the hash of the body. It adds a cache to keep, and it does not cut the first parse.
- Chosen: Return early when the marker is absent.
- Which markdown-it core rule skips the inline parse and keeps the block tokens?: Disable the core rule
inlineon_BODY_MARKDOWNwithMarkdownIt.disable("inline"). Theblockrule still gives the top-level tokens, and_record_block_spanreads only theirlevel,typeandmap. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:650, src/devops_cli/roadmap/stores/store.py:669]- Chosen: Disable the
inlinecore rule. It is public API, and the block tokens that the span reads do not change. - Rejected: Keep every core rule. It keeps the inline parse of 4,431 bodies, which the change exists to remove.
- Rejected: Replace markdown-it-py with a hand-written scan of the last block. It adds code to keep and risks a change on code spans, fences and quotes.
- Chosen: Disable the
- Do the tokens that
_record_block_spanreads come from the block parser?: Yes._record_block_spanreadslevel,typeandmapof the top-level tokens. Theblockrule sets them, and theinlinerule fills only thechildrenof a paragraph. [sources: src/devops_cli/roadmap/stores/store.py:669, src/devops_cli/roadmap/stores/store.py:673, src/devops_cli/roadmap/stores/store.py:650] - Which tests hold the behavior of the record block?:
tests/roadmap/stores/test_roadmap_store_contract.pyholds the cases of 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: a code span, a fence, an indented code block and a comment in the middle stay in the body, and a broken block reads as an empty record. [sources: tests/roadmap/stores/test_roadmap_store_contract.py] - Does the change need a new library or a new parser version?: No. markdown-it-py is already the parser, and
MarkdownIt.disableis its public API. The change editssrc/devops_cli/roadmap/stores/store.pyonly. [sources: src/devops_cli/roadmap/stores/store.py:650] - How does a test check the parse cost with no timing test?: Count the calls of the parser. A body that holds no marker gives no call, and a body that holds the marker gives one call. A wall-clock threshold is not a check, because it fails on a busy runner. (best practice) [sources: src/devops_cli/roadmap/stores/store.py:688, tests/roadmap/stores/test_roadmap_store_contract.py]
- Chosen: Count the parser calls. The count is deterministic, and it states the saving of the change.
- Rejected: Assert a wall-clock threshold on a body set. The result moves with the load of the runner, so the check is flaky.
- Rejected: Read a profile by hand. A person does it once, so it is no check of a later change.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
perfprefix of the title gives the type.(roadmap)scope of the title gives the scope.It cuts a 39 s parse to 11 s, a meaningful speedup, but the intake still works without it.It removes 28 s of wasted parse time from every intake run of 4,431 bodies.Two small edits in one file, estimated at about 1 hour of elapsed time.Both touch split_record in store.py, but #2538 fixes a misidentification bug while this candidate skips parsing for bodies without the marker.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 3180bf1 (see proposed design in issue body).
perf(roadmap): parse only the bodies that hold a job record (#4455)
devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC
test(roadmap): count the record parses of split_record (#4607)