Repository navigation
Description
Problem
Area 7 of the parent item; do it last, after #6194, #6195 and the other area items merge. Job comments are posted from many call sites, each with its own marker and repeat rules, so a new duplicate can come back.
steps/comment.py:130post()reaches into private_writeand_roadmap(:80-100). The Jev note (watch_row.py:277,stage_ready.py:130,:173) has neither marker nor key, so it always posts new.fix_checks.py:527and:665share the check-name key and write over each other.comment_repeat.py:83looks only at the trailing run of job comments, and skips PR targets.CONST_ROADMAP_JOB_COMMENT_MARKERS(constants.py:4005) andCOMMENT_JOBS(comment_repeat.py:50) leave out fix-checks, pr_conflicts, plan drift, release, the implement run marker and the AI review marker. A release comment on a reopened item and a plan-drift comment posted under a person's token read as a person's comment.
Expected behavior
- One writer in the store, for example
RoadmapStore.job_comment(target, JobComment), for issue and PR targets. It writes the job marker and an exact hidden key line; it matches the key exactly. - Two kinds: STATE (one comment per job and key, edited in place) and EVENT (a new comment only when its facts, hashed with sorted order, differ from the last event of that job and key). Keep the hash in the hidden key line of the comment, not in the job record (no extra body PATCH, no race with other record writers).
- Key the implement stop and the stop-clear notes by Job (record
implement.job), so a person's "implement: retry" is used once and a retry cannot loop (implement.py:260,stop_clear.py:279-285,:375). - The fingerprint guard stays as a last guard and covers PR targets.
- One enum of comment jobs; derive both marker lists from it. Update every reader:
item_comments.HeldComment.by_person,trust.is_person_comment, refine_comments_without,stage_rejected.reason_comment,retitle.py:262_is_job_comment(so retitle never treats a person's rename as its own),repair.py:137_unanswered. - An AST invariant in
tests/invariants/test_architectural_invariants.pyfails when src callsstore.comment,comment_on_pull,create_issue_commentorupdate_issue_commentoutside the writer (allow list: person commands only), and when a<!-- devops roadmap ... -->literal is not in the registry. Move every call site:release_comments.py:113,return_item.py:72,stop_clear.py:375,stage/plan_drift.py:220,:268,steps/review.py:475,steps/open.py:284,implement/implement_submit.py:358,github/pr_evidence.py:126-128, and the rest. - A writer test: the same EVENT facts in another order post once, and a person's comment in between does not let the same event post again.
- The writer never drops or cuts text. A duplicate is a test failure, fixed in the builder at its source. Delete the dead code in
stage_ready.py.
Source: #6193
regression of #5025
Alternatives check of 2026-11-18: not-applicable.
Class: refactor, no search.
Tool: none found.
Proposed design
Problem statement
Job comments are posted from many call sites, each with its own marker and repeat rules. This lets duplicates return, lets two fix-check comments overwrite each other, and makes some job comments look like person comments. The change adds one store writer and one registry for job comments.
Acceptance criteria
Requirement: Single job-comment writer
RoadmapStore SHALL expose one job_comment method that writes a job comment for an issue target and for a pull request target.
Scenario: Issue and pull request targets use one writer
- WHEN a test calls
RoadmapStore.job_commentwith an issue target and with a pull request target - THEN the fake store records both comments through the writer and each body ends with the hidden key line from the registry
Requirement: STATE edits in place
A STATE job comment SHALL edit the one comment of its job and key in place, and SHALL create one only when none exists.
Scenario: Second STATE post edits the first
- WHEN a test posts a STATE job comment twice with the same job and key
- THEN the store holds one comment and its body is the second body
Requirement: Jobs do not overwrite each other
A STATE job comment SHALL keep a comment for each job even when two jobs use the same check name.
Scenario: Two jobs with one check-name key keep two comments
- WHEN a test posts STATE comments for two jobs with the same check-name key
- THEN the store holds two comments
Requirement: EVENT uses sorted-facts hash
An EVENT job comment SHALL post only when the sorted-facts SHA-256 differs from the hash in the last event of its job and key.
Scenario: Reordered facts post once
- WHEN a test posts an EVENT job comment with facts in one order and then with the same facts in another order
- THEN the store holds one event comment
Requirement: Person comment does not reset EVENT
EVENT deduplication SHALL ignore comments by persons between two events of the same job and key.
Scenario: A person comment does not let the same event post again
- WHEN a test posts an EVENT, adds a person comment, and posts the same EVENT facts again
- THEN the store holds one event comment and one person comment
Requirement: Implement stop keyed by Job
The implement stop and stop-clear notes SHALL use the implement.job record value as the job key.
Scenario: A retry uses the same job key
- WHEN a test runs a stop and then
implement: retrywithimplement.jobset - THEN the writer receives the same
implement.jobkey for the stop note and the stop-clear note
Requirement: One comment-job enum
The comment-job enum SHALL be the only source of the job markers and COMMENT_JOBS, and SHALL list every comment job.
Scenario: Every named job has one marker and one repeat rule
- WHEN a test builds the marker list and
COMMENT_JOBSfrom the enum for fix-checks, pr-conflicts, plan drift, release, implement run, and AI review - THEN each named job has one marker and one repeat rule, and a release comment on a reopened item and a plan-drift comment under a person token are job comments
Requirement: Architectural invariant
The architectural invariant SHALL fail on a direct store comment call outside the writer and on a roadmap marker literal outside the registry.
Scenario: Direct comment calls and stray markers fail
- WHEN the invariant runs on a fixture with a direct
store.commentcall and a<!-- devops roadmap ... -->literal - THEN the invariant reports both violations
Requirement: Readers use the registry
Every reader of job comments SHALL classify comments by the registry enum, so a person's comment is never a job comment.
Scenario: A person comment with marker-like prose is not a job comment
- WHEN a test gives each reader a person comment whose text contains a job marker in prose
- THEN each reader classifies the comment as a person's comment
Requirement: Writer preserves text
The job-comment writer SHALL write the full body text and SHALL not truncate or drop text.
Scenario: Long body is preserved
- WHEN a test posts a job comment whose body is longer than the old truncation limit
- THEN the stored body equals the input body
Existing Tool Considered
The alternatives check in the issue body gives verdict not-applicable (class refactor, no search) and names no tool. The change builds its own writer. Written cost: about 80,000 tokens to build, 15,000 tokens per year to keep and fix, and 5 working days.
Key questions
- Which component owns the job-comment write path?: Add
RoadmapStore.job_comment(target, JobComment)and move every call site to it. The method writes the marker and the hidden key line, and it matches the key exactly. (best practice) [sources: src/devops_cli/roadmap/stores/comment_repeat.py:50, src/devops_cli/config/constants.py:4019, src/devops_cli/roadmap/steps/comment.py:130]- Chosen: Central store writer. One writer holds the marker, key and repeat rules for issue and pull request targets.
- Rejected: Shared helper module. It still leaves many call sites and cannot enforce the store write path.
- Rejected: Keep the current call sites. The issue shows that separate call sites let duplicates and overwrites return.
- How does the writer deduplicate EVENT comments without a second record PATCH?: Store the SHA-256 of the facts in sorted order in the hidden key line of the last event comment. Read that line to compare. (best practice) [sources: src/devops_cli/roadmap/stores/comment_repeat.py:83, src/devops_cli/roadmap/stores/comment_repeat.py:50]
- Chosen: Hidden key line. The comment holds its own hash, so no record writer races another one.
- Rejected: Job record. It adds a body PATCH and races with other writers of the record.
- Rejected: No deduplication. The issue needs EVENT comments to post only when their facts differ.
- Which key do the implement stop and stop-clear notes use?: Use the
implement.jobrecord value as the key. A person'simplement: retryis used once, and a retry cannot loop. (best practice) [sources: src/devops_cli/roadmap/implement/implement.py:260]- Chosen:
implement.jobrecord value. It ties the note to one implement Job and makes a retry use the note once. - Rejected: Issue number. It does not separate two implement Jobs for the same item.
- Rejected: Comment text. It is not an exact key and can match a person's text.
- Chosen:
- How does the project keep direct job-comment calls and stray markers out of the source?: Add an AST invariant in
tests/invariants/test_architectural_invariants.py. It fails on direct store comment calls outside the writer and on roadmap marker literals outside the registry. (best practice) [sources: tests/invariants/test_architectural_invariants.py, src/devops_cli/roadmap/retitle.py:262, src/devops_cli/roadmap/refine/refine.py:2127]- Chosen: AST invariant. It reads the source and fails the build at the call site or the literal.
- Rejected: Code review only. A person can miss a new direct call or a copied marker.
- Rejected: Runtime check. It runs after the write and cannot stop the bad call from landing.
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 19, 2026
Status set to Ready at 4624bc7 (see proposed design in issue body).