Repository navigation
Description
Problem Description
devops pr describe <issue> --summary <text> reads the section Why of the proposal. It removes each HTML-like tag from that text, also inside a code span. The text origin/<default> in a code span becomes origin/. The body then names a wrong ref, and the command prints no warning.
The cause is proposal_why in src/devops_cli/roadmap/pull_describe.py. It calls safe_text of src/devops_cli/roadmap/stage_change.py, and safe_text calls sanitize_text. An explicit --why does not go through proposal_why, so the same text stays whole.
Reproduction Steps
- Write the section
Whyof a proposal with the text: The plan check lists the files oforigin/<default>. - Run
uv run devops pr describe <issue> --summary "read the tree once". - Read the body that the command prints.
Expected vs Actual Behavior
Expected: the body holds origin/<default> as written, or the command refuses the text and names the tag.
Actual: the body holds origin/, and the command exits 0 with no warning.
Environment Diagnostics
Found while delivering #3430 on origin/main 66a8a63.
Proposed Solution
Keep the text of a code span as it is. A code span cannot ping a person or link a page, so it needs no sanitizing. Add a test that a Why with origin/<default> in a code span reaches the body whole.
Pre-Submission Checklist
- I checked that this issue holds no credential or private data.
- I searched the open and closed issues for
pr describeand found no duplicate.
Proposed design
Problem statement
devops pr describe builds the body from the Why section of a proposal. proposal_why passes that text to safe_text, which calls sanitize_text. The sanitizer removes an HTML-like tag inside a code span, so origin/<default> becomes origin/. The fix keeps the text of a code span as written and adds a test for it.
Acceptance criteria
Requirement: Code span keeps angle brackets
The proposal Why text SHALL keep every character inside a Markdown code span.
Scenario: Why with origin/<default>
- WHEN The section
Whyholds the text withorigin/<default>in a code span. - THEN
proposal_whyreturns the text withorigin/<default>unchanged.
Requirement: Tag outside a code span is removed
The sanitizer SHALL remove an HTML-like tag that is outside every code span.
Scenario: Tag outside code span
- WHEN
sanitize_textreceives<b>bold</b>andorigin/<default>with no code span around the tag. - THEN The result holds
boldandorigin/<default>and no<b>tag.
Requirement: Tag-like text inside a code span is kept
The sanitizer MUST keep tag-like text that sits inside a code span.
Scenario: Code span with <default>
- WHEN
sanitize_textreceives a code span that holds<default>and<i>text</i>outside it. - THEN The result holds the code span unchanged and no
<i>tag.
Requirement: Pull request body holds the whole ref
devops pr describe SHALL write the whole code span of the proposal Why into the pull request body.
Scenario: Describe reads a proposal Why
- WHEN
describe_pullreads a proposal whoseWhyholdsorigin/<default>in a code span. - THEN The body holds
origin/<default>and the command prints no warning.
Requirement: Explicit why is unchanged
describe_pull SHALL keep an explicit why text as it is.
Scenario: Explicit why with a code span
- WHEN
describe_pullreceiveswhywithorigin/<default>in a code span. - THEN The body holds
origin/<default>unchanged.
Existing Tool Considered
No check has run. markdown-it-py parses Markdown code spans, but it supplies no sanitizer for Markdown source. It would add a dependency for one inline rule. The change builds a small backtick-run scanner: about 2,000 tokens to build, keep and fix it, and about 1 hour.
Key questions
- Does
proposal_whypass theWhytext throughsafe_text?: Yes.proposal_whycallssafe_text, andsafe_textcallssanitize_text. [sources: src/devops_cli/roadmap/pull_describe.py:159, src/devops_cli/roadmap/stage_change.py] - Which function should skip sanitizing inside a code span?:
sanitize_textinsrc/devops_cli/roadmap/refine.pyshould skip tag removal inside a code span. Every caller then gets the same safe rule. (best practice) [sources: src/devops_cli/roadmap/refine.py, src/devops_cli/roadmap/pull_describe.py:159, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/alternatives.py]- Chosen:
sanitize_text. It is the single sanitizer, so the rule protectssafe_text, refine and alternatives. - Rejected:
proposal_whyonly. It leaves the same defect in other callers ofsafe_textandsanitize_text. - Rejected:
safe_textonly. Refine and alternatives still remove tags inside code spans.
- Chosen:
- How should
sanitize_textfind the text of a code span?: It should scan runs of backticks. A run of N backticks opens a span, and the next run of N backticks closes it. It must sanitize only the text outside those spans. (best practice) [sources: openspec/changes/archive/2026-10-28-2478-refine-outside-author/design.md, src/devops_cli/roadmap/refine.py]- Chosen: Backtick-run scanner. It follows the GFM code span rule and adds no dependency.
- Rejected:
markdown-it-pytoken stream. It adds a parser dependency and a renderer for one inline rule. - Rejected: Regular expression for paired backticks. It mishandles a run of two or more backticks and text that holds a backtick.
- Should a tag outside a code span still be removed with no warning?: Yes. The change keeps the current sanitization outside code spans and adds no new warning. The defect is the removal inside a code span. (best practice) [sources: src/devops_cli/roadmap/refine.py, src/devops_cli/roadmap/pull_describe.py]
- Chosen: Keep current behavior outside code spans. It fixes the reported loss and keeps every existing caller's output.
- Rejected: Refuse text that holds a tag outside a code span. It changes behavior for every caller and needs a new error path.
- Rejected: Warn on each removed tag. It adds output to a command that prints only the title and body.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-07: partly.
Tool: markdown-it-py (https://pypi.org/project/markdown-it-py), MIT License, last activity 2026-05-07, maintained.
Activity
dan-petty commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(pr)scope of the title gives the scope.The command prints a wrong ref name with no warning, but only for code spans in the Why section.Users who read the pr describe output see a broken ref and may act on it.The cause is identified and the fix is to skip code spans in the sanitizing path.Both report sanitize_text dropping angle brackets inside code spans, but the candidate targets the pr describe command and #3504 targets the refine command.devops-cli-service commentedon Nov 6, 2026
Status set to Ready at ae881d6 (see proposed design in issue body).
devops-cli-service commentedon Nov 7, 2026
Alternatives check: partly
Reason: The web searches returned no provider answer, so the check rests on the package facts: markdown-it-py is an open, maintained Python Markdown parser that tokenizes inline code spans, which is the hard part of telling
origin/<default>inside backticks from a real HTML-like tag. It supplies no sanitizer for Markdown source, so the project would still need its own token walk and a new dependency for one inline rule, which is why the issue's design already weighed and set it aside; it therefore covers only the code-span detection part of the need, not the fix tosanitize_text/proposal_whyitself.Tool: markdown-it-py (https://pypi.org/project/markdown-it-py)
Covers:
Lacks:
sanitize_text,safe_textorproposal_why, which is where the reported loss happensTools considered:
Searches run:
Sources:
Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 12, 2026
Pull request #3711 (
396962e63, the fix of #3504) supersedes this issue. That pull request merged on 2026-11-06, after this issue was filed on origin/main66a8a63e.Since #3711,
sanitize_textchanges the<of a tag into<only outside code. A tag in a code span or a code block stays as it is.proposal_whycallssafe_text, andsafe_textcallssanitize_text, sodevops pr describegets the same rule.Evidence on origin/main
cc19a87a7:proposal_whyon a proposal whose sectionWhyholdsThe plan check lists the files of `origin/<default>`.returns that text unchanged.sanitize_text("<b>bold</b> and origin/<default>", set())returns<b>bold</b> and origin/<default>. A tag outside code shows as text, with all its words.sanitize_textkeeps the text of a code span as it is, also with a double backtick:Use ``origin/<default>`` herestays the same.tests/roadmap/refine/test_roadmap_refine_sanitize.py::test_sanitize_text_writes_the_code_in_the_models_text_as_it_iscovers a tag in a code span, in a code block and in a span with two backticks.openspec/specs/roadmap-refine/spec.mdholds the requirement "Refine shows a tag of the model's text as text".No change is necessary. I close this issue as not planned.