Repository navigation
Description
Problem or Motivation
A job record write joins the record that the issue holds at its GET (src/devops_cli/roadmap/stores/github_store.py:20-27). GitHub has no conditional write of an issue (github_store.py:24-25). The ADR 0002 guard compares field labels only (github_store.py:799-805); set_marks and write_issue_body have no guard (github_store.py:810-818,871-880).
The lock _JOB_RECORD_LOCK is per process (github_store.py:97). The runner Job and claims (src/devops_cli/roadmap/claim.py:120) write records outside it. So two writers can lose each other's marks today, and a lost mark raises nothing. More writers come when stage leaves the Service pod.
Proposed Solution & Architectural Design
- After each record
PATCH, read the record back. If a mark that this writer set is missing, write again, up to 2 times. Log and count each repair. - A third miss raises an error that names the item and the mark.
- A Valkey lock comes later ("feat(roadmap): keep plan records and record locks in Valkey"). It narrows the window, but this read-back repair stays the guard.
Target Subsystem
SDLC, Git & PR Governance (roadmap job records: src/devops_cli/roadmap/stores/github_store.py).
Existing Tool Considered
None covers it: GitHub gives no fence and no conditional write for an issue. A lock narrows the window but cannot close it. Cost: about 90,000 tokens and 4 hours to build, about 5,000 tokens a month to keep, about 10,000 tokens to fix. One more GET for each record write.
Acceptance Criteria
- A fail-to-pass test with two stores on one GitHub fake: each does its
GETbefore eitherPATCH; after both writes, the issue holds the marks of both (docs/TESTING.md; the fault mode ofInMemoryRoadmapStore). - A third miss raises with the item and the mark.
- The repair counter is in
/metricsand in the runner Job's OTLP export. - The pull request cites the
devops ci fail-to-pass --base <ref>output.
Dependencies
None.
Source: #4517
Proposed design
Problem statement
A job record write reads the issue, then sends one PATCH. GitHub has no conditional write of an issue. Two writers that read before either writes lose each other's marks, and the loss raises nothing. The change reads the record back after each PATCH, writes again when a mark is missing, and raises when the loss repeats.
Acceptance criteria
Requirement: A lost mark is repaired
A record write SHALL read the record back after its PATCH and write again when a mark that it set is missing.
Scenario: Two stores interleave one write
- WHEN Two stores on one GitHub fake each read the issue before either sends its
PATCH. - THEN The issue holds the marks of both writers after both writes.
Requirement: The repair stops after two rewrites
A record write SHALL send at most 2 rewrites after its first PATCH.
Scenario: A third miss
- WHEN The read-back shows the mark missing after the second rewrite.
- THEN The write raises an error that names the item and the missing mark.
Requirement: Each repair is logged and counted
Each repair SHALL write one log line and increment one counter.
Scenario: One repaired write
- WHEN One write repairs one missing mark.
- THEN The log holds one line for the repair and the counter rises by one.
Requirement: The repair counter is exported
The repair counter SHALL appear in /metrics and in the OTLP export of the runner Job.
Scenario: A repair in the runner Job
- WHEN The runner Job repairs one missing mark and exports its metrics.
- THEN
/metricsand the OTLP export each hold the counter with the value 1.
Requirement: A person's field change still raises
A field that a person changed since the read SHALL still raise RoadmapItemChangedError before any write.
Scenario: A person changes a field between the read and the write
- WHEN A person changes a field after the store reads the issue and before its
PATCH. - THEN The store raises
RoadmapItemChangedErrorand sends noPATCH.
Requirement: The repair test fails on the base
The new test SHALL fail on the base commit and pass on the head commit.
Scenario: Fail-to-pass replay
- WHEN The pull request runs
devops ci fail-to-pass --base <ref>. - THEN The output reports the new test as failed on the base and passed on the head.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers the need: GitHub offers no conditional write and no fence for an issue PATCH, and no library can add one. A lock narrows the window but cannot close it. The written cost is about 90,000 tokens and 4 hours to build, about 5,000 tokens a month to keep, and about 10,000 tokens to fix. It adds one GET for each record write.
Key questions
- Which guard keeps a parallel write from losing a mark?: Read the record back after each
PATCHand write again when a mark that the writer set is missing. The write fails after 2 rewrites. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py, openspec/changes/archive/2026-10-30-2757-implement-status-lane/design.md]- Chosen: Read-back repair. It needs no change at GitHub and it catches every loss that the next read sees.
- Rejected: A Valkey lock only. A lock narrows the window between two requests. It cannot close the window, so a lost mark stays possible.
- Rejected: A conditional write with an ETag. GitHub gives no conditional write for an issue
PATCH.
- How many rewrites does a write make before it fails?: Two rewrites. The third miss raises. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py]
- Chosen: 2 rewrites. Two writers lose one mark per round at most. Two rewrites settle that case, and a third miss shows a defect.
- Rejected: 1 rewrite. Three writers can lose the mark twice in a row.
- Rejected: No limit. A loop with no limit hides a mark that a writer can never set.
- Where does the repair live in the GitHub store?: One private helper sends the
PATCHand reads the record back.set_field,set_marksandwrite_issue_bodyeach call it inside_JOB_RECORD_LOCK. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py]- Chosen: One shared helper. The three write paths then take one guard, and a later path cannot skip it.
- Rejected: A guard in each of the three methods. Three copies of the loop drift, and a new write path gets no guard.
- Which marks does the read-back compare?: The record keys that this writer set in its
changes. A mark that another writer adds is no loss. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py]- Chosen: The keys of this writer. The writer can only report a mark that it set, and another writer's new mark is no loss.
- Rejected: The whole record. A parallel writer adds keys. The whole-record compare then reports a loss that did not occur.
- Which error does a third miss raise?: A new
DevOpsCLIErrorsubclass with its own exit code and error code, and a message that names the item and the mark. (best practice) [sources: docs/ERRORS.md, docs/TESTING.md, src/devops_cli/roadmap/stores/github_store.py]- Chosen: A new error subclass. A lost mark is no field change. A distinct class lets a caller tell the two cases apart.
- Rejected: Reuse
RoadmapItemChangedError. That error means a person changed a field. A retry of the same write cannot fix it, and a lost mark needs a different answer.
- Which test interleaves the two writers?: A test with two
GitHubRoadmapStoreinstances onGitHubFake. Each store reads the issue before either store sends itsPATCH. [sources: tests/support/fakes/github_repository.py, tests/roadmap/stores/test_roadmap_github_store_record_writes.py, docs/TESTING.md] - Which metric carries the repair count?: One counter
roadmap_record_repairs_totalwith the store method and the mark as labels. It joins the Service's Prometheus registry and the OTLP export of the runner Job. (best practice) [sources: docs/TELEMETRY.md]- Chosen: One counter with labels. The mark and the method are a closed set, so the label count stays small.
- Rejected: One counter for each mark. A new record key then needs a new metric, and a dashboard edit.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-12: none.
Tool: none found.
Owner decision 2026-11-13
D5 (approved) keeps the record as the hidden block in the issue body. The approved pipeline split (tracker #5482, Phase 0) adds these rules to the read-back repair:
-
One writer for each item at a time: the unit that holds the item, or the sweep when no unit holds it.
-
Before the end write, read the issue again. Stop when an actor other than the App changed
updated_atsince the last read. -
After the PATCH, compare the text outside the record with the text that was read. Restore a lost edit of a person, and count it in
devops_cli_roadmap_record_lost_edit_total. -
One end write for each unit, with all its keys.
-
A test: a person edit between the read and the PATCH is restored and counted.
-
Live proof: after the merge and the release, the Service and the Jobs write records as the App for 7 days. A comment gives the repair count and the lost-edit count. If the lost-edit count is above 0 after Phase 3, the owner looks again at D5 option (b): an App comment holds the record.
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.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.A silent mark loss corrupts job records, but it needs two writers in a narrow race window.Prevents silent data loss of marks that would mislead later jobs, but the trigger is a specific race.Requires a read-back loop, retry limit, error path, metrics counter, and a two-store fail-to-pass test.Both protect roadmap marks in github_store.py, but #4049 merges two sequential writes into one request while the candidate adds a read-back retry after a parallel write.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 5f75d25 (see proposed design in issue body).
devops-cli-service commentedon Nov 12, 2026
Alternatives check: none
Reason: The searches returned only general HTTP documentation on conditional requests and unrelated Python/Git pages; no open, maintained library provides a conditional or fenced write for a GitHub issue body, which is the need here. Preventing a lost mark therefore stays custom code in the GitHub store: read the record back after each
PATCH, rewrite up to 2 times, and raise on a third miss.Tool: none found
Lacks:
PATCHon GitHub; conditional requests only work where the server honoursIf-Match/ETag./metricsand the runner Job's OTLP export.Searches run:
Sources:
Checked on 2026-11-12. A person decides what this means for the item. The check changes no label and closes no issue.
feat(roadmap): run each stage item in its own Job (#5559)
devops-cli-service commentedon Nov 14, 2026
Released in v0.144.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.144.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 22:29 UTC