Repository navigation
Description
Problem or Motivation
A closed job record loses the plan size. When the item was filed, 138 closed records held the key stage.pr, and only 1 held a value. The stage job no longer writes stage.groups: since #6197 the task groups are in the plan-state comment of the plan pull request (src/devops_cli/roadmap/stage/plan_state.py), and in no record key. devops_cli_roadmap_stage_total has no size label. Thus the pass rate by plan size needs the OpenSpec folders, and the split thresholds child of #4780 cannot read it from the job records.
Proposed Solution & Architectural Design
- Add the record key
stage.size: the numbered groups (## N.headings), the tasks, the requirements and the planned paths. Stage writes it with the plan, and it stays after the close. - Add the bounded label
size_bucket(s: 1,m: 2,l: 3-4,xl: 5 or more numbered groups) and the type label todevops_cli_roadmap_stage_total, and to the implement job and failure counters.
Target Subsystem
SDLC, Git & PR Governance (src/devops_cli/roadmap/stage/), with telemetry.
Existing Tool Considered
markdown-it-py counts the headings, and OpenTelemetry carries the label. Cost to build: about 50,000 tokens and 1.5 hours.
Acceptance Criteria
- A closed item keeps
stage.size. - A test counts only
## N.headings. A "Criteria" heading does not count. - The new labels add 4 x 7 series or fewer to each counter.
Dependencies
None.
Source: #4780
Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: markdown-it-py (https://pypi.org/project/markdown-it-py), MIT License, last activity 2026-11-10, maintained.
Reason: Searches and the repository facts confirm markdown-it-py, which the issue names as already used, parses the plan into heading and fence tokens so numbered ## N. groups can be counted; it does not write the record key, the buckets or the counter labels.
Covers:
- Tokenizes level-2 headings with their text
- Keeps headings inside fenced code out of the parse
- Yields task and requirement text from the same parse
Lacks:
- No
stage.sizerecord key or retention after close - No s, m, l, xl or none bucket classification
- No Prometheus labels, item_class or zero-series priming
- No count of planned paths
Proposed design
Problem statement
A closed job record loses the plan size, and the stage counter has no size or type label. The pass rate by plan size must read OpenSpec folders, and the split thresholds cannot read job records. Add a stage.size record key that survives close and add bounded size_bucket and item_class labels to the stage and implement counters.
Acceptance criteria
Requirement: stage-size-key
The values of StageRecordKey SHALL include the key stage.size.
Scenario: the stage record key set
- WHEN a test lists the values of
StageRecordKey - THEN the list holds
stage.size
Requirement: stage-size-record-key
The stage job SHALL write the record key stage.size to the job record of an item when it writes the plan of the item.
Scenario: record written with the plan
- WHEN the stage job stages an item whose plan holds 3 numbered groups, 9 checkbox tasks, 4 requirement headings and 12 distinct planned paths
- THEN the job record holds
stage.sizewithgroups3,tasks9,requirements4 andpaths12
Requirement: stage-size-survives-close
The removal of the staged branch of a closed item SHALL keep the stage.size value of its job record.
Scenario: closed item keeps its size
- WHEN an item whose job record holds
stage.sizecloses and the stage row removes its staged branch - THEN a read of the job record returns the same
stage.sizevalues
Requirement: numbered-group-count
The size count SHALL count only the level-2 headings whose text is a number, a full stop, a space and a title.
Scenario: a plain heading does not count
- WHEN the plan holds the headings
## 1. First,## 2. Secondand## Criteria - THEN the count of numbered groups is 2
Requirement: fenced-heading-not-counted
The size count SHALL ignore a numbered heading inside a fenced code block.
Scenario: a heading in a fence does not count
- WHEN the plan holds the heading
## 1. Firstand a fenced block with the line## 2. Example - THEN the count of numbered groups is 1
Requirement: size-bucket-values
The size_bucket label SHALL be s for 1 group, m for 2 groups, l for 3 or 4 groups and xl for 5 or more groups.
Scenario: four numbered groups
- WHEN a plan holds 4 numbered groups
- THEN the
size_bucketlabel isl
Requirement: size-bucket-none
An item with no plan SHALL count with the size_bucket value none.
Scenario: an item skipped before its plan
- WHEN a stage round skips an item before it writes a plan
- THEN
devops_cli_roadmap_stage_totalcounts the item withresult="skipped"andsize_bucket="none"
Requirement: stage-counter-labels
devops_cli_roadmap_stage_total SHALL carry the size_bucket and item_class labels.
Scenario: a staged item of type feat
- WHEN a stage round stages a
featitem whose plan holds 2 numbered groups - THEN the counter adds 1 with
result="staged",size_bucket="m"anditem_class="feat"
Requirement: item-class-values
The item_class label SHALL be the Conventional Commit type of the item title, or chore when the title has no listed type.
Scenario: an item with no listed type
- WHEN a stage round counts an item whose title is
security(ssh): verify host keys - THEN the counter counts the item with
item_class="chore"
Requirement: bounded-label-series
The two new labels SHALL add at most 55 label pairs to a counter.
Scenario: the label value sets
- WHEN a test lists the
size_bucketanditem_classvalues that the code emits - THEN the list holds at most 5
size_bucketvalues and at most 11item_classvalues, the values ofCONST_BRANCH_TYPES
Requirement: implement-jobs-counter-label
devops_cli_service_implement_jobs_total SHALL carry the size_bucket label beside its repo, item_class and result labels.
Scenario: a successful implement Job
- WHEN the Service reports a succeeded Job of a
fixitem whose job record holdsstage.sizewith 5 numbered groups - THEN the counter adds 1 with
result="succeeded",item_class="fix"andsize_bucket="xl"
Requirement: implement-failures-counter-labels
devops_cli_service_implement_failures_total SHALL carry the size_bucket and item_class labels beside its class and repo labels.
Scenario: a stopped implement Job
- WHEN the Service reports a Job of a
fixitem whose job record holdsstage.sizewith 2 numbered groups and that left the classtest - THEN the counter adds 1 with
class="test",item_class="fix"andsize_bucket="m"
Requirement: implement-counter-none
The Service SHALL count an implement Job whose item has no stage.size with the size_bucket value none.
Scenario: an item with no stage size
- WHEN the Service reports a succeeded Job of an item whose job record holds no
stage.size - THEN
devops_cli_service_implement_jobs_totaladds 1 withresult="succeeded"andsize_bucket="none"
Requirement: implement-counter-priming
The Service SHALL create a zero series for each combination of the new size_bucket and item_class values of the implement job and failure counters when it starts.
Scenario: the Service starts
- WHEN the Service starts with one repository
- THEN
prime_service_counterscreates a zero series for each of the 5 x 11 combinations of both counters
Requirement: telemetry-doc-labels
docs/TELEMETRY.md SHALL list the size_bucket and item_class labels of devops_cli_roadmap_stage_total, devops_cli_service_implement_jobs_total and devops_cli_service_implement_failures_total.
Scenario: the telemetry table
- WHEN a test reads the rows of the three counters in
docs/TELEMETRY.md - THEN each row names
size_bucketanditem_class
Requirement: workflow-doc-key
docs/ROADMAP_WORKFLOW.md SHALL name the record key stage.size in its table of the stage keys.
Scenario: the workflow document invariant test
- WHEN the test collects the code spans of
docs/ROADMAP_WORKFLOW.mdand the keys ofStageRecordKey - THEN the code span
stage.sizeis present
Existing Tool Considered
The alternatives check in the issue body gives markdown-it-py the verdict in-use and lists what it covers and lacks. The proposal uses its parser for the numbered group count. It builds the stage.size key, retention after close, bucket values, labels, series bound and path count itself. The written cost is about 50,000 tokens and 1.5 hours.
Key questions
- Does the stage job still write
stage.groups?: No. Since fix(roadmap): One plan-state comment for each plan PR #6197 the task groups are in the plan-state comment of the plan pull request, not in a record key. [sources: src/devops_cli/roadmap/stage/plan_state.py, src/devops_cli/roadmap/stage/stage.py] - Where does the stage job keep the plan size so that it survives the close?: In the hidden job record block of the issue body as
stage.size. The stage job writes it with the plan, and the block stays on a closed issue. (best practice) [sources: docs/adr/0016-labels-hold-the-roadmap-items-fields.md, docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/stores/store.py]- Chosen: job record block of the issue body. The block holds
stage.prand stays on a closed issue. The new key is the record of the item. - Rejected: a file under the data directory of the Service. A later job reads the record of one item, and the data directory is not the record of an item.
- Rejected: the OpenSpec change folder. The folder exists only for a staged item, and the split thresholds need the value from the record.
- Chosen: job record block of the issue body. The block holds
- Which code clears the keys of a closed item's plan, and how does
stage.sizesurvive it?:_remove_stagedclears the keys ofSTAGE_REMOVAL_KEYSwhen it closes the draft and deletes the branch. Do not addstage.sizetoSTAGE_PLAN_KEYSorSTAGE_REMOVAL_KEYS, so the removal and the rejection keep it. The next plan overwrites it. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/stores/store.py]- Chosen: exclude
stage.sizefromSTAGE_PLAN_KEYSandSTAGE_REMOVAL_KEYS. The removal and the rejection keep it, and a new plan overwrites it. - Rejected: add
stage.sizetoSTAGE_LEDGER_KEYS. The ledger holds the failures and the evictions, so a size in it would be cleared with a publish. - Rejected: keep
stage.sizeinSTAGE_PLAN_KEYSand clear it on removal. The closed record would lose the value, which is the defect the issue fixes.
- Chosen: exclude
- How does the job count the numbered groups of a plan?: It reuses
parse_task_groupsinstep_files.py. The parser reads the plan with markdown-it-py and keeps only a top-level##heading whose text is<n>. <title>. [sources: src/devops_cli/roadmap/step_files.py] - How does the job count the tasks, the requirements and the planned paths?: Tasks are the
TaskGroup.tasksthatparse_task_groupsgives. Requirements are the names thatread_specgives for eachspecs/**/spec.md. Paths are the distinctreadsandchangesof theStageGroups. (best practice) [sources: src/devops_cli/roadmap/step_files.py, src/devops_cli/roadmap/stage/stage_specs.py, src/devops_cli/roadmap/stage/stage_change.py]- Chosen: reuse the three readers. Each reader exists and reads the same text that the stage job writes.
- Rejected: parse the rendered change text again. A second parser would disagree with the readers.
- Rejected: count only the numbered groups. The issue asks for the tasks, the requirements and the planned paths.
- Which values does the
size_bucketlabel take?:sfor 1 group,mfor 2 groups,lfor 3 or 4 groups,xlfor 5 or more groups, andnonefor an item with no plan. (best practice) [sources: src/devops_cli/roadmap/step_files.py, docs/TELEMETRY.md]- Chosen: s, m, l, xl and none. The stage counter also counts a skipped item, which has no numbered group.
- Rejected: s, m, l and xl only. The stage counter counts skipped items, which have no plan.
- Rejected: s, m, l and xl, with
sfor no plan. A skipped item did not plan one group, soswould report a size that no plan has.
- Which values does the
item_classlabel take?: The Conventional Commit type of the title, one of the 11 values ofCONST_BRANCH_TYPES, orchorewhen the title has no listed type. (best practice) [sources: src/devops_cli/config/constants.py:801, src/devops_cli/roadmap/implement/implement_submit.py, src/devops_cli/server/counter_series.py, docs/TELEMETRY.md]- Chosen: the 11
CONST_BRANCH_TYPESvalues withchoreas the default. The implement counters already use these values, so the stage and implement series join onitem_class. - Rejected: a closed set of 7 values with
other. It would collapseperf,revert,test,buildandstyle, and the join would lose those items. - Rejected: the type from the branch name. An item with no plan has no branch, and the title is the one source of the type.
- Chosen: the 11
- Which counters get the
size_bucketanditem_classlabels?:devops_cli_roadmap_stage_total,devops_cli_service_implement_jobs_totalanddevops_cli_service_implement_failures_total. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/implement/implement_submit.py]- Chosen: the stage, implement job and failure counters. The pass rate by plan size joins the stage result to the implement result and the failure class.
- Rejected: the stage counter only. The implement result and the failure class are not on the stage counter.
- Rejected: all implement counters, including repair rounds and tokens. Those count cost, not an outcome, and the issue names the job and failure counters.
- Does the body's 4 x 7 series bound hold for the two labels?: No. The project records 11 Conventional Commit types, and a skipped item needs
none. The bound is 5 x 11 = 55 label pairs for each counter. (best practice) [sources: src/devops_cli/config/constants.py:801, src/devops_cli/server/counter_series.py, docs/TELEMETRY.md]- Chosen: 5 x 11 = 55 label pairs. The join keeps every type, and a skipped item has no plan.
- Rejected: 4 x 7 = 28 label pairs with
other. It collapsesperf,revert,test,buildandstyle, and a skipped item has no plan. - Rejected: 4 x 11 = 44 label pairs without
none. A skipped item has no plan, and the stage counter counts it.
- Where does the Service read the size for the implement counters?: From the
stage.sizeof the item's job record in_emit_implement_metrics. It usesnonewhen the record holds nostage.size. (best practice) [sources: src/devops_cli/roadmap/implement/implement_submit.py, src/devops_cli/roadmap/stores/store.py, docs/ROADMAP_WORKFLOW.md]- Chosen: read
stage.sizefrom the record. The record keeps the size after the close, and the Service already holds the item when it reports the Job. - Rejected: read the OpenSpec change folder. A closed item's change may be archived, and the issue asks the record to hold the size.
- Rejected: recount
stage.groups.stage.groupsis no longer a record key since fix(roadmap): One plan-state comment for each plan PR #6197.
- Chosen: read
- Does the Service create the new label sets at zero?: Yes.
prime_service_counterslists the label sets of the implement counters, and the Service starts each bounded label set at zero. [sources: docs/TELEMETRY.md, src/devops_cli/server/counter_series.py] - Does
docs/ROADMAP_WORKFLOW.mdneed a row forstage.size?: Yes. The new record key belongs in the stage key table ofdocs/ROADMAP_WORKFLOW.md, and AGENTS.md rule 8 requires the same pull request to fix a document that the change makes wrong. [sources: AGENTS.md, docs/ROADMAP_WORKFLOW.md]
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.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It enables a useful metric but does not fix a broken or blocking behaviour.It lets the team read pass rate by plan size from job records without external folders.The body estimates about 50,000 tokens and 1.5 hours of work.Both deal with plan group size in the stage, but #3265 fixes a measurement inconsistency while the candidate adds a persistent size record and metric labels.devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: Searches found no tool that keeps a plan size on a closed job record or labels the project's counters; the only fitting piece is a Markdown parser, and markdown-it-py (the tool the issue itself considered) turns a plan into heading tokens whose level and text let a test count exactly the
## N.groups and ignore other headings. It covers that counting step only, so the persistentstage.sizekey and thesize_bucket/type metric labels still have to be built in the project.The repository already uses this tool.
Tool: markdown-it-py (https://pypi.org/project/markdown-it-py)
Covers:
## N.headings count and a plain "Criteria" heading does notN.numbering of each group can be checkedLacks:
stage.sizerecord key on the job record after closesize_bucketor type label todevops_cli_roadmap_stage_totalor the implement job and failure countersTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Status set to Ready at e5dfddb (see proposed design in issue body).
dan-petty commentedon Nov 20, 2026
Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Dec 1, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.