diff --git a/.gh-dash.yml b/.gh-dash.yml index ee3871c335..326b08fb2a 100644 --- a/.gh-dash.yml +++ b/.gh-dash.yml @@ -27,7 +27,7 @@ prSections: issuesSections: # The first filter is the filter of the "Triage & Quality Table" view of the project board. - title: Triage and quality - filters: is:open label:status/triage,status/blocked,type/bug + filters: is:open label:status/new,status/blocked,type/bug - title: P0 and P1 filters: is:open label:priority/p0-critical,priority/p1-high - title: No milestone diff --git a/.github/labels.yml b/.github/labels.yml index ec27f83a6a..302e555ef1 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -91,10 +91,16 @@ color: "EDEDED" description: "A release pull request whose release release-please created" -# ── Status Labels ─────────────────────────────────────────────────────────── -- name: "status/triage" +# ── Roadmap Item Fields (ADR 0016) ────────────────────────────────────────── +# One label of each family holds a field of a roadmap item. A roadmap job that +# sets a field replaces each label of the family with the label of the value. +- name: "status/new" color: "EDEDED" - description: "New issue or PR awaiting technical triage and scoping" + description: "Status New: the item is not ready yet" + +- name: "status/ready" + color: "1D76DB" + description: "Status Ready: problem, acceptance criteria and an answer to each key question" - name: "status/in-progress" color: "BFDADC" @@ -108,9 +114,45 @@ color: "E11D21" description: "Execution blocked by external dependency or upstream review" -- name: "status/ready-to-merge" +- name: "priority/p0-critical" + color: "B60205" + description: "Urgent blockages, critical vulnerabilities, or release blockers" + +- name: "priority/p1-high" + color: "D93F0B" + description: "Priority P1: high-impact work for the next planned milestone" + +- name: "priority/p2-medium" + color: "FBCA04" + description: "Standard priority feature work and architectural improvements" + +- name: "priority/p3-low" color: "0E8A16" - description: "All quality gates passed and approved by maintainer for merge" + description: "Minor polish, low-severity improvements, and backlogged tasks" + +- name: "value/high" + color: "C2E0C6" + description: "Value High: the delivery of the item matters much" + +- name: "value/medium" + color: "FEF2C0" + description: "Value Medium" + +- name: "value/low" + color: "EDEDED" + description: "Value Low: the delivery of the item matters little" + +- name: "effort/high" + color: "F9D0C4" + description: "Effort High: much work, in one pull request" + +- name: "effort/medium" + color: "FEF2C0" + description: "Effort Medium" + +- name: "effort/low" + color: "C2E0C6" + description: "Effort Low: little work" # ── Roadmap Labels ────────────────────────────────────────────────────────── - name: "needs-split" diff --git a/.github/project-template.json b/.github/project-template.json index 9e26ebac28..9da7795e04 100644 --- a/.github/project-template.json +++ b/.github/project-template.json @@ -43,11 +43,6 @@ {"name": "Medium", "color": "YELLOW"}, {"name": "High", "color": "RED"} ] - }, - { - "name": "Job record", - "type": "text", - "description": "JSON the roadmap jobs write: the last value they set for each field (Status, Priority, Value, Effort). No view shows it." } ], "views": [ @@ -70,7 +65,7 @@ { "name": "Triage & Quality Table", "layout": "table", - "filter": "is:open label:status/triage,status/blocked,type/bug", + "filter": "is:open label:status/new,status/blocked,type/bug", "sort_by": [{"field": "Priority", "direction": "asc"}], "visible_fields": ["Title", "Status", "Priority", "Labels", "Assignees", "Updated"], "description": "Incoming issue and PR triage table prioritizing bugs and blockers." diff --git a/.github/roadmap.toml b/.github/roadmap.toml deleted file mode 100644 index 4730b0f1f1..0000000000 --- a/.github/roadmap.toml +++ /dev/null @@ -1,6 +0,0 @@ -# The roadmap jobs' settings for this repository (ADR 0001). Every runner reads this file -# through the GitHub contents API at one ref; `devops roadmap intake` and `refine` take it with -# `--ref`, which defaults to the default branch. - -# The project board (number) that holds the roadmap's Items. It has no default. -board = 12 diff --git a/AGENTS.md b/AGENTS.md index 87422eb7f7..1d2fe83567 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,7 @@ devops-cli is a Python command-line tool, `devops`, that automates workstation, 12. **Keep your own files out of git.** Put agent files under `.data/agent/` and scratch scripts under `.data/agent/scratch/`. Back up a file outside the workspace to `.bak-` before you edit it. Never change `config.yaml`. 13. **Run one `devops ai` call at a time,** and only when a file or a deterministic check cannot give the answer. -**Only a person** merges pull requests, records review verdicts, plans milestones, and changes secrets, repository settings and hosts. Intake sets the board's Priority field on a new issue, so set no milestone or priority on it. release-please makes every release from `main` and writes `CHANGELOG.md`, manifests and version lines, so nobody edits those by hand. Agents change the release workflow and its configuration through ordinary pull requests ([RELEASE_CYCLE.md](RELEASE_CYCLE.md)). +**Only a person** merges pull requests, records review verdicts, plans milestones, and changes secrets, repository settings and hosts. Intake sets the priority label of a new issue, so set no milestone or priority on it. release-please makes every release from `main` and writes `CHANGELOG.md`, manifests and version lines, so nobody edits those by hand. Agents change the release workflow and its configuration through ordinary pull requests ([RELEASE_CYCLE.md](RELEASE_CYCLE.md)). ## Where to look diff --git a/CONTEXT.md b/CONTEXT.md index 5fcf88303f..2fb4fd3d31 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -5,11 +5,11 @@ devops-cli automates DevOps work across the GitHub repositories it manages. This ## Planning and releases **Roadmap**: -The items on the project board, the milestones a person plans them into, and the backlog, taken together. +The items, the milestones a person plans them into, and the backlog, taken together. Labels and milestones on GitHub hold them (ADR 0016). _Avoid_: plan, board **Item**: -One unit of planned work on the roadmap, tracked as exactly one issue and delivered by exactly one pull request that delivers nothing else. An open issue becomes an item when intake places it on the roadmap. +One unit of planned work on the roadmap, tracked as exactly one issue and delivered by exactly one pull request that delivers nothing else. An open issue becomes an item when intake places it on the roadmap: an item is an issue with a `priority/*` label. One label family holds each of its Status, Priority, Value and Effort. _Avoid_: task, deliverable, card, ticket, work item, tracking issue **Change**: @@ -61,7 +61,7 @@ An item closed without being delivered. It stays on record so the same idea is r _Avoid_: rejected, won't fix, deferred **Milestone**: -A planning bucket that a person sets on the board, ordered by its due date. It never names a version, and no release reads it. +A planning bucket that a person sets on an issue, ordered by its due date. It never names a version, and no release reads it. _Avoid_: release, sprint **Backlog**: @@ -83,7 +83,7 @@ _Avoid_: cut PR, release branch ## Roadmap jobs **Candidate**: -Something that surfaced (from a person, a review of merged code, an agent or discovery) and may become an item. An open issue that intake has not yet placed on the roadmap, or whose card a person archived, is a candidate. +Something that surfaced (from a person, a review of merged code, an agent or discovery) and may become an item. An open issue with no `priority/*` label is a candidate: intake has not yet placed it on the roadmap, or a person took its priority off. _Avoid_: proposal, suggestion **Intake**: diff --git a/README.md b/README.md index 2236735545..bbb3c2c9fa 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Specialized personas available for interactive conversations via `devops ai chat ## Strategic Prioritization Matrix & Product Roadmap -The roadmap lives on GitHub: the issues are its items, the [project board](https://github.com/dan-petty/devops-cli/projects) holds their Status, Priority, Value and Effort, and a person plans them into milestones. The *Value vs Effort Priority Matrix* view of the board shows the prioritization matrix. [`docs/VISION.md`](docs/VISION.md) holds the principles and themes. +The roadmap lives on GitHub: the issues are its items, their labels hold their Status, Priority, Value and Effort (`status/*`, `priority/*`, `value/*`, `effort/*`, [ADR 0016](docs/adr/0016-labels-hold-the-roadmap-items-fields.md)), and a person plans them into milestones. No roadmap job reads or writes the [project board](https://github.com/dan-petty/devops-cli/projects); it is a view that filters by those labels and milestones. [`docs/VISION.md`](docs/VISION.md) holds the principles and themes. --- @@ -361,10 +361,10 @@ and excessive permissions fail it, and every other finding is shown. | | [**docs**](docs/commands/docs.md) | `devops docs generate [OPTIONS]` | Generate comprehensive Markdown or JSON documentation for all CLI commands and tools. | | | `devops docs check [OPTIONS]` | Check that generated documentation and README.md are up to date with codebase. | | | `devops docs sync-readme [OPTIONS]` | Synchronize the Complete Command Matrix table in README.md with live CLI commands. | -| [**roadmap**](docs/commands/roadmap.md) | `devops roadmap intake [OPTIONS]` | Turn candidates into items: every open issue not on the board, and every board item intake left without a Priority. The model compares each with the board's items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a priority, Value and Effort from the model with a reason comment, and goes to the backlog. Intake sets no milestone: a person plans the milestones on the board, and a milestone an issue has stays. An open issue whose board card a person archived is a candidate too: intake restores the card, which keeps its values and milestone; close the issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. | +| [**roadmap**](docs/commands/roadmap.md) | `devops roadmap intake [OPTIONS]` | Turn candidates into items: every open issue with no priority/* label. The model compares each with the items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a status/new label, Value and Effort labels and a reason comment, then its priority label last, and goes to the backlog. A label a person set stays. Intake sets no milestone: a person plans the milestones, and a milestone an issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. | | | `devops roadmap refine [OPTIONS]` | Refine roadmap items to Ready with proposed design, tasks, and acceptance criteria, using code, documentation, and external research. Without --item, refine takes items nearest place first: each open milestone's New items, by due date and then by number, then the backlog's P0 and P1 items, then the backlog's other New items, each place by priority. Only --limit stops a run. The number of Ready items does not stop it. In each open milestone and among the backlog's P0 and P1 items it also takes Ready items it has no record of, and sets one back to New when it finds it not ready. An item refine cannot set to Ready gets one comment with its next step. The step is the questions a person answers, the split a person makes, or the open items it waits on. Refine looks at the item again after a reply, a body edit or the close of those items, or after a commit on the default branch changes a file that the block cites. The report groups every item by its next step. An item whose model call fails is skipped and reported; the others are still refined, and refine then exits 1. | | | `devops roadmap run [OPTIONS]` | Run the roadmap jobs that are due, in order: metrics, then intake and refine, and record each one's last success. Intake is due on an issue reopened, and decides at most 5 candidates a run and keeps a record of those it left beside the schedule; refine is due every hour, on a first run, and after an intake that placed a critical fix or a P0 item. Without --confirm, or with --dry-run, prints the due list and runs nothing. | -| | `devops roadmap return [OPTIONS] ` | Return an item to New on the roadmap board with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope. | +| | `devops roadmap return [OPTIONS] ` | Return an item to New with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope. The item gets the label status/new in place of its other status/* label. | | [**pr**](docs/commands/pr.md) | `devops pr list [OPTIONS]` | List pull requests with base targeting and review status. | | | `devops pr view [OPTIONS] ` | View details of a pull request. | | | `devops pr checks [OPTIONS] ` | Check remote CI quality gate status on a pull request. | @@ -382,7 +382,7 @@ and excessive permissions fail it, and every other finding is shown. | | [**gh**](docs/commands/gh.md) | `devops gh api [OPTIONS] ` | Execute a GitHub API request with quota-derived spacing, rate-limit backoff, and optional caching. | | | `devops gh rate-limit [OPTIONS]` | Display GitHub REST and GraphQL API rate limits, quotas, and reset countdowns. | | | `devops gh status [OPTIONS]` | Display GitHub published operational status, key components, and active incidents. | -| | `devops gh metrics [OPTIONS]` | Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and project board items. | +| | `devops gh metrics [OPTIONS]` | Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and roadmap Items. | | | `devops gh labels COMMAND [ARGS]...` | GitHub Views, Projects, Issues, Pages, Milestones, and Labels automation. | | | `devops gh milestones COMMAND [ARGS]...` | GitHub Views, Projects, Issues, Pages, Milestones, and Labels automation. | | | `devops gh project COMMAND [ARGS]...` | GitHub Views, Projects, Issues, Pages, Milestones, and Labels automation. | diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md index 8f34d82296..306e2bd909 100644 --- a/docs/CLI_REFERENCE.md +++ b/docs/CLI_REFERENCE.md @@ -25,7 +25,7 @@ Complete command-line reference for `devops-cli`, automatically generated from C - [`devops review`](#devops-review) — AI-powered code review and security audits. - [`devops mcp`](#devops-mcp) — FastMCP server and Model Context Protocol integrations. - [`devops docs`](#devops-docs) — Generate and validate CLI and architecture documentation. -- [`devops roadmap`](#devops-roadmap) — Read and write the roadmap on GitHub, its source of truth: issues, milestones and the project board. +- [`devops roadmap`](#devops-roadmap) — Read and write the roadmap on GitHub, its source of truth: issues, their labels and milestones. - [`devops pr`](#devops-pr) — GitHub Pull Request workflows and reviews. - [`devops gh`](#devops-gh) — GitHub Views, Projects, Issues, Pages, Milestones, and Labels automation. - [`devops tf`](#devops-tf) — OpenTofu and Terraform Infrastructure-as-Code operations. @@ -6214,11 +6214,11 @@ devops docs sync-readme [OPTIONS] ## devops roadmap -Read and write the roadmap on GitHub, its source of truth: issues, milestones and the project board. +Read and write the roadmap on GitHub, its source of truth: issues, their labels and milestones. ### `devops roadmap intake` -**Turn candidates into items: every open issue not on the board, and every board item intake left without a Priority. The model compares each with the board's items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a priority, Value and Effort from the model with a reason comment, and goes to the backlog. Intake sets no milestone: a person plans the milestones on the board, and a milestone an issue has stays. An open issue whose board card a person archived is a candidate too: intake restores the card, which keeps its values and milestone; close the issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes.** +**Turn candidates into items: every open issue with no priority/* label. The model compares each with the items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a status/new label, Value and Effort labels and a reason comment, then its priority label last, and goes to the backlog. A label a person set stays. Intake sets no milestone: a person plans the milestones, and a milestone an issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes.** ```bash devops roadmap intake [OPTIONS] @@ -6229,7 +6229,7 @@ devops roadmap intake [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | +| `--ref` | `string` | - | Branch, tag or commit to read .github/labels.yml at (default: the repository's default branch). | | `--issue` | `integer` | - | Only this issue (repeatable). | | `--title` | `string` | - | Title of a candidate that is not an issue yet; intake files it, and names a possible duplicate for a person to close. Needs --body-file. | | `--body-file` | `path` | - | File holding the new candidate's body. Needs --title. | @@ -6253,7 +6253,6 @@ devops roadmap refine [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--source` | `path` | `.` | Path to the repository checkout (defaults to current directory). | | `--item` | `integer` | - | Specific issue number to refine instead of selecting by priority. Refine refines it when it is open and New or Ready, even when nothing changed since its last round. | | `--limit` | `integer` | `3` | Maximum number of items to refine in this run (default 3). | @@ -6273,13 +6272,12 @@ devops roadmap run [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--dry-run` | `boolean` | - | Make no request: print the due list of jobs and the reason each is due, and run nothing. | | `--confirm` | `boolean` | - | Execute the due roadmap jobs. Without it, run prints the due list only. | ### `devops roadmap return` -**Return an item to New on the roadmap board with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope.** +**Return an item to New with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope. The item gets the label status/new in place of its other status/* label.** ```bash devops roadmap return [OPTIONS] @@ -6298,9 +6296,8 @@ devops roadmap return [OPTIONS] | `--comment`, `-c` | `string` | `` | Evidence comment explaining why the item cannot be built as specified. | | `--comment-file` | `path` | - | Path to file containing the evidence comment. | | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--dry-run` | `boolean` | - | Make no request: print the requests a run makes, in order, with placeholders for values a read gives. | -| `--confirm` | `boolean` | - | Make the writes to GitHub (post comment and set Status to New). | +| `--confirm` | `boolean` | - | Make the writes to GitHub: post the comment and set the Status to New (status/new). | --- @@ -6532,8 +6529,8 @@ devops pr close [OPTIONS] Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. -It closes exactly one issue, an open issue of its own repository that is on the roadmap -board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR +It closes exactly one issue, an open issue of its own repository that holds a priority/* +label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. @@ -6763,7 +6760,7 @@ devops gh status [OPTIONS] ### `devops gh metrics` -**Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and project board items.** +**Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and roadmap Items.** ```bash devops gh metrics [OPTIONS] @@ -6938,7 +6935,7 @@ devops gh project status [OPTIONS] #### `devops gh project sync` -**Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board: devops roadmap intake places issues, and a pull request's progress shows on its issue's card. Exits 1 when reconcile stops early.** +**Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board, and a pull request's progress shows on its issue's card. No roadmap job reads the board: labels hold an item's fields. Exits 1 when reconcile stops early.** ```bash devops gh project sync [OPTIONS] @@ -7248,7 +7245,7 @@ devops gh issues create [OPTIONS] #### `devops gh issues triage` -**Audit open issues for mandatory taxonomy labels, and report those not on the roadmap board as awaiting intake.** +**Audit open issues for mandatory taxonomy labels, and report those with no priority/* label as awaiting intake.** ```bash devops gh issues triage [OPTIONS] @@ -7658,8 +7655,8 @@ devops gh pr close [OPTIONS] Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. -It closes exactly one issue, an open issue of its own repository that is on the roadmap -board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR +It closes exactly one issue, an open issue of its own repository that holds a priority/* +label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. diff --git a/docs/ERRORS.md b/docs/ERRORS.md index 69e8dfb386..c4c9d2580c 100644 --- a/docs/ERRORS.md +++ b/docs/ERRORS.md @@ -90,8 +90,8 @@ The Exit Code column is the exception's `exit_code` attribute. Only `devops clou | `ReviewPoolError` | `REVIEW_POOL_ERROR` | `1` | Ai | Raised when an error occurs during parallel review worker pool execution. | | `ReviewSessionExistsError` | `REVIEW_SESSION_EXISTS` | `1` | Ai | Raised when a review is published under the name of a session that is already published. | | `ReviewStateError` | `REVIEW_STATE_ERROR` | `1` | Devops_cli.review.state | Exception raised for invalid review finding state or state transition. | -| `RoadmapCardChangedError` | `ROADMAP_CARD_CHANGED` | `1` | Roadmap | Raised before a job's board write that would revert a change made since it read the card. | | `RoadmapIntakeError` | `ROADMAP_INTAKE_FAILED` | `1` | Roadmap | Raised after an intake round in which the writes failed for one or more candidates. | +| `RoadmapItemChangedError` | `ROADMAP_ITEM_CHANGED` | `1` | Roadmap | Raised before a job's field write that would revert a change made since it read the Item. | | `RoadmapRefineError` | `ROADMAP_REFINE_FAILED` | `1` | Roadmap | Raised after a refine run in which the model call failed for one or more items. | | `RoadmapRunError` | `DEVOPS_CLI_ERROR` | `1` | Roadmap | Raised when one or more roadmap jobs fail during execution. | | `RunIndexNotConfiguredError` | `DEVOPS_CLI_ERROR` | `1` | Devops_cli.ai.run_store | No shared run index is configured. | diff --git a/docs/MCP_TOOLS.md b/docs/MCP_TOOLS.md index 41d3c38a10..664dc1bab1 100644 --- a/docs/MCP_TOOLS.md +++ b/docs/MCP_TOOLS.md @@ -49,7 +49,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili | [`gh_issues_edit`](#gh-issues-edit) | `false` | Edit an existing issue title, body, state, milestone, or taxonomy labels. | | [`gh_issues_list`](#gh-issues-list) | `true` | List repository issues with milestone, taxonomy labels, and status. | | [`gh_issues_status`](#gh-issues-status) | `true` | Display aggregated issue counts by priority, type, and milestone. | -| [`gh_issues_triage`](#gh-issues-triage) | `true` | Audit open issues for mandatory taxonomy labels, and report those not on the roadmap board as awaiting intake. | +| [`gh_issues_triage`](#gh-issues-triage) | `true` | Audit open issues for mandatory taxonomy labels, and report those with no priority/* label as awaiting intake. | | [`gh_issues_view`](#gh-issues-view) | `true` | Print one issue with its state, milestone, labels, assignees, dates and full body. | | [`gh_labels_list`](#gh-labels-list) | `true` | List all labels defined in the remote repository. | | [`gh_labels_sync`](#gh-labels-sync) | `false` | Synchronize repository labels against the declarative YAML schema. | @@ -63,7 +63,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili | [`gh_project_list`](#gh-project-list) | `true` | List available GitHub Projects v2 boards for user or organization. | | [`gh_project_reconcile`](#gh-project-reconcile) | `false` | Reconcile Status and Priority on the cards already on the board, listing each change and its source; the board owns Status, and reconcile never writes Milestone, Value or Effort or adds a card. A planned value the board's field has no option for is refused before any write. A run that stops early (mutation budget, GraphQL quota or a failed write) says why and how many planned changes remain, and exits 1. Running it again continues from there: after the reset when the quota stopped it, and once the cause is fixed when a write failed. | | [`gh_project_status`](#gh-project-status) | `true` | Inspect the declarative GitHub Projects v2 template structure and views. | -| [`gh_project_sync`](#gh-project-sync) | `false` | Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board: devops roadmap intake places issues, and a pull request's progress shows on its issue's card. Exits 1 when reconcile stops early. | +| [`gh_project_sync`](#gh-project-sync) | `false` | Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board, and a pull request's progress shows on its issue's card. No roadmap job reads the board: labels hold an item's fields. Exits 1 when reconcile stops early. | | [`gh_rate_limit`](#gh-rate-limit) | `true` | Display GitHub REST and GraphQL API rate limits, quotas, and reset countdowns. | | [`gh_runs_list`](#gh-runs-list) | `true` | List recent workflow runs for the repository or branch. | | [`gh_runs_view`](#gh-runs-view) | `true` | View details and failure logs of a specific workflow run. | @@ -88,7 +88,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili | [`k8s_teardown_stack`](#k8s-teardown-stack) | `false` | Uninstall the k8s infrastructure / LLM stack and delete namespaces. | | [`k8s_tempo_info`](#k8s-tempo-info) | `true` | Retrieve Tempo distributed tracing HTTP API URL and OTLP trace endpoints. | | [`k8s_validate`](#k8s-validate) | `true` | Validate Kubernetes YAML manifests against OpenAPI schemas using Kubeconform. | -| [`pr_check_readiness`](#pr-check-readiness) | `true` | Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. It closes exactly one issue, an open issue of its own repository that is on the roadmap board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. | +| [`pr_check_readiness`](#pr-check-readiness) | `true` | Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. It closes exactly one issue, an open issue of its own repository that holds a priority/* label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. | | [`pr_checks`](#pr-checks) | `true` | Check remote CI quality gate status on a pull request. | | [`pr_close`](#pr-close) | `false` | Close a pull request. | | [`pr_diff`](#pr-diff) | `true` | View diff of a pull request. | @@ -109,7 +109,7 @@ The `devops-cli` FastMCP server exposes DevOps automation and AI review capabili | [`review_path`](#review-path) | `true` | Review source files directly (no git required). | | [`review_pr`](#review-pr) | `false` | Review a GitHub pull request. | | [`review_stats`](#review-stats) | `true` | Compute and display review accuracy statistics across saved sessions. | -| [`roadmap_intake`](#roadmap-intake) | `false` | Turn candidates into items: every open issue not on the board, and every board item intake left without a Priority. The model compares each with the board's items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a priority, Value and Effort from the model with a reason comment, and goes to the backlog. Intake sets no milestone: a person plans the milestones on the board, and a milestone an issue has stays. An open issue whose board card a person archived is a candidate too: intake restores the card, which keeps its values and milestone; close the issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. | +| [`roadmap_intake`](#roadmap-intake) | `false` | Turn candidates into items: every open issue with no priority/* label. The model compares each with the items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a status/new label, Value and Effort labels and a reason comment, then its priority label last, and goes to the backlog. A label a person set stays. Intake sets no milestone: a person plans the milestones, and a milestone an issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. | | [`roadmap_refine`](#roadmap-refine) | `true` | Refine roadmap items to Ready with proposed design, tasks, and acceptance criteria, using code, documentation, and external research. Without --item, refine takes items nearest place first: each open milestone's New items, by due date and then by number, then the backlog's P0 and P1 items, then the backlog's other New items, each place by priority. Only --limit stops a run. The number of Ready items does not stop it. In each open milestone and among the backlog's P0 and P1 items it also takes Ready items it has no record of, and sets one back to New when it finds it not ready. An item refine cannot set to Ready gets one comment with its next step. The step is the questions a person answers, the split a person makes, or the open items it waits on. Refine looks at the item again after a reply, a body edit or the close of those items, or after a commit on the default branch changes a file that the block cites. The report groups every item by its next step. An item whose model call fails is skipped and reported; the others are still refined, and refine then exits 1. | | [`roadmap_run`](#roadmap-run) | `true` | Run the roadmap jobs that are due, in order: metrics, then intake and refine, and record each one's last success. Intake is due on an issue reopened, and decides at most 5 candidates a run and keeps a record of those it left beside the schedule; refine is due every hour, on a first run, and after an intake that placed a critical fix or a P0 item. Without --confirm, or with --dry-run, prints the due list and runs nothing. | | [`sandbox_deploy`](#sandbox-deploy) | `false` | Deploy an isolated background container sandbox with security containment. | @@ -841,7 +841,7 @@ Display aggregated issue counts by priority, type, and milestone. ### `gh_issues_triage` -Audit open issues for mandatory taxonomy labels, and report those not on the roadmap board as awaiting intake. +Audit open issues for mandatory taxonomy labels, and report those with no priority/* label as awaiting intake. **Annotations:** `readOnlyHint: true` @@ -1024,7 +1024,7 @@ Inspect the declarative GitHub Projects v2 template structure and views. ### `gh_project_sync` -Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board: devops roadmap intake places issues, and a pull request's progress shows on its issue's card. Exits 1 when reconcile stops early. +Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board, and a pull request's progress shows on its issue's card. No roadmap job reads the board: labels hold an item's fields. Exits 1 when reconcile stops early. **Annotations:** `readOnlyHint: false` @@ -1415,8 +1415,8 @@ Validate Kubernetes YAML manifests against OpenAPI schemas using Kubeconform. Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. -It closes exactly one issue, an open issue of its own repository that is on the roadmap -board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR +It closes exactly one issue, an open issue of its own repository that holds a priority/* +label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. @@ -1800,7 +1800,7 @@ Compute and display review accuracy statistics across saved sessions. ### `roadmap_intake` -Turn candidates into items: every open issue not on the board, and every board item intake left without a Priority. The model compares each with the board's items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a priority, Value and Effort from the model with a reason comment, and goes to the backlog. Intake sets no milestone: a person plans the milestones on the board, and a milestone an issue has stays. An open issue whose board card a person archived is a candidate too: intake restores the card, which keeps its values and milestone; close the issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. +Turn candidates into items: every open issue with no priority/* label. The model compares each with the items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a status/new label, Value and Effort labels and a reason comment, then its priority label last, and goes to the backlog. A label a person set stays. Intake sets no milestone: a person plans the milestones, and a milestone an issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes. **Annotations:** `readOnlyHint: false` @@ -1809,7 +1809,7 @@ Turn candidates into items: every open issue not on the board, and every board i | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | `repo` | `string` | No | - | Repository as owner/name (default: this checkout's origin). | -| `ref` | `string` | No | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | +| `ref` | `string` | No | - | Branch, tag or commit to read .github/labels.yml at (default: the repository's default branch). | | `issue` | `array[integer]` | No | - | Only this issue (repeatable). | | `title` | `string` | No | - | Title of a candidate that is not an issue yet; intake files it, and names a possible duplicate for a person to close. Needs --body-file. | | `body_file` | `string` | No | - | File holding the new candidate's body. Needs --title. | @@ -1831,7 +1831,6 @@ Refine roadmap items to Ready with proposed design, tasks, and acceptance criter | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | `repo` | `string` | No | - | Repository as owner/name (default: this checkout's origin). | -| `ref` | `string` | No | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `source` | `string` | No | `.` | Path to the repository checkout (defaults to current directory). | | `item` | `integer` | No | - | Specific issue number to refine instead of selecting by priority. Refine refines it when it is open and New or Ready, even when nothing changed since its last round. | | `limit` | `integer` | No | `3` | Maximum number of items to refine in this run (default 3). | @@ -1849,7 +1848,6 @@ Run the roadmap jobs that are due, in order: metrics, then intake and refine, an | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | `repo` | `string` | No | - | Repository as owner/name (default: this checkout's origin). | -| `ref` | `string` | No | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `dry_run` | `boolean` | No | `False` | Make no request: print the due list of jobs and the reason each is due, and run nothing. | | `confirm` | `boolean` | No | `False` | Execute the due roadmap jobs. Without it, run prints the due list only. | diff --git a/docs/ROUTINE_TASKS.md b/docs/ROUTINE_TASKS.md index 0740b972c0..f52fa58e97 100644 --- a/docs/ROUTINE_TASKS.md +++ b/docs/ROUTINE_TASKS.md @@ -12,7 +12,7 @@ All routine operations in `devops-cli` adhere to six core engineering tenets: 3. **Strict Quality Assurance**: Changes must pass every check that `devops ci` runs before merging ([`SDLC.md`](SDLC.md), Phase 4, lists them). 4. **Target Branch & Non-Merge Policy**: Every topic PR targets `main`. Direct pushes to `main` are blocked. AI agents stage commits and open/update PRs, while PR merge actions are strictly reserved for human maintainers. 5. **Dynamic Documentation Freshness**: Command matrices, CLI reference guides, and FastMCP schemas are generated dynamically through code introspection (`devops docs generate`) and verified in CI (`devops docs check`). -6. **Mandatory Defect Incident Tracking (Zero Unrecorded CLI Errors/Warnings)**: Whenever a CLI command produces an unhandled error, subcommand failure, crash, diagnostic warning, or unexpected behavior, agents and maintainers must promptly file it as a candidate (`devops roadmap intake --title "fix(): …" --body-file --confirm`), in the shape of the standardized bug report template. Intake checks it for a duplicate, labels its type, puts it on the board with its Priority and puts it in the backlog; nobody sets a milestone or priority on the new issue by hand. +6. **Mandatory Defect Incident Tracking (Zero Unrecorded CLI Errors/Warnings)**: Whenever a CLI command produces an unhandled error, subcommand failure, crash, diagnostic warning, or unexpected behavior, agents and maintainers must promptly file it as a candidate (`devops roadmap intake --title "fix(): …" --body-file --confirm`), in the shape of the standardized bug report template. Intake checks it for a duplicate, labels its type, Status, Value, Effort and Priority, and puts it in the backlog; nobody sets a milestone or priority on the new issue by hand. --- @@ -23,7 +23,7 @@ The following matrix categorizes all project routine tasks by operational layer, | Operational Cadence | Routine Task | Sequence Order | Primary Command(s) | Methodology & Scope | Success Verification Gate | | :--- | :--- | :--- | :--- | :--- | :--- | -| **Inner Loop (Daily / Per Edit)** | Task Grounding | Step 1 | `devops gh project audit` && `devops roadmap intake` | Query project tracking, and verify the issue's card or file the work through intake | Task grounded in an open issue on the board | +| **Inner Loop (Daily / Per Edit)** | Task Grounding | Step 1 | `devops gh project audit` && `devops roadmap intake` | Query project tracking, and verify the issue's labels or file the work through intake | Task grounded in an open issue with a `priority/*` label | | **Inner Loop (Daily / Per Edit)** | Dependency Synchronization | Step 2 | `uv sync` | Synchronizes virtual environment with `uv.lock` | Clean exit; all dependencies resolved | | **Inner Loop (Daily / Per Edit)** | Constant & Config Centralization | Step 3 | Manual / Refactor | Centralize literals in `constants.py`, `defaults.py`, `lang/en/` | No hardcoded string literals in command code | | **Inner Loop (Daily / Per Edit)** | Targeted Linting & Formatting | Step 4 | `uv run ruff check --fix ` | Fast focused linting on modified files | `ruff check` reports 0 errors | @@ -51,7 +51,7 @@ The following matrix categorizes all project routine tasks by operational layer, | **Workspace & Sync** | DevContainer Lifecycle Hooks | Daily / On Start | `devops devcontainer run-lifecycle --post-start` | Cross-platform container initialization tasks | All lifecycle tasks complete successfully | | **Workspace & Sync** | Multi-Repo Synchronization | Daily / On Demand | `devops repos sync` / `devops repos list` | Pulls upstream changes across all managed repos | All repositories up to date | | **Workspace & Sync** | GitHub Pages Publishing & Readiness Audit | Pre-PR | `devops gh pages status` / `devops gh pages verify` | Inspects live publishing health, HTTPS enforcement, and validates `docs/_config.yml`, the site settings that the Pages build reads, and `docs/` | Clean verification; HTTPS strictly enforced | -| **Workspace & Sync** | GitHub Issues Lifecycle & Triage Audit | Daily / Pre-PR | `devops gh issues triage` / `devops gh issues status` | Audits open issues for mandatory taxonomy labels (`type/*`, `scope/*`) and the board's Priority field, and reports those not on the board as awaiting intake | Zero untriaged open issues; `devops roadmap intake` clears those awaiting intake | +| **Workspace & Sync** | GitHub Issues Lifecycle & Triage Audit | Daily / Pre-PR | `devops gh issues triage` / `devops gh issues status` | Audits open issues for mandatory taxonomy labels (`type/*`, `scope/*`) and a `priority/*` label, and reports those with no `priority/*` label as awaiting intake | Zero untriaged open issues; `devops roadmap intake` clears those awaiting intake | | **Workspace & Sync** | GitHub Projects & Issues Views Sync & Audit | On Demand / Pre-PR | `devops gh project sync` / `devops gh project audit` / `devops gh views audit` | Provisions and links the board, reconciles card fields, and audits the 4 declarative project views | All projects and views populated with zero drift or empty state (`projects` & `issues/views`) | | **Workspace & Sync** | SSH Keys & Host Audit | On Demand | `devops ssh status` / `devops ssh audit` | Validates ED25519 keys, permissions, and GitHub keys | No keys past rotation_days | @@ -79,10 +79,10 @@ flowchart TD #### Step-by-Step Order: 1. **GitHub Project Bootstrap, Issue Grounding & Task State Setup**: - **Inspect Project Status**: Inspect the project template via `devops gh project status` and the live board via `devops gh project audit` (or FastMCP `gh_project_status`) and triage queue via `devops gh issues triage` (or FastMCP `gh_issues_triage`). - - **Ground Requirement in GitHub Issue Card**: Every feature, bug fix, or refactor must map to an active tracking issue and project item. - - If a matching issue card exists: link task to it and verify taxonomy labels. `devops gh project sync` sets its card to In Progress once a draft PR is open. - - Without a matching issue: **FILE THE TASK AS A CANDIDATE** (`devops roadmap intake --title "" --body-file --confirm` or FastMCP `roadmap_intake` with `mode="confirm"`). Intake files it (a possible duplicate too, which its reason comment names for a person to close), puts it on the board and gives it its type, Priority, Value and Effort, and puts it in the backlog; set no milestone or priority on it yourself. - - Plan the item as an OpenSpec change, `openspec/changes/-/` ([`openspec/config.yaml`](../openspec/config.yaml)). The board holds the Status of the item, and the change folder holds none. + - **Ground Requirement in a GitHub Issue**: Every feature, bug fix, or refactor must map to an open issue that is a roadmap item: it holds a `priority/*` label. + - If a matching issue exists: link task to it and verify taxonomy labels. `devops gh project sync` sets its card to In Progress once a draft PR is open. + - Without a matching issue: **FILE THE TASK AS A CANDIDATE** (`devops roadmap intake --title "" --body-file --confirm` or FastMCP `roadmap_intake` with `mode="confirm"`). Intake files it (a possible duplicate too, which its reason comment names for a person to close), labels its type, Status, Priority, Value and Effort, and puts it in the backlog; set no milestone or priority on it yourself. + - Plan the item as an OpenSpec change, `openspec/changes/-/` ([`openspec/config.yaml`](../openspec/config.yaml)). The labels of the issue hold the Status of the item, and the change folder holds none. 2. **Sync Dependencies (`uv sync`)**: Always ensure `.venv` is aligned with `uv.lock` before starting work. 3. **Centralize Constants, Config & Defaults**: - Put configuration options and environment variable schemas in [`src/devops_cli/config/settings.py`](../src/devops_cli/config/settings.py). @@ -139,7 +139,7 @@ Executed at the final stage of work after all iterative feature modifications an - Verify absence of performance bottlenecks, resource leaks, configuration warnings, or suppressed exceptions. 4. **Validate GitHub Governance, Pages Readiness & Issues Triage**: - Verify the syntax and the required keys of `docs/_config.yml`, the one file of site settings that the Pages build reads, and the `docs/` publishing root, with `devops gh pages verify`. - - Audit open issues for mandatory taxonomy labels (`type/*`, `scope/*`) and the board's Priority field via `devops gh issues triage`, and run `devops roadmap intake` for those it reports as awaiting intake. + - Audit open issues for mandatory taxonomy labels (`type/*`, `scope/*`) and a `priority/*` label via `devops gh issues triage`, and run `devops roadmap intake` for those it reports as awaiting intake. - Inspect issue portfolio distribution via `devops gh issues status`. - Validate remote project views template compliance via `devops gh views audit`. @@ -215,8 +215,8 @@ sequenceDiagram - **No Standalone Tracking Commits**: A change to the change folder of an item goes into the pull request that delivers the item. A tick goes into the commit that completes its task, and the archive goes into the last commit. - **Issue Linkage, GitHub Projects & Issues Views Lifecycle (`https://github.com/dan-petty/devops-cli/projects` & `https://github.com/dan-petty/devops-cli/issues/views`)**: - **Zero Disconnected PRs**: Every PR closes exactly one open issue with a canonical closing keyword (`Fixes #`, `Closes #`, `Resolves #`), archives that issue's OpenSpec change (`openspec/changes/archive/--/`), and has taxonomy labels (`type/*`, `scope/*`). GitHub closes the issue when the PR merges into `main`. A PR gets no card: its progress shows on its issue's card. - - **Automated Field Sync & State Progression**: Run `devops gh project sync` (or FastMCP `gh_project_sync`) after opening or updating PRs to reconcile `Status` on the cards already on the board. The board's built-in `Pull request linked to issue` workflow moves the issue's card to `In Review` when a PR that closes it opens. The board mirrors the milestone that a person sets, and `Value` and `Effort` are set by hand. - - Verify that the board follows `.github/project-template.json` across the 4 canonical views (*Sprint Kanban*, *Roadmap Timeline*, *Triage & Quality Table*, *Value vs Effort Priority Matrix*) displayed under `https://github.com/dan-petty/devops-cli/issues/views`. The board, not a change folder, holds the Status of each item. + - **Automated Field Sync & State Progression**: Run `devops gh project sync` (or FastMCP `gh_project_sync`) after opening or updating PRs to reconcile `Status` on the cards already on the board. The board's built-in `Pull request linked to issue` workflow moves the issue's card to `In Review` when a PR that closes it opens. The board mirrors the milestone that a person sets. No roadmap job reads or writes the board: the labels of each issue hold its Status, Priority, Value and Effort (ADR 0016), and the board's views filter by them. + - Verify that the board follows `.github/project-template.json` across the 4 canonical views (*Sprint Kanban*, *Roadmap Timeline*, *Triage & Quality Table*, *Value vs Effort Priority Matrix*) displayed under `https://github.com/dan-petty/devops-cli/issues/views`. The labels of the issue, not a change folder, hold the Status of each item. - Ensure the project board is linked to the repository via `devops gh project link ` so it appears on `https://github.com/dan-petty/devops-cli/projects` and its views on `https://github.com/dan-petty/devops-cli/issues/views`. Audit views via `devops gh views list`, `devops gh views audit`, and `devops gh views spec`. - Enforce taxonomy labels via `devops gh labels audit`, and inspect milestone progress via `devops gh milestones list`. GitHub is the roadmap's source (ADR 0001), and a milestone is a planning bucket that never names a version. @@ -312,7 +312,7 @@ Executed on workspace initialization (DevContainer startup) or on-demand. - **Frequency**: Pre-PR or On-Demand. - **Methodology**: - Validates GitHub Pages deployment health and verifies local publishing assets (`docs/_config.yml` and `docs/`). - - Audits live open issues for missing taxonomy labels (`type/*`, `scope/*`) or the board's Priority field. + - Audits live open issues for missing taxonomy labels (`type/*`, `scope/*`) or a missing `priority/*` label. - Audits remote GitHub Projects v2 boards and views against `.github/project-template.json` to prevent configuration drift. - **Commands**: ```bash diff --git a/docs/SDLC.md b/docs/SDLC.md index d856b3216a..20feb66863 100644 --- a/docs/SDLC.md +++ b/docs/SDLC.md @@ -70,12 +70,12 @@ Every significant feature, structural refactoring, or tooling upgrade begins wit - Plan every item as an OpenSpec change, `openspec/changes/-/` ([`openspec/config.yaml`](../openspec/config.yaml), [ADR 0010](adr/0010-openspec-is-the-spec-and-change-proposal-layer.md)). The change folder is the only in-repo record of the item. The proposal records the feasibility check and the existing tool considered. - The pull request that closes the issue archives the change in its last commit with `uv run devops openspec archive `, after every task is ticked. `devops pr check-readiness` blocks a pull request that does not add `openspec/changes/archive/--/` for its issue. It also blocks a pull request that writes `openspec/specs/` or another issue's archived folder. 2. **Roadmap & Backlog Synchronization**: - - File new work as a candidate with `devops roadmap intake --title "" --body-file --confirm`. Intake files it, gives it its type, Priority, Value and Effort, and puts it in the backlog. When the model judges it a possible duplicate, the report and the reason comment name the possible original, and a person closes one of the two. Never set a milestone or priority on a new issue: intake sets the board's Priority field, and a person plans the milestones on the board. + - File new work as a candidate with `devops roadmap intake --title "" --body-file --confirm`. Intake files it, gives it its type, Priority, Value and Effort, and puts it in the backlog. When the model judges it a possible duplicate, the report and the reason comment name the possible original, and a person closes one of the two. Never set a milestone or priority on a new issue: intake sets its `priority/*` label, and a person plans the milestones. - The Value and Effort intake sets place each item in the **Value vs. Effort Prioritization Matrix** (Quick Wins, Major Projects, Fill-Ins, Reconsider). 3. **Milestones Are Planning Buckets**: - - A person groups items into milestones on the GitHub Projects v2 board (`https://github.com/dan-petty/devops-cli/projects`). A milestone never names a version, and no release reads one. + - A person groups items into milestones: each issue holds its milestone. A milestone never names a version, and no release reads one. 4. **Status Lives on GitHub**: - - The project board holds the Status of each item (ADR 0001), and GitHub Projects v2 (`https://github.com/dan-petty/devops-cli/projects`) and the Issues views (`https://github.com/dan-petty/devops-cli/issues/views`) show it. A change folder holds no status, milestone, priority or pull request number (`tests/test_change_folders.py`). + - The labels of each item hold its Status, Priority, Value and Effort (`status/*`, `priority/*`, `value/*`, `effort/*`; ADR 0001, ADR 0016). No roadmap job reads or writes the project board: GitHub Projects v2 (`https://github.com/dan-petty/devops-cli/projects`) and the Issues views (`https://github.com/dan-petty/devops-cli/issues/views`) show the items through label and milestone filters. A change folder holds no status, milestone, priority or pull request number (`tests/test_change_folders.py`). 5. **Topic Branch Creation**: - Create an isolated worktree on a topic branch from the fetched upstream: `devops repos worktrees add --type --slug `. The command fetches `origin/main` and refuses an issue that a worktree or a pushed branch already holds. [CONTRIBUTING.md](../CONTRIBUTING.md#5-naming) gives the form of the branch name. - Before the first push of the branch, fetch again and rebase it onto `origin/main` if `main` moved, so the branch holds the latest `main` when the pull request opens. A pull request that is open needs no rebase to catch up with `main`. Update it when it has a conflict or a check fails (Phase 6). @@ -281,8 +281,8 @@ gitGraph - **Automated Dependency Updates (`.github/renovate.json`)**: The configuration has Renovate propose `github-actions`, `docker` and `kubernetes` updates with mandatory `type/chore` taxonomy labels. An update of a base image in the service image's `Dockerfile` has the prefix `fix(deps)`, so that it adds a changelog line to the next release pull request. Every other update has the prefix `chore(deps)`. The `kubernetes` manager matches no file by default, so the configuration gives it the pattern `^k8s/.+\.ya?ml$`: Renovate opens one pull request for each image tag that a manifest under `k8s/` pins. The `tools.lock` pins and the Helm chart values stay deliberate bumps. Renovate acts only where its GitHub App is installed for the repository. Python and `uv` dependencies are updated deliberately as part of the project workflow with synchronized `uv.lock`. - **GitHub Project Governance, Views & Labeling Standards**: - **Declarative Taxonomy (`.github/labels.yml`)**: Every PR must carry `type/*` and `scope/*` labels, audited manually via `devops gh labels audit` (not enforced in CI). - - **GitHub-Sourced Roadmap (ADR 0001)**: Issues are the roadmap's items, milestones are planning buckets that a person sets, and the project board holds their Status and Priority. - - **Standardized Projects v2 & Issues Views (`https://github.com/dan-petty/devops-cli/projects` & `https://github.com/dan-petty/devops-cli/issues/views`)**: Four standardized views (*Sprint Kanban*, *Roadmap Timeline*, *Triage & Quality Table*, *Value vs Effort Priority Matrix*) track features across lifecycles (`New` -> `Ready` -> `In Progress` -> `In Review` -> `Done`, or `Blocked` while waiting on something outside the roadmap), audited via `devops gh views list` / `spec` / `audit` and synced via `devops gh views sync` (card fields via `devops gh project sync`; issues reach the board through `devops roadmap intake`) with mandatory repository board linkage (`devops gh project link `) so projects appear under `https://github.com/dan-petty/devops-cli/projects` and views under `https://github.com/dan-petty/devops-cli/issues/views`. + - **GitHub-Sourced Roadmap (ADR 0001)**: Issues are the roadmap's items, milestones are planning buckets that a person sets, and labels hold their Status, Priority, Value and Effort (ADR 0016). + - **Standardized Projects v2 & Issues Views (`https://github.com/dan-petty/devops-cli/projects` & `https://github.com/dan-petty/devops-cli/issues/views`)**: Four standardized views (*Sprint Kanban*, *Roadmap Timeline*, *Triage & Quality Table*, *Value vs Effort Priority Matrix*) track features across lifecycles (`New` -> `Ready` -> `In Progress` -> `In Review` -> `Done`, or `Blocked` while waiting on something outside the roadmap), audited via `devops gh views list` / `spec` / `audit` and synced via `devops gh views sync` (card fields via `devops gh project sync`; a person or the board's own workflows add the cards, and no roadmap job reads or writes the board) with mandatory repository board linkage (`devops gh project link `) so projects appear under `https://github.com/dan-petty/devops-cli/projects` and views under `https://github.com/dan-petty/devops-cli/issues/views`. - **Human-in-the-Loop Merging**: AI agents prepare PRs, monitor remote GitHub Actions CI, and remediate failures. AI agents **never merge PRs autonomously**. Maintainers approve and squash-merge. - **Human Review Round (`tuicr`)**: A person can review the diff of an agent in `tuicr`, a terminal program that `tools.lock` pins. The person reads the diff and the commit message, and adds comments of the type `issue`, `question` or `nit` (`.devops/tuicr.config.toml`). The agent then follows these steps: 1. Find the session. Run `tuicr review list --repo `. Use the entry with `"active": true`, which means that tuicr is open on it. If no entry or two entries are active, ask the person which slug to use. @@ -358,7 +358,7 @@ flowchart TD | SDLC Phase | Activity | Primary Tool / Command | Verification Gate | | :--- | :--- | :--- | :--- | -| **1. Inception** | Planning | The issue and its OpenSpec change | The issue is on the board | +| **1. Inception** | Planning | The issue and its OpenSpec change | The issue holds a `priority/*` label | | **2. Specification** | Test-First Authoring | `uv run devops ci test tests/test_.py` | Clean initial failure (asserting new behavior) | | **3. Implementation**| Invariant Enforcement | `tests/test_architectural_invariants.py` | Complexity $\le 10$, Nesting $\le 5$, zero bare exceptions | | **4. Verification** | Full CI Suite | `devops ci` (or `uv run devops ci`) | All Gated quality checks green, coverage $\ge 90\%$ | diff --git a/docs/SELF_IMPROVEMENT.md b/docs/SELF_IMPROVEMENT.md index 4f67425ba6..1a7b4cc226 100644 --- a/docs/SELF_IMPROVEMENT.md +++ b/docs/SELF_IMPROVEMENT.md @@ -1081,7 +1081,7 @@ un-joined thread, the delayed stream teardown, and the leaked resource. file even when the cited line ranges differ (personas routinely cite different, and often both wrong, ranges for the same defect). - **Deliberately conservative**: findings that merely share an enclosing function are never - merged. Losing a real defect is far costlier than leaving a duplicate on the board. + merged. Losing a real defect is far costlier than leaving a duplicate on the roadmap. ### 5.2 Segment-Boundary False Positives (Asserting Absence Of Unseen Code) diff --git a/docs/TELEMETRY.md b/docs/TELEMETRY.md index 1dfde2846e..3b2301c6fe 100644 --- a/docs/TELEMETRY.md +++ b/docs/TELEMETRY.md @@ -87,7 +87,7 @@ writes by name. | `devops_cli_project_commits` | Gauge | `1` | Project commits count by release. | | `devops_cli_project_prs` | Gauge | `1` | Project pull requests merged by release. | | `devops_cli_project_ci_runs` | Gauge | `1` | CI workflow runs by name, status and conclusion. | -| `devops_cli_project_items` | Gauge | `1` | Project board items by milestone, state, type and priority. A label is empty when the item has no value for it. | +| `devops_cli_project_items` | Gauge | `1` | Roadmap items, the issues with a priority label, by milestone, state, type and priority. A label is empty when the item has no value for it. | | `devops_cli_project_release_interval_days` | Histogram | `d` | Days elapsed between consecutive project releases. | | `devops_cli_project_traffic_views` | Gauge | `1` | GitHub repository total page views count. | | `devops_cli_project_traffic_views_uniques` | Gauge | `1` | GitHub repository unique visitors count. | diff --git a/docs/adr/0001-github-is-the-roadmap-source.md b/docs/adr/0001-github-is-the-roadmap-source.md index 1519dc93e3..a31d9a5b09 100644 --- a/docs/adr/0001-github-is-the-roadmap-source.md +++ b/docs/adr/0001-github-is-the-roadmap-source.md @@ -1,5 +1,7 @@ # GitHub is the roadmap's source of truth +Amended on 2026-10-28 by [ADR 0016](0016-labels-hold-the-roadmap-items-fields.md). Labels and milestones hold an Item's Status, Priority, Value and Effort, and no roadmap job reads or writes the project board. An Item is an issue with a `priority/*` label, and the issue body holds its job record. + Amended on 2026-10-22 by [ADR 0012](0012-releases-are-derived-by-release-please-from-trunk-and-milestones-are-planning-buckets.md). A milestone is a planning bucket, not a release. The roadmap command renders `docs/ROADMAP.md` from GitHub, and no release writes it. The change takes effect after v0.2.39, in the order of the Cutover section of ADR 0012. The roadmap used to live in a hand-edited `docs/ROADMAP.md` that was synced out to GitHub issues, milestones and the project board. We reversed that: issues are the items, milestones are the releases, and board fields hold status and priority, while `docs/ROADMAP.md` is generated from them as a read-only view. The roadmap has to work for any GitHub repository devops-cli manages, not only one that keeps a markdown file in this repo's grammar. Automated intake and reprioritization would also turn every change into a commit and a pull request to review, adding to the review load this work is meant to reduce. diff --git a/docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md b/docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md index cadd33c288..b05cf492fd 100644 --- a/docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md +++ b/docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md @@ -2,6 +2,8 @@ [ADR 0015](0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md) supersedes this ADR. +Amended on 2026-10-28 by [ADR 0016](0016-labels-hold-the-roadmap-items-fields.md). No roadmap job reads or writes a project board, so the jobs need no access to a board and no `project` scope. A job tells a person's change from its own by its job record, which is a hidden block of the issue body. Labels hold the fields, and the issue events keep the history of each label change. + The roadmap jobs change issues and the board with no person present, and reprioritization has to tell a person's change from its own so it never reverts one. They act as a dedicated machine account (GitHub's terms allow one free machine account per person) that holds a classic personal access token with the `project` and `repo` scopes and is invited as a Write collaborator on each managed repository and its board. A GitHub App or a fine-grained token would be the usual choice, but neither can reach a board owned by a personal account; only a classic token can. ## Considered Options diff --git a/docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md b/docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md index c96c2f09c1..2b084ccd2c 100644 --- a/docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md +++ b/docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md @@ -1,5 +1,7 @@ # Polling is how the roadmap sees changes; webhooks only cut latency +Amended on 2026-10-28 by [ADR 0016](0016-labels-hold-the-roadmap-items-fields.md). Labels hold Status, Priority, Value and Effort, so a change of a field is a `labeled` or `unlabeled` issue event. The poll reads those events, and the repository webhook sends them. No roadmap job reads a board. + The service finds changes by polling GitHub on a short tick, using conditional requests so an unchanged answer costs nothing, and treats a repository webhook only as a hint that makes a job due sooner. GitHub sends no webhook when a board owned by a personal account changes, so edits to status, priority, Value and Effort can only be found by polling, and GitHub never retries a failed delivery. Polling is needed anyway, and making it the source of truth means a missed webhook only delays a job until the next tick. ## Considered Options diff --git a/docs/adr/0016-labels-hold-the-roadmap-items-fields.md b/docs/adr/0016-labels-hold-the-roadmap-items-fields.md new file mode 100644 index 0000000000..2839f401cc --- /dev/null +++ b/docs/adr/0016-labels-hold-the-roadmap-items-fields.md @@ -0,0 +1,35 @@ +# Labels hold the roadmap Item's fields, and no roadmap job reads or writes a project board + +This ADR amends [ADR 0001](0001-github-is-the-roadmap-source.md), [ADR 0002](0002-roadmap-jobs-act-as-a-machine-account.md) and [ADR 0003](0003-polling-is-how-the-roadmap-sees-changes.md). + +The roadmap Service acts as a GitHub App that the personal account `dan-petty` owns ([ADR 0015](0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md), [#1647](https://github.com/dan-petty/devops-cli/issues/1647)). GitHub gives an App the "Projects" permission only at organization level. So the App cannot read or write a project board that a user owns. Before this decision, each roadmap job needed the board: an Item was an issue with a card, and the card's fields held Status, Priority, Value and Effort. The board's TEXT field `Job record` held the job record, and `.github/roadmap.toml` named the board. + +On 2026-10-28 the owner decided that labels and milestones hold an Item's state, and that no roadmap job reads or writes the project board ([#2399](https://github.com/dan-petty/devops-cli/issues/2399)). Private project boards need no support. The owner keeps the board as a personal view, through label and milestone filters. + +- **One label family for each field.** A label is the field's name and the value, in lower case, with a hyphen for each space. Status has `status/new`, `status/ready`, `status/in-progress`, `status/in-review` and `status/blocked`. Priority has `priority/p0-critical`, `priority/p1-high`, `priority/p2-medium` and `priority/p3-low`. Value has `value/high`, `value/medium` and `value/low`, and Effort has `effort/high`, `effort/medium` and `effort/low`. The values keep the names that the board options had. A closed issue is done, so no label holds Done. +- **An Item is an issue with a priority label.** Intake sets Priority last, so an issue with a `priority/*` label is an issue that intake placed, or that a person placed. A Candidate is an open issue with no `priority/*` label. +- **A job replaces the family.** A job sets a field with one `PATCH` of the issue. The `PATCH` removes each label of the family, adds the label of the value, and writes the body with the job record. +- **The job record is a hidden block of the issue body.** The block is `` at the end of the body. The body that the jobs read and write has no block, and a body write keeps the block. A block that is not a JSON object reads as an empty record, and the next write replaces it. +- **A job never reverts a person's change.** The rule of ADR 0002 stays. Before a field write, the store reads the issue. When the field's value differs from the value that the store read, and from the value that the job writes, the write stops before it changes anything. When a family holds two labels, the field's value is the label that the job record does not name. + +## Considered Options + +- **The board, through a classic token of a machine account** (ADR 0002): rejected. The service moves to a GitHub App, and an App cannot reach a board that a user owns. +- **A board mirror, or a board fallback**: rejected by the owner. Two stores of one state drift, and the App cannot write the board. +- **GitHub issue types and issue fields**: rejected. They exist only for organizations, and `dan-petty` is a user. +- **GitLab's scoped form `status::new`**: rejected. GitHub gives `::` no meaning, and nothing makes two labels of one scope exclusive. The repository already uses the form `/`. +- **The names of Kubernetes, such as `priority/critical-urgent`**: rejected. They rename the `priority/*` labels on 775 issues and the values that refine sorts by. +- **A `status/done` label**: rejected. No workflow sets a label when an issue closes, and the issue's state already holds Done. +- **Every issue is an Item**: rejected. Each Candidate would also be an Item, and the items gauge would count each issue that no one triaged. +- **A comment that the job owns, for the job record**: rejected. A read of the Items costs one comment listing for each Item, 775 requests here. The repository's comment listing is 22 pages, and it grows with each comment. A comment also notifies each subscriber at each write. +- **A file in the Service's data directory, for the job record**: rejected. A run from a terminal and the Service keep different records, and ADR 0001 keeps the roadmap's state on GitHub. +- **The actor of each `labeled` event, to see a person's change**: rejected. A read of each Item's timeline costs one request for each Item, and the job record already tells the job's value from a person's. + +## Consequences + +- The issue listing that the store reads holds each issue's labels and body. So a read of the Items, their fields and their job records costs no request more than the listing. +- A field write costs one read and one write of the issue. GitHub has no conditional write of an issue, so a person's edit between the two requests is lost. In one process, a lock keeps the Service's two lanes out of that window. +- A label change is an issue event with its actor, and the repository webhook sends `labeled` and `unlabeled`. So the poll of ADR 0003 sees a person's change of a field. +- `.github/roadmap.toml`, the board read of the store, the `Job record` field, the board's GraphQL budget probe, the GraphQL spend line of a round and the Service's pause after a board budget refusal are deleted. `devops gh project` keeps its own board reads in `github/project_read.py`, for the owner's board. +- `devops pr check-readiness` blocks a pull request whose one issue holds no `priority/*` label. +- The open issues of each managed repository get their labels from their board values once. A person runs that migration. diff --git a/docs/commands/gh.md b/docs/commands/gh.md index 2c3fb4ee1b..a3accec4f8 100644 --- a/docs/commands/gh.md +++ b/docs/commands/gh.md @@ -67,7 +67,7 @@ devops gh status [OPTIONS] ## `devops gh metrics` -**Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and project board items.** +**Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and roadmap Items.** ```bash devops gh metrics [OPTIONS] @@ -248,7 +248,7 @@ devops gh project status [OPTIONS] ### `devops gh project sync` -**Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board: devops roadmap intake places issues, and a pull request's progress shows on its issue's card. Exits 1 when reconcile stops early.** +**Find or create the project board from its template, link it, create the fields it lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue or pull request to the board, and a pull request's progress shows on its issue's card. No roadmap job reads the board: labels hold an item's fields. Exits 1 when reconcile stops early.** ```bash devops gh project sync [OPTIONS] @@ -564,7 +564,7 @@ devops gh issues create [OPTIONS] ### `devops gh issues triage` -**Audit open issues for mandatory taxonomy labels, and report those not on the roadmap board as awaiting intake.** +**Audit open issues for mandatory taxonomy labels, and report those with no priority/* label as awaiting intake.** ```bash devops gh issues triage [OPTIONS] @@ -982,8 +982,8 @@ devops gh pr close [OPTIONS] Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. -It closes exactly one issue, an open issue of its own repository that is on the roadmap -board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR +It closes exactly one issue, an open issue of its own repository that holds a priority/* +label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. diff --git a/docs/commands/pr.md b/docs/commands/pr.md index 379a66f3f3..357630a4f2 100644 --- a/docs/commands/pr.md +++ b/docs/commands/pr.md @@ -248,8 +248,8 @@ devops pr close [OPTIONS] Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. -It closes exactly one issue, an open issue of its own repository that is on the roadmap -board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR +It closes exactly one issue, an open issue of its own repository that holds a priority/* +label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/\-\-\/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. diff --git a/docs/commands/roadmap.md b/docs/commands/roadmap.md index 0e480c0aee..bdb58d7f94 100644 --- a/docs/commands/roadmap.md +++ b/docs/commands/roadmap.md @@ -1,12 +1,12 @@ # `devops roadmap` -Read and write the roadmap on GitHub, its source of truth: issues, milestones and the project board. +Read and write the roadmap on GitHub, its source of truth: issues, their labels and milestones. ## Commands ## `devops roadmap intake` -**Turn candidates into items: every open issue not on the board, and every board item intake left without a Priority. The model compares each with the board's items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a priority, Value and Effort from the model with a reason comment, and goes to the backlog. Intake sets no milestone: a person plans the milestones on the board, and a milestone an issue has stays. An open issue whose board card a person archived is a candidate too: intake restores the card, which keeps its values and milestone; close the issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes.** +**Turn candidates into items: every open issue with no priority/* label. The model compares each with the items and the issues closed as not planned, but not with an issue that has sub-issues, because its sub-issues deliver it. It names a possible duplicate for a person to close: intake never closes an issue and never drops a candidate. Each gets a type, a status/new label, Value and Effort labels and a reason comment, then its priority label last, and goes to the backlog. A label a person set stays. Intake sets no milestone: a person plans the milestones, and a milestone an issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate an agent files with --title and --body-file is labeled source/agent, and intake files it, a possible duplicate too, unless a run that stopped after filing left an open issue with its title and body, which intake then places; a text that looks like it holds a secret is refused. --dry-run makes no request and prints the requests a run makes; --plan, the default, reads GitHub and calls the model, writes nothing and reports what it spent; --confirm makes the writes.** ```bash devops roadmap intake [OPTIONS] @@ -17,7 +17,7 @@ devops roadmap intake [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | +| `--ref` | `string` | - | Branch, tag or commit to read .github/labels.yml at (default: the repository's default branch). | | `--issue` | `integer` | - | Only this issue (repeatable). | | `--title` | `string` | - | Title of a candidate that is not an issue yet; intake files it, and names a possible duplicate for a person to close. Needs --body-file. | | `--body-file` | `path` | - | File holding the new candidate's body. Needs --title. | @@ -43,7 +43,6 @@ devops roadmap refine [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--source` | `path` | `.` | Path to the repository checkout (defaults to current directory). | | `--item` | `integer` | - | Specific issue number to refine instead of selecting by priority. Refine refines it when it is open and New or Ready, even when nothing changed since its last round. | | `--limit` | `integer` | `3` | Maximum number of items to refine in this run (default 3). | @@ -65,7 +64,6 @@ devops roadmap run [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--dry-run` | `boolean` | - | Make no request: print the due list of jobs and the reason each is due, and run nothing. | | `--confirm` | `boolean` | - | Execute the due roadmap jobs. Without it, run prints the due list only. | @@ -73,7 +71,7 @@ devops roadmap run [OPTIONS] ## `devops roadmap return` -**Return an item to New on the roadmap board with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope.** +**Return an item to New with an evidence comment, handing it back to refinement when it cannot be built as specified or needs a refactor beyond its scope. The item gets the label status/new in place of its other status/* label.** ```bash devops roadmap return [OPTIONS] @@ -92,8 +90,7 @@ devops roadmap return [OPTIONS] | `--comment`, `-c` | `string` | `` | Evidence comment explaining why the item cannot be built as specified. | | `--comment-file` | `path` | - | Path to file containing the evidence comment. | | `--repo`, `-R` | `string` | - | Repository as owner/name (default: this checkout's origin). | -| `--ref` | `string` | - | Branch, tag or commit to read .github/roadmap.toml at (default: the repository's default branch). | | `--dry-run` | `boolean` | - | Make no request: print the requests a run makes, in order, with placeholders for values a read gives. | -| `--confirm` | `boolean` | - | Make the writes to GitHub (post comment and set Status to New). | +| `--confirm` | `boolean` | - | Make the writes to GitHub: post the comment and set the Status to New (status/new). | --- diff --git a/k8s/monitoring/dashboards/project-metrics.json b/k8s/monitoring/dashboards/project-metrics.json index 276cd7108a..232de86bbf 100644 --- a/k8s/monitoring/dashboards/project-metrics.json +++ b/k8s/monitoring/dashboards/project-metrics.json @@ -287,7 +287,7 @@ }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "description": "Items of the project board by milestone and state. An item in no milestone shows as none. It shows the latest value of each series in the time range, and no data when none was sent in it.", + "description": "Roadmap items, the issues with a priority label, by milestone and state. An item in no milestone shows as none. It shows the latest value of each series in the time range, and no data when none was sent in it.", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, @@ -311,7 +311,7 @@ }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "description": "Open and closed items of the project board, in all milestones and in none. It shows the latest value of each series in the time range, and no data when none was sent in it.", + "description": "Open and closed roadmap items, the issues with a priority label, in all milestones and in none. It shows the latest value of each series in the time range, and no data when none was sent in it.", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/.openspec.yaml b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/.openspec.yaml new file mode 100644 index 0000000000..1bb6456d11 --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-10-28 diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/design.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/design.md new file mode 100644 index 0000000000..e909ecb35a --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/design.md @@ -0,0 +1,85 @@ +# Design + +## The label families + +| Field | Values | Labels | +| :--- | :--- | :--- | +| Status | New, Ready, In Progress, In Review, Blocked | `status/new`, `status/ready`, `status/in-progress`, `status/in-review`, `status/blocked` | +| Priority | P0-Critical, P1-High, P2-Medium, P3-Low | `priority/p0-critical`, `priority/p1-high`, `priority/p2-medium`, `priority/p3-low` | +| Value | High, Medium, Low | `value/high`, `value/medium`, `value/low` | +| Effort | High, Medium, Low | `effort/high`, `effort/medium`, `effort/low` | + +A label is the field's name and the value, lower case, with a hyphen for each space. The values keep the names of the board options, so refine, the intake model and the constants keep the words they use. + +The repository uses the form `/` already (`type/*`, `scope/*`). The four `priority/p*` labels are in use on 775 issues, and `status/ready`, `status/in-progress`, `status/in-review` and `status/blocked` on 124, so they are kept as they are. `status/new`, `value/*` and `effort/*` are new. + +These labels go: `priority/high` and `priority/medium` (3 issues, no description: an older scheme), `status/done` (Done is the closed state), `status/triage` (`status/new` is that state now), and `status/ready-to-merge` (a pull request state that no code reads; the `status/` family is the Item's Status now). `.github/labels.yml` declares the families, and `devops gh labels sync` creates them. The sync deletes no label, so the migration deletes the old labels once. + +Rejected: + +- **GitLab's scoped form `status::new`.** GitHub gives `::` no meaning: a label is a name, and nothing makes two labels of one scope exclusive. The store makes a family exclusive itself, whatever the separator. +- **Kubernetes' names, such as `priority/critical-urgent`.** They rename labels on 775 issues and the values that refine sorts by, for no gain. +- **A `status/done` label.** No workflow sets a label when an issue closes, as the board's built-in "Item closed" workflow set Done. The issue's state holds it: intake treats a closed issue that is not "not planned" as done, and refine takes only open issues. +- **GitHub issue types and issue fields.** They exist only for organizations, and `dan-petty` is a user. + +## What an Item is + +An Item is an issue, not a pull request, that holds a `priority/*` label. A Candidate is an open issue that holds none. This keeps the meaning that `CONTEXT.md` gives (an open issue becomes an item when intake places it) and the sets that each job read from the board: intake set Priority last, so the board held the issues that intake placed. + +Rejected: **every issue is an Item.** Each Candidate would also be an Item, the items gauge would count every issue that no one triaged, refine would count an untriaged issue as a dependency, and readiness would let a pull request close an issue that intake never saw. + +A placement that stops before Priority leaves a Candidate. The next run decides it again, writes only the fields that the issue holds no value for, and posts no second reason comment (it looks for `CONST_ROADMAP_INTAKE_REASON_MARKER`). The board version skipped the duplicate check for such an "unfinished item"; that rule goes, and the check runs again. + +## Where the job record goes + +The job record moves to a hidden block at the end of the issue body: + +```text + +``` + +Each `>` in the JSON is written as the escape `\u003e`, so no value can end the comment. Every issue the store returns has the block taken out of its body and read into its job record. A body write puts the issue's current block back, and a field or mark write writes the body with the new block. The refine section is already such a block in the body. + +Requests, for a listing of `n` Items and for one field write: + +| Option | Listing | Field write | +| :--- | :--- | :--- | +| A block in the issue body | 0 more: the REST issue listing holds each body | 1 read and 1 write: `GET` the issue, then one `PATCH` of `labels` and `body` | +| A comment the job owns | `n` more: one comment listing per Item (775 Items here), or the repository's comment listing, 22 pages of 100 here and growing with every comment | 1 read and 1 write, and the labels in a second write | +| The board's TEXT field (today) | 1 GraphQL page per 100 cards | 1 card read and 2 mutations | + +Rejected: + +- **A comment the job owns.** The cost per listing is above. It also shows in the timeline and notifies each subscriber at every write. +- **The board's TEXT field.** The App cannot reach the board. +- **A file in the Service's data directory.** A run from a terminal and the Service would keep different records, and ADR 0001 keeps the roadmap's state on GitHub. +- **A record in labels**, such as `job/priority-p2`. It doubles the labels and still cannot hold refine's hashes. + +A person can edit or delete the block. A block that is not a JSON object reads as an empty record, with a warning that names the issue, and the next write replaces it. Read as an error, one edit would stop every job of the repository; read as empty, a job only treats its own values as unknown, which never reverts a person's value. The body of an issue can hold 65,536 characters; the block takes a few hundred. + +## How a job sees a person's change + +The rule of ADR 0002 stays: before a field write, the store reads the issue (`GET`), and when the field's value there differs from the value the store read, and from the value it writes, the write raises `RoadmapItemChangedError` before it changes anything. The value read is the store's own last write of that field, else the value of the Item the caller passes. The job record keeps the last value the store set for each field. + +A person who adds a label without removing the job's leaves two labels in the family. The field's value is the label whose value the job record does not name, because the job wrote the other one; with more than one such label, the first in the family's order. So a person's label is the value at the next read, and the job's next write of the field sees the change and refuses. + +Rejected: **the actor of each `labeled` event.** The issue events report who set a label (ADR 0003), but a read of each Item's timeline costs one request per Item, and the record already tells the job's value from a person's. + +`GitHub` has no conditional write for an issue: a person's edit of the labels or the body between the store's `GET` and its `PATCH` is lost. The window is the time between two requests, and the in-process lock (`_JOB_RECORD_LOCK`) keeps the Service's two lanes out of it. + +## The store + +`RoadmapStore` keeps the members that refine uses (`item`, `items`, `backlog`, `milestones`, `set_field`, `set_marks`, `comments_on`, `read_issue_body`, `write_issue_body`) and their meaning, so `refine.py` needs no change. `add_item` and `graphql_spend` go, and `item_of(issue)` makes the Item that a Candidate's issue would be, for intake's writes. + +The GitHub store reads the REST listing of every issue once for its life (one command or one Service round) and keeps it; its own writes update the kept issues. `items(milestone=...)` and `backlog()` read their filtered listings. No request is a GraphQL request except an issue's timeline (`closures`) and the repository's visibility. + +## What else goes + +- **`.github/roadmap.toml`.** Its one key named the board. The Service runs on each repository in `service.repos`, and a repository needs no roadmap file. `--ref` stays on intake, which reads `.github/labels.yml` at it, and goes from refine, run and return. +- **The GraphQL spend line and the Service's round pause.** They measured and bounded the board reads (#1125, #1400). A round now sends at most one GraphQL request per intake candidate and one per refine round, and `run_gh` paces them. The Service keeps its generic pause seam (`RoundPause`), with no reader. +- **PR readiness.** The check "the one issue is on the roadmap board" becomes "the one issue holds a `priority/*` label", read in the closing-issues query in place of the issue's project cards. `.github/roadmap.toml` is no longer read. +- **`devops gh project reconcile`.** It counted the open issues with no card as awaiting intake. Intake adds no card, so the line goes. The command, `sync`, the views and the template stay: the owner's board uses them. + +## Migration + +`.data/agent/scratch/board_to_labels.py` is a scratch script, not product code. For each managed repository it reads the board through the owner's token, and for each open issue on the board it prints the labels that the board's Status, Priority, Value and Effort give, the labels to remove from each family, and the card's `Job record` to move into the record block of the issue body, so refine keeps its marks. It also lists the old labels to delete. Without `--apply` and `--i-am-a-person` it writes nothing; a person runs `devops gh labels sync`, then the writes, when the change merges. diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/proposal.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/proposal.md new file mode 100644 index 0000000000..37ac26c4fc --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/proposal.md @@ -0,0 +1,56 @@ +# Proposal + +## Why + +Issue #2399: the roadmap Service moves to a GitHub App that the personal account `dan-petty` owns (#1647). GitHub gives an App the "Projects" permission only at organization level, so the App cannot read or write board 12, which a user owns. Every roadmap job needs that board today: an Item is an issue with a card, its Status, Priority, Value and Effort are card fields, and the job record is the board's TEXT field `Job record`. + +The owner decided on 2026-10-28: labels and milestones hold an Item's state, no roadmap job reads or writes the project board, and private boards need no support. The owner keeps the board as a personal view through label and milestone filters. + +## What Changes + +- An Item is an issue of the repository, not a pull request, that holds a `priority/*` label: intake placed it, or a person did. A Candidate is an open issue with no `priority/*` label. +- Each of Status, Priority, Value and Effort is one label family: `status/new`, `status/ready`, `status/in-progress`, `status/in-review`, `status/blocked`; `priority/p0-critical`, `priority/p1-high`, `priority/p2-medium`, `priority/p3-low`; `value/high`, `value/medium`, `value/low`; `effort/high`, `effort/medium`, `effort/low`. The field values keep the names the board options had, such as `P1-High` and `In Progress`. A closed issue is done, so no label holds Done. +- A job sets a field with one `PATCH` of the issue that replaces the labels of the family and writes the job record. The job record moves from the board's `Job record` field to a hidden block at the end of the issue body. The body that the jobs read and write has no block, and a body write keeps it. +- A job's write still refuses, before it changes anything, a field that a person changed since the store read it (ADR 0002). When a family holds two labels, the field's value is the one that the job record does not name. +- The store, `board_read.py`, `.github/roadmap.toml` and its reader, the `Job record` field check, `add_item`, the card restore, the board filters, the GraphQL budget probe of the board, the round's GraphQL spend line and the Service's pause after a board budget refusal go. The Projects reads that `devops gh project` uses move to `src/devops_cli/github/project_read.py`. +- Intake places a candidate with labels: a `type/*` label when it has none, the fields it holds no value for, the reason comment, then Priority. A run that stops part-way leaves a candidate, and the next run decides it again. +- `devops roadmap refine`, `run` and `return` lose `--ref`, which only chose the ref of `.github/roadmap.toml`. Intake keeps `--ref` for `.github/labels.yml`. +- `devops pr check-readiness` blocks a pull request whose one issue holds no `priority/*` label, in place of an issue with no card on the board. It reads the labels in the closing-issues query that it already sends. +- `devops gh project reconcile` drops its "awaiting intake" line, because intake adds no card. The project template drops the `Job record` field, and its triage view, like `.gh-dash.yml`, filters on `status/new` in place of `status/triage`. +- `devops gh issues triage` reads the Items and the Candidates from the store, which never overlap: an Item always holds a Priority, so the "Missing Priority" row goes. +- `.github/labels.yml` declares the four families. ADR 0016 amends ADR 0001, 0002 and 0003. +- The change carries spec deltas: a new capability `roadmap-item-labels`, and changes to `roadmap-refine`, `project-metrics-dashboard` and `roadmap-intake-duplicates`. The labels a job writes, the commands' options and the readiness blocker are observable. +- It fits one pull request. The store's interface changes for every caller at once, so a split would leave `main` with two stores or a shim. + +## Capabilities + +### New Capabilities + +- `roadmap-item-labels`: how labels and the issue body hold an Item's fields and job record, and how a job writes them. + +### Modified Capabilities + +- `roadmap-refine`: the roadmap configuration file and its one key go. +- `project-metrics-dashboard`: the items gauge counts the Items of the repository, its priority from the label. +- `roadmap-intake-duplicates`: the scenarios name labels in place of the board. + +## Impact + +- Code: `src/devops_cli/roadmap/` (`store.py`, `github_store.py`, `memory_store.py`, `intake.py`, `intake_requests.py`, `request_plan.py`, `return_item.py`, `run.py`; `config.py` and `board_read.py` deleted), `src/devops_cli/github/` (`project_read.py`, `projects.py`, `owner_lookup.py`, `metrics.py`, `issues.py`), `src/devops_cli/commands/` (`roadmap.py`, `pr.py`, `gh.py`, `serve.py`), `src/devops_cli/survey/intake.py`, the constants, messages and help texts. +- Files: `.github/labels.yml`, `.github/project-template.json`, `.gh-dash.yml`, the descriptions of two panels of `k8s/monitoring/dashboards/project-metrics.json`; `.github/roadmap.toml` deleted. +- Documentation: ADR 0016, the notes on ADR 0001, 0002 and 0003, `CONTEXT.md`, `README.md`, `docs/SDLC.md`, `docs/ROUTINE_TASKS.md`, the knowledge base, and the generated command references. +- Tests: the roadmap tests, the GitHub fakes in `tests/`, and the tests of `devops gh project`, `devops pr` and `devops gh issues triage`. +- Data: the board values of the open issues of each managed repository become labels once. A scratch script prints the labels to set; a person decides when to apply it. + +## Feasibility + +- GitHub's "Permissions required for GitHub Apps" page lists "Organization permissions for Projects" and no repository permission for Projects. Its "Repository permissions for Issues" section gives write access to labels and milestones and to the labels of an issue. +- GitHub's REST reference for "Update an issue" (`PATCH /repos/{owner}/{repo}/issues/{issue_number}`) takes `body` and `labels` in one request, and `labels` "replace[s] the set of labels on this issue". So one request writes the field and its record together. +- `uv run devops gh api 'repos/dan-petty/devops-cli/issues?state=all'` on 2026-10-28 returns each issue's `body` and `labels` in the listing that the store already reads, so the record in the body costs no read per Item. The repository's issues hold `priority/p0-critical` 86 times, `priority/p1-high` 365, `priority/p2-medium` 259, `priority/p3-low` 65, `status/blocked` 18 and `status/in-progress` 95, so the existing labels are in use and are kept. +- The refine section of an issue body is already a hidden block between two HTML comments (`CONST_ROADMAP_REFINE_START_MARKER`), so a hidden block in the body is a form that the jobs read and write today. + +## Existing Tool Considered + +GitHub issue labels and milestones are GitHub's repository-level classification and planning features, and an App with the Issues permission reads and writes them on a user-owned repository. GitHub issue types and issue fields exist only for organizations. Nothing new is built: the change deletes the board code of the roadmap store and its jobs. + +The change deletes `src/devops_cli/roadmap/board_read.py` (its Projects reads for `devops gh project` move to `github/project_read.py`), `src/devops_cli/roadmap/config.py`, `.github/roadmap.toml`, `BoardEntry`, `BoardField`, `FieldOption`, `AddedItem`, `join_items`, `require_job_record_field`, `add_item`, the card read, restore and edit, the board listing cache, the GraphQL budget probe and spend line of the store, `log_round_spend`, `service_pause_until`, the board filters, and the `Job record` field. diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/project-metrics-dashboard/spec.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/project-metrics-dashboard/spec.md new file mode 100644 index 0000000000..c977ba11cb --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/project-metrics-dashboard/spec.md @@ -0,0 +1,26 @@ +## REMOVED Requirements + +### Requirement: The items gauge counts the items of the project board +**Reason**: The roadmap jobs read no project board (#2399). An Item is an issue with a `priority/*` label, and its Priority comes from that label. +**Migration**: The requirement "The items gauge counts the Items of the repository" holds the rule. + +## ADDED Requirements + +### Requirement: The items gauge counts the Items of the repository +`devops_cli_project_items` SHALL count the Items of the repository, open and closed, with the labels `milestone`, `state`, `type` and `priority`. The `milestone` label SHALL be empty for an Item in no milestone. The `type` label SHALL be the `type/*` label of the issue without its prefix, empty when the issue has none, and the `priority` label SHALL be the Item's Priority. + +#### Scenario: An open Item in no milestone +- **WHEN** the repository holds two open issues with `type/bug` and `priority/p1-high` and no milestone +- **THEN** the report has one item count with `milestone` empty, `state` `open`, `type` `bug`, `priority` `P1-High` and a count of 2 + +#### Scenario: Open and closed Items of a milestone +- **WHEN** the repository holds one open Item and one closed Item in the milestone `2026-11-01` +- **THEN** the report has one count for each state, and both name the milestone `2026-11-01` + +#### Scenario: A pull request or an issue that is not an Item +- **WHEN** the repository has a pull request with `priority/p1-high`, and an issue with no `priority/*` label +- **THEN** the report counts neither + +#### Scenario: The issues cannot be read +- **WHEN** the read of the issues fails +- **THEN** the collection of the report raises the failure and returns no report diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-intake-duplicates/spec.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-intake-duplicates/spec.md new file mode 100644 index 0000000000..7b880ba112 --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-intake-duplicates/spec.md @@ -0,0 +1,23 @@ +## MODIFIED Requirements + +### Requirement: A duplicate verdict places the candidate +When the model names a shortlist item as the original and names the change that both ask for, intake SHALL place the candidate as it places any candidate, and SHALL file a new candidate. + +#### Scenario: A new candidate that the model judges a duplicate +- **WHEN** an agent files a new candidate, and the model names a finished item as its original with a shared change +- **THEN** intake files the candidate, labels it `status/new` and with its Priority, and the report and the reason comment name the item as the possible original + +#### Scenario: An existing issue that the model judges a duplicate +- **WHEN** an open issue with no `priority/*` label is a candidate, and the model names an item as its original with a shared change +- **THEN** intake places the issue, the issue stays open, and its reason comment names the possible original + +#### Scenario: A person planned the candidate +- **WHEN** the candidate has a milestone or a Status that a person set, and the model names an original +- **THEN** intake places the candidate like any other, and it stays open + +### Requirement: A retry places the issue that a stopped run filed +When an open issue with no `priority/*` label holds the title and the filed body of a new candidate, intake SHALL place that issue, SHALL file no issue, and the entry point SHALL return its number. + +#### Scenario: A run stopped after it filed the candidate +- **WHEN** an open issue with no `priority/*` label holds the title and the filed body of a new candidate, and intake runs for that candidate +- **THEN** intake labels that issue `status/new`, the repository holds one issue, and the outcome names that issue diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-item-labels/spec.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-item-labels/spec.md new file mode 100644 index 0000000000..99027b1593 --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-item-labels/spec.md @@ -0,0 +1,59 @@ +## Purpose + +How the roadmap jobs read and write an Item's Status, Priority, Value and Effort as issue labels and its job record as a hidden block of the issue body, with no request to a project board, and how a job sees a change that a person made. + +## ADDED Requirements + +### Requirement: One label family holds each field of an Item +The roadmap store SHALL read an Item's Status, Priority, Value and Effort each from one label family: the label is the field's name and the value in lower case, with a hyphen for each space, such as `status/in-progress` for the Status `In Progress`. A field SHALL have no value when the issue holds no label of its family. + +#### Scenario: An issue with a label of each family +- **WHEN** an issue holds `priority/p1-high`, `status/in-progress`, `value/high` and `effort/low` +- **THEN** its Item has Priority `P1-High`, Status `In Progress`, Value `High` and Effort `Low` + +#### Scenario: A label that a person sets +- **WHEN** a person adds `status/blocked` to an Item whose Status a job set to `New`, and leaves `status/new` on it +- **THEN** the next read gives the Item the Status `Blocked` + +### Requirement: An Item is an issue with a priority label +The roadmap store SHALL list as Items the issues of the repository, open and closed and never pull requests, that hold a `priority/*` label of the family. It SHALL list as Candidates the open issues that hold none. + +#### Scenario: Items and Candidates +- **WHEN** the repository holds an open issue with `priority/p2-medium`, a closed issue with `priority/p3-low`, an open issue with no `priority/*` label and a pull request with `priority/p1-high` +- **THEN** the Items are the two issues with a priority label, and the one Candidate is the open issue without one + +### Requirement: A job sets a field by replacing the family's labels +A job's write of a field SHALL remove every label of the field's family from the issue, SHALL add the label of the value, and SHALL write the issue's labels and its job record in one request. A value that is not one of the field's values SHALL raise before any write. + +#### Scenario: A job sets the Status +- **WHEN** a job sets the Status of an Item that holds `status/new` and `type/bug` to `Ready` +- **THEN** the issue holds `status/ready` and `type/bug`, its job record names `Ready` for Status, and one write request was sent + +#### Scenario: A value that is not a Status +- **WHEN** a job sets the Status of an Item to `Done` +- **THEN** the write raises and the issue is unchanged + +### Requirement: A job never reverts a person's change +Before a job writes a field, the store SHALL read the issue. When the field's value there differs from the value that the store read, and from the value that the job writes, the write SHALL raise `RoadmapItemChangedError` and SHALL change nothing. + +#### Scenario: A person changed the Status after the read +- **WHEN** a job read an Item with Status `New`, a person then set `status/blocked`, and the job sets the Status to `Ready` +- **THEN** the write raises `RoadmapItemChangedError`, and the issue holds `status/blocked` + +### Requirement: The issue body holds the job record +The store SHALL keep an Item's job record in a block `` at the end of the issue body. The body that the store returns SHALL hold no such block, and a body write SHALL keep the issue's block. A block that is not a JSON object SHALL read as an empty record. + +#### Scenario: A body write keeps the record +- **WHEN** refine writes a new body to an Item whose job record holds a mark +- **THEN** the body that the store returns is the new body, and the job record still holds the mark + +#### Scenario: A person breaks the block +- **WHEN** the record block of an issue holds text that is not JSON +- **THEN** the store reads the issue with an empty job record + +### Requirement: No roadmap job reads or writes a project board +Intake, refine, return, run and the project metrics SHALL send no request to GitHub Projects, and SHALL read no `.github/roadmap.toml`. + +#### Scenario: Intake places a candidate +- **WHEN** intake places a candidate against the GitHub fake at the process edge +- **THEN** no request that the fake records names a project, `projectV2` or `.github/roadmap.toml` diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-refine/spec.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-refine/spec.md new file mode 100644 index 0000000000..5e77f1008c --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/specs/roadmap-refine/spec.md @@ -0,0 +1,5 @@ +## REMOVED Requirements + +### Requirement: The roadmap configuration holds only the board +**Reason**: The roadmap jobs read no project board (#2399), and `board` was the file's one key. `.github/roadmap.toml` and its reader are deleted. +**Migration**: Delete `.github/roadmap.toml` from each managed repository. The requirement "No roadmap job reads or writes a project board" of `roadmap-item-labels` holds the rule. diff --git a/openspec/changes/archive/2026-10-28-2399-roadmap-labels/tasks.md b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/tasks.md new file mode 100644 index 0000000000..e83ae95107 --- /dev/null +++ b/openspec/changes/archive/2026-10-28-2399-roadmap-labels/tasks.md @@ -0,0 +1,46 @@ +# Tasks + +## 1. The store reads and writes labels + +- [x] Write the failing contract tests: a field read from its label family, a person's second label, a field write that replaces the family in one request, the refusal of a person's change, the record block kept by a body write, a broken block read as empty, Items and Candidates by the priority label + - Verification: `uv run devops ci test tests/test_roadmap_store_contract.py tests/test_roadmap_github_store.py` +- [x] Rewrite `store.py`, `memory_store.py` and `github_store.py` on labels and the record block; delete `BoardEntry`, `BoardField`, `FieldOption`, `AddedItem`, `add_item`, the card reads and edits, the board listing cache, `graphql_spend` and their tests + - Verification: `uv run devops ci test tests/test_roadmap_store_contract.py tests/test_roadmap_github_store.py` +- [x] Move the Projects reads that `devops gh project` uses from `roadmap/board_read.py` to `github/project_read.py`, delete the rest, and move their tests and fakes + - Verification: `uv run devops ci test tests/test_github_project_read.py tests/test_github_projects.py tests/test_github_projects_reconcile.py` + +## 2. The roadmap jobs + +- [x] Write the failing tests: intake places a candidate with labels and sends no Projects request, a stopped placement is a candidate again, return sets `status/new`, the Service round opens no roadmap file, the items gauge counts the Items + - Verification: `uv run devops ci test tests/test_roadmap_intake.py tests/test_roadmap_return.py tests/test_roadmap_run.py tests/test_github_metrics.py` +- [x] Change intake, return, run, the request plans and `devops roadmap` to the label store; delete `roadmap/config.py`, `.github/roadmap.toml`, the board filters, `log_round_spend`, `service_pause_until` and the `--ref` of refine, run and return + - Verification: `uv run devops ci test tests/test_roadmap_intake.py tests/test_roadmap_return.py tests/test_roadmap_run.py tests/test_roadmap_dry_runs.py tests/test_roadmap_refine.py` +- [x] Open the store with no configuration in the metrics, `devops gh issues triage` and the survey + - Verification: `uv run devops ci test tests/test_github_metrics.py tests/test_gh_cmd.py tests/test_github_issues.py tests/test_survey_capabilities.py` + +## 3. The other users of the board + +- [x] Write the failing test, then make `devops pr check-readiness` block a pull request whose one issue holds no `priority/*` label, read in the closing-issues query + - Verification: `uv run devops ci test tests/test_pr_cmd.py` +- [x] Drop the "awaiting intake" line of `devops gh project reconcile` and the `Job record` field of the project template + - Verification: `uv run devops ci test tests/test_github_projects_reconcile.py tests/test_gh_project_workflows.py` +- [x] Declare the four label families in `.github/labels.yml` + - Verification: `uv run devops ci test tests/test_roadmap_intake.py` + +## 4. Documentation + +- [x] Write ADR 0016 and the notes on ADR 0001, 0002 and 0003; change `CONTEXT.md`, `README.md`, `docs/SDLC.md`, `docs/ROUTINE_TASKS.md` and the knowledge base; regenerate the command references with `devops docs generate --sync-readme` + - Verification: `uv run devops ci test tests/test_docs.py` + +## 5. Verification + +- [x] Verify the fail-to-pass check run against `origin/main` + - Verification: `uv run devops ci fail-to-pass --base origin/main` +- [x] Verify that the full gate passes + - Verification: `uv run devops ci` + +## Workflow follow-up + +- Pending a person: apply the label migration that `.data/agent/scratch/board_to_labels.py` prints, for each managed repository, and delete the old labels it lists. +- Pending a person: delete `.github/roadmap.toml` from the other managed repositories, and the `Job record` field from board 12. +- Pending a person: review the diff in tuicr (`tuicr -r origin/main..HEAD`). diff --git a/openspec/specs/project-metrics-dashboard/spec.md b/openspec/specs/project-metrics-dashboard/spec.md index 03cc636776..b6bd2e8ccc 100644 --- a/openspec/specs/project-metrics-dashboard/spec.md +++ b/openspec/specs/project-metrics-dashboard/spec.md @@ -26,25 +26,6 @@ Each counter that devops-cli sends SHALL have a name that ends in `_total`, and - **WHEN** devops-cli sends the project snapshot - **THEN** the gauges are `devops_cli_project_releases`, `devops_cli_project_commits`, `devops_cli_project_prs`, `devops_cli_project_ci_runs`, `devops_cli_project_items`, `devops_cli_project_traffic_views`, `devops_cli_project_traffic_views_uniques`, `devops_cli_project_traffic_clones`, `devops_cli_project_traffic_clones_uniques`, `devops_cli_project_traffic_referrers`, `devops_cli_project_traffic_paths`, `devops_cli_project_stars` and `devops_cli_project_forks` -### Requirement: The items gauge counts the items of the project board -`devops_cli_project_items` SHALL count the items of the project board, open and closed, with the labels `milestone`, `state`, `type` and `priority`. The `milestone` label SHALL be empty for an item in no milestone. The `type` label SHALL be the `type/*` label of the issue without its prefix, and the `priority` label SHALL be the board Priority, each empty when the item has none. - -#### Scenario: An open item in no milestone -- **WHEN** the board holds two open items of type `bug` with Priority `P1-High` and no milestone -- **THEN** the report has one item count with `milestone` empty, `state` `open`, `type` `bug`, `priority` `P1-High` and a count of 2 - -#### Scenario: Open and closed items of a milestone -- **WHEN** the board holds one open item and one closed item in the milestone `2026-11-01` -- **THEN** the report has one count for each state, and both name the milestone `2026-11-01` - -#### Scenario: A pull request or an issue that is not on the board -- **WHEN** the repository has a pull request, and an issue with no card on the board -- **THEN** the report counts neither - -#### Scenario: The board cannot be read -- **WHEN** the read of the board fails -- **THEN** the collection of the report raises the failure and returns no report - ### Requirement: A label set that has no items is sent as 0 once After a snapshot, `emit_project_metrics_telemetry` SHALL send the value 0 for each label set that the last snapshot of the same process sent and the new snapshot does not hold. It SHALL send that 0 once. @@ -73,3 +54,22 @@ Each gauge that devops-cli sends SHALL reach Prometheus through one path: throug #### Scenario: Two paths send the same gauge name - **WHEN** an instrument sent over OTLP as a gauge has the same name as a gauge recorded in an in-memory Prometheus registry or exposed by a Prometheus scrape endpoint - **THEN** the telemetry invariant check fails and names the shared gauge names + +### Requirement: The items gauge counts the Items of the repository +`devops_cli_project_items` SHALL count the Items of the repository, open and closed, with the labels `milestone`, `state`, `type` and `priority`. The `milestone` label SHALL be empty for an Item in no milestone. The `type` label SHALL be the `type/*` label of the issue without its prefix, empty when the issue has none, and the `priority` label SHALL be the Item's Priority. + +#### Scenario: An open Item in no milestone +- **WHEN** the repository holds two open issues with `type/bug` and `priority/p1-high` and no milestone +- **THEN** the report has one item count with `milestone` empty, `state` `open`, `type` `bug`, `priority` `P1-High` and a count of 2 + +#### Scenario: Open and closed Items of a milestone +- **WHEN** the repository holds one open Item and one closed Item in the milestone `2026-11-01` +- **THEN** the report has one count for each state, and both name the milestone `2026-11-01` + +#### Scenario: A pull request or an issue that is not an Item +- **WHEN** the repository has a pull request with `priority/p1-high`, and an issue with no `priority/*` label +- **THEN** the report counts neither + +#### Scenario: The issues cannot be read +- **WHEN** the read of the issues fails +- **THEN** the collection of the report raises the failure and returns no report diff --git a/openspec/specs/roadmap-intake-duplicates/spec.md b/openspec/specs/roadmap-intake-duplicates/spec.md index 09ab9f3180..de1b8f5ced 100644 --- a/openspec/specs/roadmap-intake-duplicates/spec.md +++ b/openspec/specs/roadmap-intake-duplicates/spec.md @@ -10,14 +10,14 @@ When the model names a shortlist item as the original and names the change that #### Scenario: A new candidate that the model judges a duplicate - **WHEN** an agent files a new candidate, and the model names a finished item as its original with a shared change -- **THEN** intake files the candidate, places it on the board with Status New, and the report and the reason comment name the item as the possible original +- **THEN** intake files the candidate, labels it `status/new` and with its Priority, and the report and the reason comment name the item as the possible original #### Scenario: An existing issue that the model judges a duplicate -- **WHEN** an open issue off the board is a candidate, and the model names an item as its original with a shared change +- **WHEN** an open issue with no `priority/*` label is a candidate, and the model names an item as its original with a shared change - **THEN** intake places the issue, the issue stays open, and its reason comment names the possible original #### Scenario: A person planned the candidate -- **WHEN** the candidate has a milestone or a Priority that a person set, and the model names an original +- **WHEN** the candidate has a milestone or a Status that a person set, and the model names an original - **THEN** intake places the candidate like any other, and it stays open ### Requirement: The report and the reason comment name the possible original @@ -35,11 +35,11 @@ Intake SHALL make no close request. `devops roadmap intake --dry-run` SHALL list - **THEN** the report names the possible original and the writes that place the candidate, and names no close ### Requirement: A retry places the issue that a stopped run filed -When an open issue that is not finished, off the board or on it with no Priority, holds the title and the filed body of a new candidate, intake SHALL place that issue, SHALL file no issue, and the entry point SHALL return its number. +When an open issue with no `priority/*` label holds the title and the filed body of a new candidate, intake SHALL place that issue, SHALL file no issue, and the entry point SHALL return its number. #### Scenario: A run stopped after it filed the candidate -- **WHEN** an open issue off the board holds the title and the filed body of a new candidate, and intake runs for that candidate -- **THEN** intake places that issue with Status New, the repository holds one issue, and the outcome names that issue +- **WHEN** an open issue with no `priority/*` label holds the title and the filed body of a new candidate, and intake runs for that candidate +- **THEN** intake labels that issue `status/new`, the repository holds one issue, and the outcome names that issue ### Requirement: A part is not compared with the other sub-issues of its source When the source of a new candidate links an issue of the repository, intake SHALL leave that issue and every sub-issue of it out of the items it compares with the candidate. A candidate with no such source SHALL be compared with all items as before. diff --git a/openspec/specs/roadmap-item-labels/spec.md b/openspec/specs/roadmap-item-labels/spec.md new file mode 100644 index 0000000000..621369461e --- /dev/null +++ b/openspec/specs/roadmap-item-labels/spec.md @@ -0,0 +1,60 @@ +# roadmap-item-labels Specification + +## Purpose +How the roadmap jobs read and write an Item's Status, Priority, Value and Effort as issue labels and its job record as a hidden block of the issue body, with no request to a project board, and how a job sees a change that a person made. + +## Requirements + +### Requirement: One label family holds each field of an Item +The roadmap store SHALL read an Item's Status, Priority, Value and Effort each from one label family: the label is the field's name and the value in lower case, with a hyphen for each space, such as `status/in-progress` for the Status `In Progress`. A field SHALL have no value when the issue holds no label of its family. + +#### Scenario: An issue with a label of each family +- **WHEN** an issue holds `priority/p1-high`, `status/in-progress`, `value/high` and `effort/low` +- **THEN** its Item has Priority `P1-High`, Status `In Progress`, Value `High` and Effort `Low` + +#### Scenario: A label that a person sets +- **WHEN** a person adds `status/blocked` to an Item whose Status a job set to `New`, and leaves `status/new` on it +- **THEN** the next read gives the Item the Status `Blocked` + +### Requirement: An Item is an issue with a priority label +The roadmap store SHALL list as Items the issues of the repository, open and closed and never pull requests, that hold a `priority/*` label of the family. It SHALL list as Candidates the open issues that hold none. + +#### Scenario: Items and Candidates +- **WHEN** the repository holds an open issue with `priority/p2-medium`, a closed issue with `priority/p3-low`, an open issue with no `priority/*` label and a pull request with `priority/p1-high` +- **THEN** the Items are the two issues with a priority label, and the one Candidate is the open issue without one + +### Requirement: A job sets a field by replacing the family's labels +A job's write of a field SHALL remove every label of the field's family from the issue, SHALL add the label of the value, and SHALL write the issue's labels and its job record in one request. A value that is not one of the field's values SHALL raise before any write. + +#### Scenario: A job sets the Status +- **WHEN** a job sets the Status of an Item that holds `status/new` and `type/bug` to `Ready` +- **THEN** the issue holds `status/ready` and `type/bug`, its job record names `Ready` for Status, and one write request was sent + +#### Scenario: A value that is not a Status +- **WHEN** a job sets the Status of an Item to `Done` +- **THEN** the write raises and the issue is unchanged + +### Requirement: A job never reverts a person's change +Before a job writes a field, the store SHALL read the issue. When the field's value there differs from the value that the store read, and from the value that the job writes, the write SHALL raise `RoadmapItemChangedError` and SHALL change nothing. + +#### Scenario: A person changed the Status after the read +- **WHEN** a job read an Item with Status `New`, a person then set `status/blocked`, and the job sets the Status to `Ready` +- **THEN** the write raises `RoadmapItemChangedError`, and the issue holds `status/blocked` + +### Requirement: The issue body holds the job record +The store SHALL keep an Item's job record in a block `` at the end of the issue body. The body that the store returns SHALL hold no such block, and a body write SHALL keep the issue's block. A block that is not a JSON object SHALL read as an empty record. + +#### Scenario: A body write keeps the record +- **WHEN** refine writes a new body to an Item whose job record holds a mark +- **THEN** the body that the store returns is the new body, and the job record still holds the mark + +#### Scenario: A person breaks the block +- **WHEN** the record block of an issue holds text that is not JSON +- **THEN** the store reads the issue with an empty job record + +### Requirement: No roadmap job reads or writes a project board +Intake, refine, return, run and the project metrics SHALL send no request to GitHub Projects, and SHALL read no `.github/roadmap.toml`. + +#### Scenario: Intake places a candidate +- **WHEN** intake places a candidate against the GitHub fake at the process edge +- **THEN** no request that the fake records names a project, `projectV2` or `.github/roadmap.toml` diff --git a/openspec/specs/roadmap-refine/spec.md b/openspec/specs/roadmap-refine/spec.md index 5e317543c1..c750927e84 100644 --- a/openspec/specs/roadmap-refine/spec.md +++ b/openspec/specs/roadmap-refine/spec.md @@ -12,13 +12,6 @@ Without `--item`, `devops roadmap refine` SHALL take up to `--limit` items in th - **WHEN** the backlog holds twelve Ready items and New P3, P2, P1 and P3 items, an open milestone holds one New P3 item, and refine runs with `--limit 4` - **THEN** refine asks the model about the milestone's item, the backlog's P1 item, the backlog's P2 item and the backlog's first P3 item, in that order, and about no other item -### Requirement: The roadmap configuration holds only the board -`.github/roadmap.toml` SHALL hold the key `board` and no other key. A file that sets another key SHALL fail with a configuration error that names that key. - -#### Scenario: A file that sets a Ready target -- **WHEN** the roadmap configuration sets `board = 2` and `refine_ready_target = 12` -- **THEN** the read fails with a configuration error whose key is `refine_ready_target` - ### Requirement: Refine records the paths that cause a block When refine leaves an item New with an open dependency or a suspected block, it SHALL record in the job record, as `refine.block_paths`, the paths of the proposal's `block_paths` that the checkout holds at the refined commit: each path one time, without its line, at most five, and none outside the repository. It SHALL record no path for a proposal with no open dependency and no suspected block. diff --git a/src/devops_cli/ai/knowledge_base/devops_cli/tasks/github_project_management.md b/src/devops_cli/ai/knowledge_base/devops_cli/tasks/github_project_management.md index 0d3544a231..329ad0919b 100644 --- a/src/devops_cli/ai/knowledge_base/devops_cli/tasks/github_project_management.md +++ b/src/devops_cli/ai/knowledge_base/devops_cli/tasks/github_project_management.md @@ -4,7 +4,7 @@ GitHub project governance in `devops-cli` standardizes repository metadata across six foundational pillars: 1. **GitHub Pages Publishing**: Inspection of deployment health, custom domain status, HTTPS enforcement, build history, manual build dispatching, and readiness verification of `docs/_config.yml`, the one file of site settings that the Pages build reads, and `docs/`. -2. **GitHub Issues Lifecycle & Triage**: Intake (`devops roadmap intake`), the one way new work becomes an item, taxonomy label enforcement (`type/*`, `scope/*`, `priority/*`), and proactive triage auditing to guarantee zero unclassified open issues; a backlog item has no milestone. +2. **GitHub Issues Lifecycle & Triage**: Intake (`devops roadmap intake`), the one way new work becomes an item, taxonomy label enforcement (`type/*`, `scope/*`, `priority/*`), and proactive triage auditing to guarantee zero unclassified open issues; a backlog item has no milestone. The labels of an item hold its Status, Priority, Value and Effort (`status/*`, `priority/*`, `value/*`, `effort/*`; ADR 0016), and no roadmap job reads or writes a project board. 3. **GitHub Projects v2 Lifecycle**: Board creation, multi-board listing, reconciliation of Status and Priority on the board's cards from issue and pull request state and labels, and automated drift auditing against standardized template schemas. 4. **Standardized Projects v2 Views**: Continuous auditing and synchronization of the 4 canonical views (`Sprint Kanban`, `Roadmap Timeline`, `Triage & Quality Table`, and `Value vs Effort Priority Matrix`) ensuring full alignment across `https://github.com/dan-petty/devops-cli/projects` and `https://github.com/dan-petty/devops-cli/issues/views`. 5. **Roadmap Milestones**: GitHub is the roadmap's source of truth (ADR 0001). A milestone is a planning bucket that a person sets, with issue completion ratios and health metrics. A milestone never names a version, and no release reads one. @@ -35,7 +35,7 @@ graph TD | :--- | :--- | :--- | :--- | | **Sprint Kanban** | Board | `Status` | Active sprint tracking (`New`, `Ready`, `In Progress`, `In Review`, `Done`, `Blocked`). Filtered to current milestone. | | **Roadmap Timeline** | Roadmap | `Milestone` | Milestones (planning buckets) in the order of their due dates, with status health. | -| **Triage & Quality Table** | Table | None | Priority-ordered queue (`P0` to `P3`) filtering open defects (`type/bug`, `status/blocked`, `status/triage`). | +| **Triage & Quality Table** | Table | None | Priority-ordered queue (`P0` to `P3`) filtering open defects (`type/bug`, `status/blocked`, `status/new`). | | **Value vs Effort Priority Matrix** | Table | `Value` | Items grouped by Value and sorted by Value, then Effort. | --- @@ -65,7 +65,7 @@ devops gh issues list --state open --milestone "" --limit 30 # Preview a candidate: --plan reads GitHub and calls the model and writes nothing; --dry-run makes no request; --confirm files it devops roadmap intake --title "feat(rag): vector index optimization" --body-file candidate.md --plan -# Audit open issues for taxonomy compliance; issues not on the board are reported as awaiting intake +# Audit open issues for taxonomy compliance; issues with no priority/* label are reported as awaiting intake devops gh issues triage # Display aggregated issue counts by priority, type, and milestone @@ -128,16 +128,16 @@ devops gh milestones list - Before requesting builds or pushing documentation releases, run `devops gh pages verify` to check `docs/_config.yml` (its YAML syntax and its `title`, `url`, `baseurl` and `markdown` keys) and to confirm the `docs/` publishing root exists. GitHub Pages builds `main:/docs` with no `--config` option, so Jekyll reads `docs/_config.yml` only: put every site setting in that file. - Verify that HTTPS is strictly enforced (`enforce_https: true`) and custom domains have valid SSL certificates via `devops gh pages status`. 2. **Issue Triage & Zero-Untracked Defect Policy**: - - Every open issue must have at least one `type/*` label, at least one `scope/*` label, and an assigned Priority field on the board. - - New feature or defect issues enter through intake (`devops roadmap intake --title … --body-file … --confirm`), which sets their Priority and puts them in the backlog; nobody sets a milestone or priority on a new issue by hand. + - Every open issue must have at least one `type/*` label, at least one `scope/*` label, and one `priority/*` label. + - New feature or defect issues enter through intake (`devops roadmap intake --title … --body-file … --confirm`), which sets their `priority/*` label and puts them in the backlog; nobody sets a milestone or priority on a new issue by hand. - Regularly execute `devops gh issues triage` to catch issues missing labels, and `devops roadmap intake` for those awaiting intake. 3. **Task-to-Issue Grounding**: - - Ground every user task to a corresponding GitHub Issue and Project Item. + - Ground every user task to a corresponding GitHub issue that is a roadmap item: it holds a `priority/*` label. - If an open issue exists: verify its taxonomy labels. `devops gh project sync` moves the card to In Progress when a draft pull request is open. - Without a matching issue: file the task as a candidate with `devops roadmap intake --title … --body-file … --confirm` (or FastMCP `roadmap_intake` with `mode="confirm"`); intake files it, names a possible duplicate for a person to close, gives it its type, Priority, Value and Effort, and puts it in the backlog. 4. **Projects v2 Board Linkage & Real-Time Card Lifecycle Transitions**: - Ensure the project board is linked to the repository via `devops gh project link `, surfacing the project board under `https://github.com/dan-petty/devops-cli/projects` and its 4 canonical views under `https://github.com/dan-petty/devops-cli/issues/views`. - - Issue cards on the board progress across canonical lifecycle states (status lives on GitHub per ADR 0001; an OpenSpec change folder carries no status, and only the delivering PR writes and archives it): + - Issue cards on the board progress across canonical lifecycle states (the `status/*` label of the issue holds the Status per ADR 0001 and ADR 0016, and the board shows it through label filters; an OpenSpec change folder carries no status, and only the delivering PR writes and archives it): - `Backlog`: Queued items that a person has not yet planned into a milestone. - `Ready`: Scoped items with concrete acceptance criteria and tests designed. - `In Progress (WIP)`: Active implementation. `devops gh project sync` sets it when a draft pull request is open. @@ -146,8 +146,8 @@ devops gh milestones list - Run `devops gh project audit` and `devops gh views audit` to detect missing fields, invalid options, or misconfigured view filters. 5. **Custom Field Reconciliation (`devops gh project sync`, `devops gh project reconcile`)**: - The board owns Status: reconcile sets it only when it is unset (from an exact `status/*` label, otherwise New) or when issue or pull request state forces Done, In Review or In Progress, so manual triage is never reverted. - - The board owns Priority, and intake sets it. The board mirrors the issue's milestone itself, so reconcile never writes it, and Value and Effort are never inferred; they stay as set by hand. - - Reconcile and sync add no card: `devops roadmap intake` places issues, and a pull request gets no card, its progress showing on its issue's card. + - The `priority/*` label holds Priority, and intake sets it; no roadmap job reads or writes the board. The board mirrors the issue's milestone itself, so reconcile never writes it, and Value and Effort are never inferred; they stay as set by hand. + - Reconcile and sync add no card: a person or the board's own workflows add the cards, and a pull request gets no card, its progress showing on its issue's card. - `devops gh project reconcile --plan` lists every change with its old and new value and the source that decided it; `--dry-run` makes no request and lists the requests a run makes. A planned value the board's field has no option for is refused before any write, naming the value and the options. A run that stops early (mutation budget, GraphQL quota or a failed write) says why and how many planned changes remain, and exits 1; running it again continues from there, after the reset for a quota stop and once the cause is fixed for a failed write. - Run `devops gh project sync` (or FastMCP `gh_project_sync`) after creating issues, pushing branches, or opening PRs to keep the cards' fields up to date. 6. **Strict Remote Branch Lifecycle & PR Governance**: @@ -158,7 +158,7 @@ devops gh milestones list 7. **Mandatory Defect & Incident Tracking on CLI Errors/Warnings**: - Whenever an AI agent or developer encounters an unhandled error, subcommand failure, crash, diagnostic warning, or unexpected behavior while executing `devops` CLI commands, they must immediately file it as a candidate with `devops roadmap intake --title … --body-file … --confirm`, written in the shape of `.github/ISSUE_TEMPLATE/bug_report.yml`. - Title follows Conventional Commits: `fix(): `. Cite the commit that introduced a regression, or the failed Actions run, so intake can verify it. - - Intake gives it its type (`type/bug`), puts it on the board with its Priority, and puts it in the backlog, so it appears in the *Triage & Quality Table*. Set no milestone or priority by hand. + - Intake gives it its type (`type/bug`), its `status/new` and `priority/*` labels, and puts it in the backlog, so it appears in the *Triage & Quality Table*. Set no milestone or priority by hand. --- diff --git a/src/devops_cli/commands/gh.py b/src/devops_cli/commands/gh.py index 7e9e152063..7a3f138aab 100644 --- a/src/devops_cli/commands/gh.py +++ b/src/devops_cli/commands/gh.py @@ -31,7 +31,7 @@ from devops_cli.dry_run import is_dry_run from devops_cli.dry_run.requests import render_request_plan from devops_cli.exceptions import DevOpsCLIError -from devops_cli.exceptions.git import GitHubFileNotFoundError, GitHubOperationError +from devops_cli.exceptions.git import GitHubOperationError from devops_cli.github.branch_protection import ( audit_branch_protection, load_branch_protection_policies, @@ -100,7 +100,6 @@ ) from devops_cli.output.serialization import emit_serialized, resolve_format from devops_cli.roadmap import store as roadmap_store -from devops_cli.roadmap.config import open_roadmap from devops_cli.roadmap.store import GitHubState logger = logging.getLogger(__name__) @@ -515,9 +514,6 @@ def _report_reconcile(result: ReconcileResult, repo: str) -> None: rows=[[c.item, c.field, c.old or "(unset)", c.new, c.source] for c in result.shown], safe=True, ) - intake = result.intake_line() - if intake: - print_info(intake) stop = result.stop_line() if stop is None: print_success(result.summary()) @@ -770,7 +766,7 @@ def _display_issues_saved_views(target_repo: str) -> None: ("Sprint Kanban", "is:issue state:open milestone:current"), ( "Triage & Quality Table", - "is:issue state:open label:status/triage,status/blocked,type/bug", + "is:issue state:open label:status/new,status/blocked,type/bug", ), ("Roadmap Timeline", "is:issue state:open sort:milestone-desc"), ("Value vs Effort Priority Matrix", "is:issue state:open sort:priority-desc"), @@ -1013,24 +1009,13 @@ def issues_create_cmd( print_warning(f"Milestone '{milestone}' was not set on issue #{created.number}.") -def _awaiting_intake(repo: str) -> list[int] | None: - """The open issues not on the roadmap board, or None for a repository without - `.github/roadmap.toml`; any other failed read raises.""" - try: - _, store = open_roadmap(repo, ref=None) - except GitHubFileNotFoundError: - return None - return [candidate.number for candidate in store.candidates()] - - @issues_app.command("triage", help=HELP.gh.issues_triage) def issues_triage_cmd( repo: Annotated[str | None, typer.Option("--repo", "-R", help="Target repository")] = None, ) -> None: """Audit open issues for mandatory taxonomy labels, and report those awaiting intake.""" target_repo = repo or _resolve_repo() - awaiting = _awaiting_intake(target_repo) - audit = audit_issues_triage(target_repo, awaiting_intake=awaiting or ()) + audit = audit_issues_triage(target_repo) columns = ["Metric", "Value", "Violating Issues"] rows = [ ["Total Open Issues", str(audit.total_open), "—"], @@ -1045,15 +1030,6 @@ def issues_triage_cmd( str(len(audit.issues_missing_scope)), ", ".join(f"#{n}" for n in audit.issues_missing_scope) or "None", ], - [ - "Missing Priority", - "Not checked" - if audit.priority_not_checked - else str(len(audit.issues_missing_priority)), - "no board" - if audit.priority_not_checked - else ", ".join(f"#{n}" for n in audit.issues_missing_priority) or "None", - ], [ "Awaiting Intake", str(len(audit.issues_awaiting_intake)), @@ -1061,14 +1037,8 @@ def issues_triage_cmd( ], ] print_table(f"GitHub Issues Triage & Taxonomy Audit ({target_repo})", columns, rows) - if audit.priority_not_checked: - print_info(MESSAGES.roadmap.triage_priority_not_checked) - if awaiting is None: - print_info(MESSAGES.roadmap.triage_no_board) if audit.valid_count + len(audit.issues_awaiting_intake) < audit.total_open: - print_warning( - "Triage audit detected issues missing required taxonomy labels or board Priority." - ) + print_warning("Triage audit detected issues missing required taxonomy labels.") if audit.issues_awaiting_intake: print_info(MESSAGES.roadmap.triage_awaiting_intake) @@ -1807,7 +1777,7 @@ def project_metrics_cmd( ), ] = False, ) -> None: - """Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and project board items.""" + """Display comprehensive project metrics including release frequency, PRs, commits, CI pass rates, milestones, and roadmap Items.""" target_repo = _resolve_repo(repo) report = collect_project_metrics_report( repo=target_repo, diff --git a/src/devops_cli/commands/pr.py b/src/devops_cli/commands/pr.py index 9ba8fcea4a..7c80a35fbb 100644 --- a/src/devops_cli/commands/pr.py +++ b/src/devops_cli/commands/pr.py @@ -26,12 +26,11 @@ CONST_OPENSPEC_CHANGES_DIR, CONST_OPENSPEC_SPECS_DIR, CONST_PR_API_STATE_MAP, - CONST_PR_CLOSING_ISSUE_CARDS_PAGE, + CONST_PR_CLOSING_ISSUE_LABELS_PAGE, CONST_PR_CLOSING_ISSUES_PAGE, CONST_PR_FILE_ADDED_STATUSES, CONST_PR_FILE_REMOVED_STATUS, CONST_PR_UPDATE_AUTHOR, - CONST_ROADMAP_CONFIG_PATH, ) from devops_cli.config.defaults import ( DEFAULT_PR_LIMIT, @@ -44,7 +43,6 @@ from devops_cli.core.process import run_subprocess from devops_cli.dry_run.requests import PlannedRequest, render_request_plan from devops_cli.dry_run.state import is_dry_run, set_dry_run -from devops_cli.exceptions.config import ConfigurationError from devops_cli.exceptions.git import GitHubOperationError from devops_cli.github.client import PullRequestFile from devops_cli.github.defect_classifier import ( @@ -1431,21 +1429,12 @@ class _GraphModel(BaseModel): model_config = ConfigDict(frozen=True, populate_by_name=True) -class _ProjectOwner(_GraphModel): - login: str = "" +class _Label(_GraphModel): + name: str -class _Project(_GraphModel): - number: int - owner: _ProjectOwner = Field(default_factory=_ProjectOwner) - - -class _Card(_GraphModel): - project: _Project - - -class _Cards(_GraphModel): - nodes: list[_Card] = Field(default_factory=list) +class _Labels(_GraphModel): + nodes: list[_Label] = Field(default_factory=list) class _IssueRepository(_GraphModel): @@ -1453,12 +1442,12 @@ class _IssueRepository(_GraphModel): class _ClosingIssue(_GraphModel): - """An issue GitHub closes when the pull request merges, with the board cards it has.""" + """An issue GitHub closes when the pull request merges, with its labels.""" number: int state: str repository: _IssueRepository - cards: _Cards = Field(alias="projectItems", default_factory=_Cards) + labels: _Labels = Field(default_factory=_Labels) def is_of(self, repo: str) -> bool: """Whether the issue belongs to repository `repo` (`owner/name`).""" @@ -1469,12 +1458,14 @@ def reference(self, repo: str) -> str: prefix = "" if self.is_of(repo) else self.repository.name_with_owner return f"{prefix}#{self.number}" - def is_on_board(self, owner: str, board: int) -> bool: - """Whether the issue has a card on project `board` of `owner`.""" - return any( - card.project.number == board and card.project.owner.login.lower() == owner.lower() - for card in self.cards.nodes - ) + def is_item(self) -> bool: + """Whether the issue is a roadmap Item: it holds a `priority/*` label (ADR 0016).""" + from devops_cli.roadmap.store import FIELD_VALUES, ItemField, field_label + + priorities = { + field_label(ItemField.PRIORITY, value) for value in FIELD_VALUES[ItemField.PRIORITY] + } + return any(label.name.lower() in priorities for label in self.labels.nodes) class _ClosingReferences(_GraphModel): @@ -1497,21 +1488,13 @@ class _ClosingRead(NamedTuple): error: str = "" -class _BoardRead(NamedTuple): - """The number of the roadmap board, or why it could not be read.""" - - number: int = 0 - error: str = "" - - # GitHub fills `closingIssuesReferences` from the closing keywords of a PR into the default # branch and from the issues linked to it by hand; it closes each one when the PR merges. _CLOSING_ISSUES_QUERY = ( - "query($owner: String!, $name: String!, $number: Int!, $issues: Int!, $cards: Int!) {" + "query($owner: String!, $name: String!, $number: Int!, $issues: Int!, $labels: Int!) {" " repository(owner: $owner, name: $name) { pullRequest(number: $number) {" " closingIssuesReferences(first: $issues) { totalCount nodes { number state" - " repository { nameWithOwner } projectItems(first: $cards) { nodes { project { number" - " owner { ... on User { login } ... on Organization { login } } } } } } } } } }" + " repository { nameWithOwner } labels(first: $labels) { nodes { name } } } } } } }" ) @@ -1522,7 +1505,7 @@ def closing_issues_args(owner: str, repo_name: str, pr_num: int) -> list[str]: "name": repo_name, "number": pr_num, "issues": CONST_PR_CLOSING_ISSUES_PAGE, - "cards": CONST_PR_CLOSING_ISSUE_CARDS_PAGE, + "labels": CONST_PR_CLOSING_ISSUE_LABELS_PAGE, } return [CONST_GH_CLI, *graphql_args(_CLOSING_ISSUES_QUERY, variables)] @@ -1552,23 +1535,10 @@ def _read_closing_issues(owner: str, repo_name: str, pr_num: int) -> _ClosingRea return _ClosingRead(tuple(references.nodes), references.total_count) -def _read_roadmap_board(repo: str) -> _BoardRead: - """The board `.github/roadmap.toml` names on the default branch, read through the roadmap - store as every roadmap job reads it.""" - from devops_cli.roadmap import store as roadmap_store - from devops_cli.roadmap.config import read_roadmap_config - - try: - config = read_roadmap_config(roadmap_store.get_roadmap_store(repo), ref=None) - except (ConfigurationError, GitHubOperationError) as exc: - return _BoardRead(error=str(exc)[:CONST_MAX_ERROR_DETAIL_LENGTH]) - return _BoardRead(config.board) - - class _Grounding(NamedTuple): """What the grounding checks judge: the PR's base and its repository's default branch, the - files it changes, the issues it closes, read only into the default branch, and the roadmap - board, read only when it closes exactly one issue.""" + files it changes, and the issues it closes with their labels, read only into the default + branch.""" pr_num: int owner: str @@ -1577,7 +1547,6 @@ class _Grounding(NamedTuple): default: str changed: _ChangedFilesRead closing: _ClosingRead | None = None - board: _BoardRead | None = None @property def into_default(self) -> bool: @@ -1652,26 +1621,12 @@ def _closes_an_open_issue(grounding: _Grounding) -> str | None: ) -def _board_was_read(grounding: _Grounding) -> str | None: - """The roadmap board was read, so the board check has something to judge.""" - board = grounding.board - if board is None or not board.error: - return None - return MESSAGES.pr.grounding_board_unread.format( - number=grounding.pr_num, path=CONST_ROADMAP_CONFIG_PATH, error=board.error - ) - - -def _closes_an_issue_on_the_board(grounding: _Grounding) -> str | None: - """The one issue the PR closes is on the roadmap board.""" - issue, board = grounding.own_issue, grounding.board - if issue is None or board is None or board.error: - return None - if issue.is_on_board(grounding.owner, board.number): +def _closes_an_item(grounding: _Grounding) -> str | None: + """The one issue the PR closes is a roadmap Item: it holds a `priority/*` label.""" + issue = grounding.own_issue + if issue is None or issue.is_item(): return None - return MESSAGES.pr.grounding_issue_off_board.format( - number=grounding.pr_num, issue=issue.number, board=board.number - ) + return MESSAGES.pr.grounding_issue_not_item.format(number=grounding.pr_num, issue=issue.number) def _changed_files_were_read(grounding: _Grounding) -> str | None: @@ -1775,8 +1730,7 @@ def _writes_only_its_own_record(grounding: _Grounding) -> str | None: _closes_one_issue, _closes_an_issue_of_its_repository, _closes_an_open_issue, - _board_was_read, - _closes_an_issue_on_the_board, + _closes_an_item, _changed_files_were_read, _archives_its_change, _writes_only_its_own_record, @@ -1786,25 +1740,21 @@ def _writes_only_its_own_record(grounding: _Grounding) -> str | None: def _read_grounding( pr_data: dict[str, Any], pr_num: int, owner: str, repo_name: str, changed: _ChangedFilesRead ) -> _Grounding: - """What the checks judge, read lazily: the closing issues only into the default branch, and - the board only for a PR that closes exactly one issue of its own repository.""" + """What the checks judge, read lazily: the closing issues only into the default branch.""" repo = f"{owner}/{repo_name}" base, default = _branch_ref(pr_data, "base"), _default_branch(pr_data) grounding = _Grounding(pr_num, owner, repo, base, default, changed) if not grounding.into_default: return grounding - grounding = grounding._replace(closing=_read_closing_issues(owner, repo_name, pr_num)) - if grounding.own_issue is None: - return grounding - return grounding._replace(board=_read_roadmap_board(repo)) + return grounding._replace(closing=_read_closing_issues(owner, repo_name, pr_num)) def _grounding_blockers( pr_data: dict[str, Any], pr_num: int, owner: str, repo_name: str, changed: _ChangedFilesRead ) -> list[str]: """Hold a PR to the one item it delivers: it targets the default branch and closes exactly - one open issue of its repository that is on the roadmap board, and it archives that issue's - change. + one open issue of its repository that is a roadmap Item, with a `priority/*` label, and it + archives that issue's change. It applies where the base holds `openspec/changes/`. Where it does not apply, an unread file list is a warning, since only the perimeter warning reads it. @@ -1967,8 +1917,8 @@ def check_readiness( """Validate PR merge readiness: conflicts, draft state, checks, review threads and grounding. Grounding applies where the base holds openspec/changes/. The PR targets the default branch. - It closes exactly one issue, an open issue of its own repository that is on the roadmap - board that .github/roadmap.toml names. GitHub closes that issue when the PR merges. The PR + It closes exactly one issue, an open issue of its own repository that holds a priority/* + label: a roadmap item. GitHub closes that issue when the PR merges. The PR adds openspec/changes/archive/--/, which uv run devops openspec archive writes for that issue's change. Only that archive writes openspec/specs/ and openspec/changes/archive/. diff --git a/src/devops_cli/commands/roadmap.py b/src/devops_cli/commands/roadmap.py index 75d9c73ec4..c443e36d01 100644 --- a/src/devops_cli/commands/roadmap.py +++ b/src/devops_cli/commands/roadmap.py @@ -1,33 +1,27 @@ """`devops roadmap`: the roadmap on GitHub. Intake is the one way new work becomes an item, refine readies items, and return sends an item back to New. -Every command reads `.github/roadmap.toml` through the contents API at `--ref`, then opens the -roadmap store on the board it names. `intake`, `refine` and `return` write GitHub state only -with `--confirm`, and never a commit. A person plans the milestones on the board; no command -sets one. +Every command opens the roadmap store of the repository: labels and milestones hold the Items +and their fields, and no command reads or writes a project board (ADR 0016). Intake reads +`.github/labels.yml` at `--ref`. `intake`, `refine` and `return` write GitHub state only with +`--confirm`, and never a commit. A person plans the milestones; no command sets one. Every job's `--dry-run` makes no request at all (#412, #1125): it returns the job's result type marked as a dry run and prints the requests a run makes, each with its exact `gh` command. Intake's `--plan`, and intake with no mode flag, read GitHub and call the model, and write -nothing. Every run that reads ends with the GraphQL points it spent and the points left. +nothing. """ from __future__ import annotations -import logging from collections.abc import Collection, Iterator, Sequence from contextlib import contextmanager from dataclasses import replace from pathlib import Path -from typing import TYPE_CHECKING, Annotated, NoReturn +from typing import Annotated, NoReturn import typer -from devops_cli.config.constants import ( - CONST_ROADMAP_INTAKE_BOARD_FILTER, - CONST_ROADMAP_REFINE_BOARD_FILTER, - CONST_ROADMAP_RUN_BOARD_FILTER, -) from devops_cli.config.defaults import DEFAULT_ROADMAP_REFINE_LIMIT from devops_cli.core.cli import new_typer from devops_cli.core.repo import get_repo_origin_name @@ -35,7 +29,7 @@ from devops_cli.exceptions import DevOpsCLIError, RoadmapRunError from devops_cli.lang import HELP, MESSAGES from devops_cli.output import print_error, print_info, print_success, write_stdout -from devops_cli.roadmap.config import RoadmapConfig, open_roadmap +from devops_cli.roadmap import store as roadmap_store from devops_cli.roadmap.intake import ( Filer, NewCandidate, @@ -52,11 +46,6 @@ from devops_cli.roadmap.request_plan import render_dry_run from devops_cli.roadmap.store import RoadmapStore -if TYPE_CHECKING: - from devops_cli.roadmap.github_store import GhRunner - -logger = logging.getLogger(__name__) - app = new_typer(help=HELP.roadmap.app, no_args_is_help=True) RepoOption = Annotated[str | None, typer.Option("--repo", "-R", help=HELP.roadmap.repo)] @@ -82,14 +71,10 @@ def _target(repo: str | None) -> str: return target -def _open_roadmap( - repo: str | None, ref: str | None, board_filter: str, runner: GhRunner | None = None -) -> tuple[str, RoadmapConfig, RoadmapStore]: - """The repository, its roadmap configuration on `ref`, and the store on its board, whose - board reads pass the job's Projects filter.""" +def _open_store(repo: str | None) -> tuple[str, RoadmapStore]: + """The repository and its roadmap store.""" target = _target(repo) - config, store = open_roadmap(target, ref=ref, runner=runner, board_filter=board_filter) - return target, config, store + return target, roadmap_store.get_roadmap_store(target) def _one_mode(**modes: bool) -> None: @@ -100,23 +85,6 @@ def _one_mode(**modes: bool) -> None: _refuse(MESSAGES.roadmap.plan_modes_exclusive.format(modes=listed)) -@contextmanager -def _reporting_spend(stores: list[RoadmapStore]) -> Iterator[None]: - """End the run, however it ends, with the GraphQL points it spent and the points left, read - from GraphQL itself, once it has opened a store that spends them (#1125).""" - try: - yield - finally: - for store in stores: - try: - spend = store.graphql_spend() - except DevOpsCLIError as exc: - logger.warning("Could not read the GraphQL budget: %s", exc) - continue - if spend is not None: - print_info(spend.line()) - - def _refuse(message: str) -> NoReturn: print_error(message) raise typer.Exit(1) @@ -186,9 +154,7 @@ def intake_cmd( return if not (plan_only or confirm): print_info(MESSAGES.roadmap.intake_plain_note) - opened: list[RoadmapStore] = [] - with _reporting_spend(opened): - _intake(repo, ref, issue or (), new, limit, confirm=confirm, opened=opened) + _intake(repo, ref, issue or (), new, limit, confirm=confirm) def _intake( @@ -199,13 +165,11 @@ def _intake( limit: int | None, *, confirm: bool, - opened: list[RoadmapStore], ) -> None: with _exit_on_failure("Could not plan intake"): # Counts from here the requests the identity's ledger paces, gh's and the session's. meter = SpendMeter() - target, _config, store = _open_roadmap(repo, ref, CONST_ROADMAP_INTAKE_BOARD_FILTER) - opened.append(store) + target, store = _open_store(repo) plan = plan_intake( store, repo=target, @@ -230,8 +194,6 @@ def _intake( print_success(MESSAGES.roadmap.intake_applied.format(placed=applied.placed)) for number in applied.filed: print_info(MESSAGES.roadmap.intake_filed.format(number=number)) - for number in applied.finished: - print_info(MESSAGES.roadmap.intake_finished.format(number=number)) with _exit_on_failure("Intake finished with candidates it could not write"): raise_for_failed_placements(applied) @@ -239,7 +201,6 @@ def _intake( @app.command("refine", help=HELP.roadmap.refine) def refine_cmd( repo: RepoOption = None, - ref: RefOption = None, source: Annotated[Path, typer.Option("--source", help=HELP.roadmap.refine_source)] = Path("."), item: Annotated[int | None, typer.Option("--item", help=HELP.roadmap.refine_item)] = None, limit: Annotated[ @@ -259,7 +220,7 @@ def refine_cmd( from devops_cli.roadmap.refine import dry_run_refine from devops_cli.roadmap.request_plan import render_dry_run - plan = dry_run_refine(target_repo, ref=ref, item=item, limit=limit) + plan = dry_run_refine(target_repo, item=item, limit=limit) render_dry_run("refine", target_repo, plan.requests, plan.write_requests) return @@ -270,37 +231,31 @@ def refine_cmd( render_refine_plan, ) - opened: list[RoadmapStore] = [] - with _reporting_spend(opened): - with _exit_on_failure("Could not plan refinement"): - _, _config, store = _open_roadmap(target_repo, ref, CONST_ROADMAP_REFINE_BOARD_FILTER) - opened.append(store) - plan = plan_refine( - store, repo=target_repo, source=source, ref=ref, item_number=item, limit=limit + with _exit_on_failure("Could not plan refinement"): + _, store = _open_store(target_repo) + plan = plan_refine(store, repo=target_repo, source=source, item_number=item, limit=limit) + write_stdout(render_refine_plan(plan) + "\n") + if not confirm: + print_info(MESSAGES.roadmap.preview_only) + elif plan.has_writes: + with _exit_on_failure("Could not apply refinement"): + applied = apply_refine(store, plan) + print_success( + f"Refined {applied.refined_count} item(s): {applied.readied_count} set to " + f"Ready, {applied.split_count} marked for split." ) - write_stdout(render_refine_plan(plan) + "\n") - if not confirm: - print_info(MESSAGES.roadmap.preview_only) - elif plan.has_writes: - with _exit_on_failure("Could not apply refinement"): - applied = apply_refine(store, plan) - print_success( - f"Refined {applied.refined_count} item(s): {applied.readied_count} set to " - f"Ready, {applied.split_count} marked for split." - ) - with _exit_on_failure("Refinement incomplete"): - raise_for_failed_items(plan) + with _exit_on_failure("Refinement incomplete"): + raise_for_failed_items(plan) @app.command("run", help=HELP.roadmap.run) def run_cmd( repo: RepoOption = None, - ref: RefOption = None, dry_run: Annotated[bool, typer.Option("--dry-run", help=HELP.roadmap.run_dry_run)] = False, confirm: Annotated[bool, typer.Option("--confirm", help=HELP.roadmap.run_confirm)] = False, ) -> None: """Run the roadmap jobs that are due, in order: metrics, intake and refinement.""" - target, _config, store = _open_roadmap(repo, ref, CONST_ROADMAP_RUN_BOARD_FILTER) + target, store = _open_store(repo) from devops_cli.roadmap.run import run_due_jobs if dry_run or not confirm or is_dry_run(): @@ -342,11 +297,10 @@ def return_cmd( Path | None, typer.Option("--comment-file", help=HELP.roadmap.return_comment_file) ] = None, repo: RepoOption = None, - ref: RefOption = None, dry_run: Annotated[bool, typer.Option("--dry-run", help=HELP.roadmap.return_dry_run)] = False, confirm: Annotated[bool, typer.Option("--confirm", help=HELP.roadmap.return_confirm)] = False, ) -> None: - """Return an item to New on the roadmap board with an evidence comment.""" + """Return an item to New on the roadmap with an evidence comment.""" _one_mode(dry_run=dry_run, confirm=confirm) clean_comment = _resolve_comment(comment, comment_file) target = _target(repo) @@ -363,14 +317,11 @@ def return_cmd( render_dry_run("return", target, reads, writes) return - opened: list[RoadmapStore] = [] - with _reporting_spend(opened): - with _exit_on_failure("Could not return roadmap item"): - _, _cfg, store = _open_roadmap(target, ref, CONST_ROADMAP_REFINE_BOARD_FILTER) - opened.append(store) - plan = plan_return(store, item, clean_comment, target) - if not confirm: - write_stdout(render_return_plan(plan) + "\n\nPlan only: pass --confirm to apply.\n") - return - apply_return(store, plan) - print_success(f"Returned item #{item} to New and posted evidence comment.") + with _exit_on_failure("Could not return roadmap item"): + _, store = _open_store(target) + plan = plan_return(store, item, clean_comment, target) + if not confirm: + write_stdout(render_return_plan(plan) + "\n\nPlan only: pass --confirm to apply.\n") + return + apply_return(store, plan) + print_success(f"Returned item #{item} to New and posted evidence comment.") diff --git a/src/devops_cli/commands/serve.py b/src/devops_cli/commands/serve.py index 26a7c69279..4d8b13b2d2 100644 --- a/src/devops_cli/commands/serve.py +++ b/src/devops_cli/commands/serve.py @@ -168,7 +168,7 @@ def serve( if service: from devops_cli.config.settings import load_settings - from devops_cli.roadmap.run import SERVICE_JOBS, identity_refused, service_pause_until + from devops_cli.roadmap.run import SERVICE_JOBS, identity_refused from devops_cli.server.json_logs import service_log_config from devops_cli.server.service import create_service_app @@ -183,7 +183,6 @@ def serve( jobs=SERVICE_JOBS, settings=settings, secrets=parsed_secrets, - pause_until=service_pause_until, identity_refused=identity_refused, ), factory=True, diff --git a/src/devops_cli/config/constants.py b/src/devops_cli/config/constants.py index 1b0a4955c9..6228e1dac2 100644 --- a/src/devops_cli/config/constants.py +++ b/src/devops_cli/config/constants.py @@ -1505,8 +1505,6 @@ class WebhookExposure(StrEnum): "closed": "closed", "merged": "closed", } -CONST_GH_PROJECT_ITEM_ISSUE_TYPE: Final[str] = "Issue" -CONST_GH_PROJECT_JOB_RECORD_FIELD: Final[str] = "Job record" CONST_GH_ISSUE_EVENT_CHANGE_KINDS: Final[dict[str, str]] = { "labeled": "labeled", "unlabeled": "unlabeled", @@ -1548,7 +1546,7 @@ class WebhookExposure(StrEnum): CONST_ERROR_CODE_TELEMETRY = "TELEMETRY_ERROR" CONST_ERROR_CODE_LOGFIRE = "LOGFIRE_CONFIG_ERROR" CONST_ERROR_CODE_SERVICE_STATUS = "SERVICE_STATUS_ERROR" -CONST_ERROR_CODE_ROADMAP_CARD_CHANGED = "ROADMAP_CARD_CHANGED" +CONST_ERROR_CODE_ROADMAP_ITEM_CHANGED = "ROADMAP_ITEM_CHANGED" CONST_ERROR_CODE_ROADMAP_REFINE_FAILED = "ROADMAP_REFINE_FAILED" CONST_ERROR_CODE_ROADMAP_INTAKE_FAILED = "ROADMAP_INTAKE_FAILED" CONST_ERROR_CODE_LIBRARY_INGESTION = "LIBRARY_INGESTION_ERROR" @@ -2816,16 +2814,9 @@ class WebhookExposure(StrEnum): "deepseek-reasoner", ) -# ── Roadmap on GitHub (ADR 0001) ────────────────────────────────────────────── -# Repository files every roadmap runner reads through the contents API at one ref. -CONST_ROADMAP_CONFIG_PATH: Final[str] = ".github/roadmap.toml" -# The Projects filter each board read passes at the source, archived items always left out -# (#1125). "" reads every item not archived, open and closed: intake looks up any issue it is -# given, and refine reads a milestone's items. The backlog and the candidates read open items only. -CONST_ROADMAP_OPEN_ITEMS_FILTER: Final[str] = "is:open" -CONST_ROADMAP_INTAKE_BOARD_FILTER: Final[str] = "" -CONST_ROADMAP_RUN_BOARD_FILTER: Final[str] = "" -CONST_ROADMAP_REFINE_BOARD_FILTER: Final[str] = "" +# ── Roadmap on GitHub (ADR 0001, ADR 0016) ──────────────────────────────────── +# The hidden block at the end of an issue body that holds its job record (ADR 0016). +CONST_ROADMAP_RECORD_MARKER: Final[str] = "devops-roadmap-record" CONST_ROADMAP_REFINE_START_MARKER: Final[str] = "" CONST_ROADMAP_REFINE_END_MARKER: Final[str] = "" CONST_ROADMAP_REFINE_MAX_BODY_CHARS: Final[int] = 65536 @@ -2862,23 +2853,38 @@ class WebhookExposure(StrEnum): ) CONST_PROJECT_TEMPLATE_PATH: Final[str] = ".github/project-template.json" CONST_ROADMAP_EPIC_LABEL: Final[str] = "type/epic" -# The board's Status options (`.github/project-template.json`) the roadmap jobs read. +# An Item's Status values, in the order of their labels' family (`status/new`, ...; ADR 0016). +# A closed issue is done, so no label holds Done. CONST_ROADMAP_STATUS_NEW: Final[str] = "New" CONST_ROADMAP_STATUS_READY: Final[str] = "Ready" CONST_ROADMAP_STATUS_IN_PROGRESS: Final[str] = "In Progress" -CONST_ROADMAP_STATUS_DONE: Final[str] = "Done" +CONST_ROADMAP_STATUS_IN_REVIEW: Final[str] = "In Review" CONST_ROADMAP_STATUS_BLOCKED: Final[str] = "Blocked" -# The Status options of an open item refine never changes, even when `--item` names it (#1758). +CONST_ROADMAP_STATUS_VALUES: Final[tuple[str, ...]] = ( + CONST_ROADMAP_STATUS_NEW, + CONST_ROADMAP_STATUS_READY, + CONST_ROADMAP_STATUS_IN_PROGRESS, + CONST_ROADMAP_STATUS_IN_REVIEW, + CONST_ROADMAP_STATUS_BLOCKED, +) +# The Status values of an open item refine never changes, even when `--item` names it (#1758). CONST_ROADMAP_REFINE_HELD_STATUSES: Final[frozenset[str]] = frozenset( - {CONST_ROADMAP_STATUS_IN_PROGRESS, CONST_ROADMAP_STATUS_DONE, CONST_ROADMAP_STATUS_BLOCKED} + {CONST_ROADMAP_STATUS_IN_PROGRESS, CONST_ROADMAP_STATUS_BLOCKED} ) # A critical fix is a P0 item that fixes a defect or a security advisory (CONTEXT.md): the -# board's P0 Priority option and one of these `type/*` labels. +# P0 Priority and one of these `type/*` labels. CONST_ROADMAP_CRITICAL_PRIORITY: Final[str] = "P0-Critical" CONST_ROADMAP_P0_PRIORITY: Final[str] = "P0" CONST_ROADMAP_P1_PRIORITY: Final[str] = "P1-High" CONST_ROADMAP_P2_PRIORITY: Final[str] = "P2-Medium" CONST_ROADMAP_P3_PRIORITY: Final[str] = "P3-Low" +# An Item's Priority values, in the order of their labels' family (`priority/p0-critical`, ...). +CONST_ROADMAP_PRIORITY_VALUES: Final[tuple[str, ...]] = ( + CONST_ROADMAP_CRITICAL_PRIORITY, + CONST_ROADMAP_P1_PRIORITY, + CONST_ROADMAP_P2_PRIORITY, + CONST_ROADMAP_P3_PRIORITY, +) CONST_ROADMAP_P0_PRIORITIES: Final[frozenset[str]] = frozenset( {CONST_ROADMAP_CRITICAL_PRIORITY, CONST_ROADMAP_P0_PRIORITY} ) @@ -2898,7 +2904,7 @@ class WebhookExposure(StrEnum): CONST_ROADMAP_SOURCE_AGENT_LABEL: Final[str] = "source/agent" # The Priority options the model may propose; only verified evidence sets P0-Critical. CONST_ROADMAP_MODEL_PRIORITIES: Final[tuple[str, ...]] = ("P1-High", "P2-Medium", "P3-Low") -# The Value and Effort options (`.github/project-template.json`). +# The Value and Effort values, in the order of their labels' families (`value/high`, ...). CONST_ROADMAP_SIZE_OPTIONS: Final[tuple[str, ...]] = ("High", "Medium", "Low") # An author with write access, as GitHub's author_association says. CONST_ROADMAP_TRUSTED_AUTHORS: Final[frozenset[str]] = frozenset( @@ -2910,7 +2916,6 @@ class WebhookExposure(StrEnum): "failed_run": re.compile(r"[0-9]{1,20}"), "regression_commit": re.compile(r"[0-9a-fA-F]{7,40}"), } -CONST_GH_PROJECT_SINGLE_SELECT_TYPE: Final[str] = "SINGLE_SELECT" CONST_GH_RAW_CONTENT_ACCEPT: Final[str] = "Accept: application/vnd.github.raw+json" # ── Multi-Scale Semantic Outline & Inspection Scanner ──────────────────────── @@ -3411,8 +3416,8 @@ class WebhookExposure(StrEnum): # ── Pull Request Grounding ─────────────────────────────────────────────────── # Readiness holds a pull request to the one item it delivers: it targets the default branch, -# closes exactly one open issue of its repository that is on the roadmap board, and archives that -# issue's OpenSpec change (`CONST_OPENSPEC_ARCHIVED_FOLDER_RE`). GitHub closes the issue when the +# closes exactly one open issue of its repository that holds a `priority/*` label (a roadmap +# item), and archives that issue's OpenSpec change (`CONST_OPENSPEC_ARCHIVED_FOLDER_RE`). GitHub closes the issue when the # pull request merges. # The `pulls/{n}/files` statuses under which the path is new in the pull request's head. GitHub's # full set is added, removed, modified, renamed, copied, changed (mode only) and unchanged. @@ -3420,10 +3425,10 @@ class WebhookExposure(StrEnum): # The `pulls/{n}/files` status of a file that the pull request deletes from its head. CONST_PR_FILE_REMOVED_STATUS: Final[str] = "removed" # GitHub's `closingIssuesReferences` page sizes for one readiness read: the issues a pull request -# closes, where more than one is already a blocker, and the board cards of each, where an issue -# on more boards than GraphQL's page maximum of 100 does not occur. +# closes, where more than one is already a blocker, and the labels of each, GraphQL's page +# maximum of 100. CONST_PR_CLOSING_ISSUES_PAGE: Final[int] = 10 -CONST_PR_CLOSING_ISSUE_CARDS_PAGE: Final[int] = 100 +CONST_PR_CLOSING_ISSUE_LABELS_PAGE: Final[int] = 100 # The `gh pr list --author` value `devops pr update --all` lists with: the account gh runs as, # so a pull request that a bot or another person owns is never updated. CONST_PR_UPDATE_AUTHOR: Final[str] = "@me" diff --git a/src/devops_cli/exceptions/__init__.py b/src/devops_cli/exceptions/__init__.py index 701b3b8cab..acf822a89a 100644 --- a/src/devops_cli/exceptions/__init__.py +++ b/src/devops_cli/exceptions/__init__.py @@ -42,8 +42,8 @@ KubernetesLoggingError, ) from devops_cli.exceptions.roadmap import ( - RoadmapCardChangedError, RoadmapIntakeError, + RoadmapItemChangedError, RoadmapRefineError, RoadmapRunError, ) @@ -133,8 +133,8 @@ "KubernetesError", "KubernetesLoggingError", "LogfireConfigurationError", - "RoadmapCardChangedError", "RoadmapIntakeError", + "RoadmapItemChangedError", "RoadmapRefineError", "RoadmapRunError", "SSRFBlockedError", diff --git a/src/devops_cli/exceptions/roadmap.py b/src/devops_cli/exceptions/roadmap.py index 44d65c75e1..e58296ba24 100644 --- a/src/devops_cli/exceptions/roadmap.py +++ b/src/devops_cli/exceptions/roadmap.py @@ -6,8 +6,8 @@ from typing import Any from devops_cli.config.constants import ( - CONST_ERROR_CODE_ROADMAP_CARD_CHANGED, CONST_ERROR_CODE_ROADMAP_INTAKE_FAILED, + CONST_ERROR_CODE_ROADMAP_ITEM_CHANGED, CONST_ERROR_CODE_ROADMAP_REFINE_FAILED, ) from devops_cli.exceptions.base import DevOpsCLIError @@ -42,11 +42,11 @@ def is_configuration_only(self) -> bool: return isinstance(cause, ConfigurationError) -class RoadmapCardChangedError(GitHubOperationError): - """Raised before a job's board write that would revert a change made since it read the card. +class RoadmapItemChangedError(GitHubOperationError): + """Raised before a job's field write that would revert a change made since it read the Item. The job planned without that change, so writing would revert it (ADR 0002). Nothing is - written; the next run reads the board again and plans with the change. + written; the next run reads the issue again and plans with the change. """ def __init__( @@ -59,7 +59,7 @@ def __init__( super().__init__( message, operation=operation, - error_code=CONST_ERROR_CODE_ROADMAP_CARD_CHANGED, + error_code=CONST_ERROR_CODE_ROADMAP_ITEM_CHANGED, details=details, ) diff --git a/src/devops_cli/github/issues.py b/src/devops_cli/github/issues.py index 747d2669c3..bda8c68367 100644 --- a/src/devops_cli/github/issues.py +++ b/src/devops_cli/github/issues.py @@ -5,7 +5,7 @@ import json import logging from collections import Counter -from collections.abc import Collection, Iterable +from collections.abc import Iterable from typing import Any from urllib.parse import urlencode @@ -14,13 +14,13 @@ from devops_cli.config.constants import CONST_GH_CLI from devops_cli.config.defaults import DEFAULT_GH_REST_PER_PAGE from devops_cli.exceptions.git import ( - GitHubFileNotFoundError, GitHubOperationError, GitHubUnreadError, ) from devops_cli.github.rate_limiter import run_gh from devops_cli.github.session import get_github_session -from devops_cli.roadmap.store import RoadmapStore +from devops_cli.roadmap import store as roadmap_store +from devops_cli.roadmap.store import GitHubState, RoadmapStore logger = logging.getLogger(__name__) @@ -47,9 +47,7 @@ class IssueTriageAudit(BaseModel): valid_count: int = 0 issues_missing_type: list[int] = Field(default_factory=list) issues_missing_scope: list[int] = Field(default_factory=list) - issues_missing_priority: list[int] = Field(default_factory=list) issues_awaiting_intake: list[int] = Field(default_factory=list) - priority_not_checked: bool = False @property def compliance_rate(self) -> float: @@ -345,184 +343,72 @@ def create_repository_issue( return _parse_created_issue(res.stdout, title, body, assigned_milestone, labels) -def _resolve_store(repo: str, store: RoadmapStore | None) -> RoadmapStore | None: - """Return the given RoadmapStore or attempt to open it from repository configuration.""" - if store is not None: - return store - try: - from devops_cli.roadmap.config import open_roadmap - - _, opened = open_roadmap(repo, ref=None) - return opened - except GitHubFileNotFoundError: - return None +def _open_store(repo: str, store: RoadmapStore | None) -> RoadmapStore: + """The given roadmap store, else the roadmap store of `repo`.""" + return store if store is not None else roadmap_store.get_roadmap_store(repo) -def _audit_board_store( - store: RoadmapStore, awaiting_intake: Collection[int] | None -) -> IssueTriageAudit: - """Evaluate open board items and candidates against repository taxonomy rules.""" - board_items = store.items() - open_board_items = [it for it in board_items if str(it.state).lower() == "open"] - candidates = store.candidates() - audit = IssueTriageAudit(total_open=len(open_board_items) + len(candidates)) - awaiting_set = ( - set(awaiting_intake) if awaiting_intake is not None else {c.number for c in candidates} - ) +def _has_prefix(labels: Iterable[str], prefix: str) -> bool: + return any(label.startswith(prefix) for label in labels) - for candidate in candidates: - audit.issues_awaiting_intake.append(candidate.number) - for item in open_board_items: - if item.number in awaiting_set: - audit.issues_awaiting_intake.append(item.number) - continue - has_type = any(lbl.startswith("type/") for lbl in item.labels) - has_scope = any(lbl.startswith("scope/") for lbl in item.labels) - has_priority = bool(item.priority and item.priority.strip()) +def audit_issues_triage(repo: str, *, store: RoadmapStore | None = None) -> IssueTriageAudit: + """Audit open issues against the mandatory taxonomy labels. - is_valid = True + An open issue with no Priority is a Candidate, reported once, as awaiting intake: `devops + roadmap intake` gives it its type and Priority (#742). Every other open issue is an Item, + which holds a Priority, and must hold a `type/*` and a `scope/*` label. A backlog item has + no milestone, so a missing milestone is no finding. + """ + roadmap = _open_store(repo, store) + open_items = [item for item in roadmap.items() if item.state is GitHubState.OPEN] + candidates = roadmap.candidates() + audit = IssueTriageAudit( + total_open=len(open_items) + len(candidates), + issues_awaiting_intake=sorted(candidate.number for candidate in candidates), + ) + for item in open_items: + has_type = _has_prefix(item.labels, "type/") + has_scope = _has_prefix(item.labels, "scope/") if not has_type: audit.issues_missing_type.append(item.number) - is_valid = False if not has_scope: audit.issues_missing_scope.append(item.number) - is_valid = False - if not has_priority: - audit.issues_missing_priority.append(item.number) - is_valid = False - - if is_valid: - audit.valid_count += 1 - - audit.issues_missing_type.sort() - audit.issues_missing_scope.sort() - audit.issues_missing_priority.sort() - audit.issues_awaiting_intake.sort() - return audit - - -def _audit_rest_issues( - open_issues: list[GitHubIssue], awaiting_intake: Collection[int] | None -) -> IssueTriageAudit: - """Evaluate REST queried open issues when no roadmap board is present.""" - audit = IssueTriageAudit(total_open=len(open_issues), priority_not_checked=True) - awaiting_set = set(awaiting_intake or ()) - - for issue in open_issues: - if issue.number in awaiting_set: - audit.issues_awaiting_intake.append(issue.number) - continue - has_type = any(lbl.startswith("type/") for lbl in issue.labels) - has_scope = any(lbl.startswith("scope/") for lbl in issue.labels) - - is_valid = True - if not has_type: - audit.issues_missing_type.append(issue.number) - is_valid = False - if not has_scope: - audit.issues_missing_scope.append(issue.number) - is_valid = False - - if is_valid: + if has_type and has_scope: audit.valid_count += 1 - audit.issues_missing_type.sort() audit.issues_missing_scope.sort() - audit.issues_missing_priority.sort() - audit.issues_awaiting_intake.sort() return audit -def audit_issues_triage( - repo: str, - *, - awaiting_intake: Collection[int] | None = None, - store: RoadmapStore | None = None, -) -> IssueTriageAudit: - """Audit open issues against mandatory taxonomy labeling rules and board Priority. - - An issue in `awaiting_intake`, open and not on the roadmap board, is reported once, as - awaiting intake: `devops roadmap intake` gives it its type and Priority (#742). A backlog - item has no milestone, so a missing milestone is no finding. - """ - resolved_store = _resolve_store(repo, store) - if resolved_store is not None: - return _audit_board_store(resolved_store, awaiting_intake) - open_issues = get_repository_issues(repo, state="open", limit=None) - return _audit_rest_issues(open_issues, awaiting_intake) - - -def _summarize_board_store(store: RoadmapStore) -> dict[str, Any]: - """Aggregate open issues from board items and candidates by priority, type, and milestone.""" - board_items = store.items() - open_board_items = [it for it in board_items if str(it.state).lower() == "open"] - candidates = store.candidates() - total_open = len(open_board_items) + len(candidates) +def get_issues_summary(repo: str, *, store: RoadmapStore | None = None) -> dict[str, Any]: + """Count the open issues by Priority, type and milestone: the open Items and the + Candidates, which hold no Priority.""" + roadmap = _open_store(repo, store) + open_items = [item for item in roadmap.items() if item.state is GitHubState.OPEN] + candidates = roadmap.candidates() priority_counter: Counter[str] = Counter() type_counter: Counter[str] = Counter() milestone_counter: Counter[str] = Counter() - - for item in open_board_items: + for item in open_items: if item.priority: priority_counter[item.priority] += 1 - for lbl in item.labels: - if lbl.startswith("type/"): - type_counter[lbl] += 1 - if item.milestone: - milestone_counter[item.milestone] += 1 - else: - milestone_counter["no-milestone"] += 1 - - for candidate in candidates: - for lbl in candidate.labels: - if lbl.startswith("type/"): - type_counter[lbl] += 1 - if candidate.milestone: - milestone_counter[candidate.milestone] += 1 - else: - milestone_counter["no-milestone"] += 1 - + for labels, milestone in [ + *((item.labels, item.milestone) for item in open_items), + *((candidate.labels, candidate.milestone) for candidate in candidates), + ]: + for label in labels: + if label.startswith("type/"): + type_counter[label] += 1 + milestone_counter[milestone or "no-milestone"] += 1 return { - "total_open": total_open, + "total_open": len(open_items) + len(candidates), "by_priority": dict(priority_counter), "by_type": dict(type_counter), "by_milestone": dict(milestone_counter), } -def _summarize_rest_issues(open_issues: list[GitHubIssue]) -> dict[str, Any]: - """Aggregate REST queried open issues by priority, type, and milestone.""" - priority_counter: Counter[str] = Counter() - type_counter: Counter[str] = Counter() - milestone_counter: Counter[str] = Counter() - - for issue in open_issues: - for lbl in issue.labels: - if lbl.startswith("type/"): - type_counter[lbl] += 1 - if issue.milestone: - milestone_counter[issue.milestone] += 1 - else: - milestone_counter["no-milestone"] += 1 - - return { - "total_open": len(open_issues), - "by_priority": dict(priority_counter), - "by_type": dict(type_counter), - "by_milestone": dict(milestone_counter), - } - - -def get_issues_summary(repo: str, *, store: RoadmapStore | None = None) -> dict[str, Any]: - """Calculate aggregate issue counts by priority, type, and milestone.""" - resolved_store = _resolve_store(repo, store) - if resolved_store is not None: - return _summarize_board_store(resolved_store) - open_issues = get_repository_issues(repo, state="open", limit=None) - return _summarize_rest_issues(open_issues) - - def _is_trivial_milestone(milestone: str | int | None) -> bool: """Check if milestone parameter is empty or explicitly clearing.""" if milestone is None: diff --git a/src/devops_cli/github/metrics.py b/src/devops_cli/github/metrics.py index e15b905932..9bfcdf41fb 100644 --- a/src/devops_cli/github/metrics.py +++ b/src/devops_cli/github/metrics.py @@ -4,7 +4,7 @@ - Release frequency and cadence (intervals in days between releases). - Commits and merged pull requests per release. - CI quality gate checks and workflow run pass rates. -- Project board items counted by milestone, state, type and priority. +- Roadmap Items counted by milestone, state, type and priority. - Open issues grouped by taxonomy label (type, scope). - OpenTelemetry instrumentation for Prometheus export and Grafana visualization. """ @@ -26,7 +26,7 @@ from devops_cli.config.constants import CONST_ROADMAP_TYPE_LABEL_PREFIX from devops_cli.core.repo import find_worktree_root, get_repo_origin_name from devops_cli.github.client import GhCliClient, parse_paginated_json -from devops_cli.roadmap.config import open_roadmap +from devops_cli.roadmap import store as roadmap_store from devops_cli.roadmap.store import RoadmapStore from devops_cli.telemetry.instruments import ( PROJECT_CI_RUNS, @@ -85,9 +85,10 @@ class MilestoneMetric(BaseModel): class ItemCountMetric(BaseModel): - """The project board items that share a milestone, a state, a type and a priority. + """The roadmap Items that share a milestone, a state, a type and a priority. - A value is empty when the item has none: no milestone, no `type/*` label or no Priority. + A value is empty when the Item has none: no milestone or no `type/*` label. Every Item holds + a Priority. """ milestone: str = "" @@ -399,8 +400,9 @@ def _item_type(labels: Iterable[str]) -> str: def get_item_metrics( store: RoadmapStore, milestone_filter: str | None = None ) -> list[ItemCountMetric]: - """Count the items of the board of `store`, open and closed, by milestone, state, type and - priority (#2263). Raises when the board cannot be read, so a failed read is no empty board.""" + """Count the Items of `store`, open and closed, by milestone, state, type and priority + (#2263): the issues that hold a `priority/*` label. Raises when the issues cannot be read, + so a failed read is no empty roadmap.""" counts = Counter( (item.milestone or "", item.state.value, _item_type(item.labels), item.priority or "") for item in store.items() @@ -548,12 +550,11 @@ def collect_project_metrics_report( milestone_filter: str | None = None, store: RoadmapStore | None = None, ) -> ProjectMetricsReport: - """Aggregate complete project metrics across releases, CI checks, milestones, and the items - of the project board. + """Aggregate complete project metrics across releases, CI checks, milestones, and the + roadmap's Items. - The items are read through `store`, the roadmap store on the board; without one, through - the board that `.github/roadmap.toml` of the repository names. A board that cannot be read - raises. + The Items are read through `store`, the roadmap store of the job; without one, through the + roadmap store of the repository. Issues that cannot be read raise. The releases are the `v*` tags of the git repository at `root`, taken as it is, so a clone nested in another checkout, as the roadmap jobs keep under the data directory, reports its @@ -564,8 +565,8 @@ def collect_project_metrics_report( target_repo = repo or get_repo_origin_name(project_root) or "repository" now_str = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%d %H:%M:%S UTC") - board = store if store is not None else open_roadmap(target_repo, ref=None)[1] - items = get_item_metrics(board, milestone_filter=milestone_filter) + roadmap = store if store is not None else roadmap_store.get_roadmap_store(target_repo) + items = get_item_metrics(roadmap, milestone_filter=milestone_filter) releases = get_release_cadence_metrics(project_root, limit=release_limit) workflow_runs = get_ci_workflow_metrics(target_repo, limit=ci_limit) milestones = get_milestone_metrics(target_repo, milestone_filter=milestone_filter) diff --git a/src/devops_cli/github/owner_lookup.py b/src/devops_cli/github/owner_lookup.py index fc08b9cda9..5fd3e333a4 100644 --- a/src/devops_cli/github/owner_lookup.py +++ b/src/devops_cli/github/owner_lookup.py @@ -23,7 +23,7 @@ from devops_cli.config.defaults import DEFAULT_GH_GRAPHQL_BUDGET_FLOOR from devops_cli.exceptions.git import GitHubOperationError, GitHubUnauthenticatedError from devops_cli.github.error_classifier import classify_gh_failure -from devops_cli.roadmap.board_read import GraphQLBudgetPayload, graphql_budget_args +from devops_cli.github.project_read import GraphQLBudgetPayload, graphql_budget_args # Runs one gh command, given without its leading `gh`, and returns the finished process. GhRead = Callable[[list[str]], subprocess.CompletedProcess[str]] diff --git a/src/devops_cli/roadmap/board_read.py b/src/devops_cli/github/project_read.py similarity index 60% rename from src/devops_cli/roadmap/board_read.py rename to src/devops_cli/github/project_read.py index 7d98db3884..44317633a8 100644 --- a/src/devops_cli/roadmap/board_read.py +++ b/src/devops_cli/github/project_read.py @@ -1,35 +1,29 @@ -"""Paged, filtered GraphQL reads of a roadmap board, and the GraphQL points they spend (#1125). +"""Paged GraphQL reads of a GitHub project board, and the GraphQL points they spend (#1125). -`gh project item-list` pages the board itself with queries that ask for every field of every -item, filters nothing, and reports no cost, so one read spent about 2,000 of GraphQL's 5,000 -hourly points while the rate limiter counted one call. The store reads the board with its own -query instead, a page of `DEFAULT_GH_PROJECT_ITEM_PAGE_SIZE` items at a time, each page asking -for the item fields the store keeps and for `rateLimit`, so `run_gh` charges the points GitHub -reports. Every read passes the reading job's Projects filter as `items(query:)` and leaves -archived items out (`archivedStates: [NOT_ARCHIVED]`); the total it checks the read against is -the same connection's `totalCount`, so it counts the same items. +`devops gh project reconcile` reads a board with these. `gh project item-list` pages the board +itself with queries that ask for every field of every item and report no cost, so one read spent +about 2,000 of GraphQL's 5,000 hourly points while the rate limiter counted one call. The board +is read with its own query instead, a page of `DEFAULT_GH_PROJECT_ITEM_PAGE_SIZE` items at a +time, each page asking for the item fields kept and for `rateLimit`, so `run_gh` charges the +points GitHub reports. Every read passes a Projects filter as `items(query:)` and leaves archived +items out (`archivedStates: [NOT_ARCHIVED]`); the total it checks the read against is the same +connection's `totalCount`, so it counts the same items. Before the pages, one small query (`RoadmapBoardBudget`) reads the points left and the filter's total; a read that would leave fewer than `DEFAULT_GH_GRAPHQL_BUDGET_FLOOR` points refuses there, having spent nothing on pages, and a read stops before any page while fewer than the floor are -left. +left. Each refusal carries the budget's reset in its details (`CONST_GRAPHQL_REFUSAL_RESET_KEY`). -A write reads only the card it writes (#1361): `RoadmapBoardCard` reads one item by its node id, -archived or not, with the same item fields a page holds and `rateLimit`, for about one point -whatever the board's size, and a write refuses before it starts while fewer than the floor are -left. A write leaves an archived card alone; the add that names an issue's archived card restores -it (#1403). The documents are fixed templates, validated against GitHub's public schema in a test. - -Each refusal carries the budget's reset in its details (`CONST_GRAPHQL_REFUSAL_RESET_KEY`), -which the Service reads to hold every repository's rounds until then (#1400). - -This module only builds `gh` arguments and reads payloads; the store runs them, so a request plan -can list the same argv the store sends. +The `gh project` argument builders that reconcile sends (`field_list_args`, `item_edit_args`) +are here too. This module only builds `gh` arguments and reads payloads; the caller runs them, +so a request plan can list the same argv. The documents are fixed templates, validated against +GitHub's public schema in a test. No roadmap job reads a board (ADR 0016). """ from __future__ import annotations import math +from collections.abc import Sequence from datetime import datetime from typing import Any @@ -46,7 +40,6 @@ BOARD_ITEMS_OPERATION = "RoadmapBoardItems" BOARD_BUDGET_OPERATION = "RoadmapBoardBudget" -BOARD_CARD_OPERATION = "RoadmapBoardCard" GRAPHQL_BUDGET_OPERATION = "RoadmapGraphQLBudget" _RATE_LIMIT = "rateLimit { cost limit remaining used resetAt }" @@ -57,7 +50,7 @@ ) _FIELD_NAME = "field { ... on ProjectV2FieldCommon { name } }" _REPOSITORY_CONTENT = "number title url repository { nameWithOwner }" -# The item fields the store keeps, the same in a page and in a one-card read. +# The item fields a page keeps. _ITEM_SELECTION = ( "id content { __typename ... on DraftIssue { title } " f"... on Issue {{ {_REPOSITORY_CONTENT} }} " @@ -80,12 +73,6 @@ ) """One page of the board's items that `$filter` selects, archived ones left out.""" -BOARD_CARD_QUERY = ( - f"query {BOARD_CARD_OPERATION}($id: ID!, $fieldValues: Int!) {{ {_RATE_LIMIT} " - f"node(id: $id) {{ ... on ProjectV2Item {{ isArchived {_ITEM_SELECTION} }} }} }}" -) -"""One board item by its node id, archived or not, with the fields a page holds.""" - BOARD_BUDGET_QUERY = ( f"query {BOARD_BUDGET_OPERATION}($owner: String!, $number: Int!, $filter: String!) {{ " f"{_RATE_LIMIT} " @@ -141,20 +128,69 @@ def board_budget_args(owner: str, number: int | str, board_filter: str) -> list[ ) -def board_card_args(card_id: str) -> list[str]: - """The `gh` arguments of the read of one board item by its node id.""" - return _graphql_args( - BOARD_CARD_QUERY, - ("id", card_id), - typed=("-F", f"fieldValues={DEFAULT_GH_PROJECT_FIELD_LIMIT}"), - ) - - def graphql_budget_args() -> list[str]: """The `gh` arguments of the query that reads the GraphQL points left.""" return _graphql_args(GRAPHQL_BUDGET_QUERY) +def field_list_args(owner: str, number: int | str) -> list[str]: + """`gh project field-list`: every board field's options by name. gh also reads the board's + first 100 items with every field value (about 101 points); project reconcile sends it + (#892).""" + limit = str(DEFAULT_GH_PROJECT_FIELD_LIMIT) + return [ + "project", + "field-list", + str(number), + "--owner", + owner, + "--format", + "json", + "--limit", + limit, + ] + + +def item_edit_args( + owner: str, number: int | str, url: str, field_name: str, change: Sequence[str] +) -> list[str]: + """`gh project item-edit` on the issue at `url`, by the field's name. gh resolves both names + with a read of the board's first 100 items with every field value (about 101 points); + project reconcile sends this (#892).""" + return [ + "project", + "item-edit", + str(number), + "--owner", + owner, + "--url", + url, + "--field", + field_name, + *change, + ] + + +class _NamedPayload(BaseModel): + name: str + + +class _BoardFieldPayload(BaseModel): + name: str + options: list[_NamedPayload] = Field(default_factory=list) + + +class FieldListingPayload(BaseModel): + """The reply to `field_list_args`: every board field, with its options by name (#892).""" + + fields: list[_BoardFieldPayload] + total_count: int = Field(alias="totalCount") + + def options(self) -> dict[str, tuple[str, ...]]: + """Each field's option names by field name; a field that is not single-select has none.""" + return {field.name: tuple(option.name for option in field.options) for field in self.fields} + + class GraphQLBudget(BaseModel): """GraphQL's rate limit as a response reports it: what the query cost, and what is left.""" @@ -167,49 +203,6 @@ class GraphQLBudget(BaseModel): reset_at: datetime = Field(alias="resetAt") -class GraphQLSpend(BaseModel): - """The GraphQL points a run spent and the points left, as GraphQL reported them.""" - - model_config = ConfigDict(frozen=True) - - spent: int - remaining: int - reset_at: datetime - reset_during_run: bool = False - - def line(self) -> str: - """The one line a run ends with.""" - texts = MESSAGES.roadmap - template = texts.graphql_spend_since_reset if self.reset_during_run else texts.graphql_spend - return template.format( - spent=self.spent, remaining=self.remaining, reset=utc_clock(self.reset_at) - ) - - def round_line(self, repo: str) -> str: - """The one line a Service round of `repo` ends with: the points are the account's, which - every repository's rounds and other tools share (#1400).""" - texts = MESSAGES.roadmap - template = ( - texts.graphql_round_spend_since_reset - if self.reset_during_run - else texts.graphql_round_spend - ) - return template.format( - repo=repo, spent=self.spent, remaining=self.remaining, reset=utc_clock(self.reset_at) - ) - - -def spend_between(first: GraphQLBudget, last: GraphQLBudget) -> GraphQLSpend: - """What a run spent from the first response that reported the budget to the last: the - points used between them and the first query's own cost. A run the hourly reset crossed - counts what it spent since the reset.""" - reset = last.reset_at != first.reset_at - spent = last.used if reset else last.used - first.used + first.cost - return GraphQLSpend( - spent=spent, remaining=last.remaining, reset_at=last.reset_at, reset_during_run=reset - ) - - class _PageInfo(BaseModel): has_next_page: bool = Field(alias="hasNextPage") end_cursor: str | None = Field(default=None, alias="endCursor") @@ -253,39 +246,6 @@ class GraphQLBudgetPayload(BaseModel): rate_limit: GraphQLBudget = Field(validation_alias=AliasPath("data", "rateLimit")) -class _GraphQLError(BaseModel): - type: str | None = None - - -class BoardCardPayload(BaseModel): - """The answer to `RoadmapBoardCard`. A node id that resolves to nothing comes back as a null - node with a `NOT_FOUND` error, which `gh` reports by exiting 1 with the answer on stdout.""" - - rate_limit: GraphQLBudget = Field(validation_alias=AliasPath("data", "rateLimit")) - node: dict[str, Any] | None = Field(default=None, validation_alias=AliasPath("data", "node")) - errors: list[_GraphQLError] = Field(default_factory=list) - - def is_gone(self) -> bool: - """Whether GitHub says the node does not exist, and says nothing else went wrong.""" - return ( - self.node is None - and bool(self.errors) - and all(error.type == "NOT_FOUND" for error in self.errors) - ) - - def is_archived(self) -> bool: - """Whether the item is on the board but archived.""" - return bool((self.node or {}).get("isArchived")) - - def listed(self, *, archived: bool = False) -> dict[str, Any] | None: - """The item shaped as `gh project item-list` lists it, or None when it is gone or not a - board item, or archived unless `archived`.""" - node = self.node or {} - if "id" not in node or (self.is_archived() and not archived): - return None - return listing_item(node) - - def listing_item(node: dict[str, Any]) -> dict[str, Any]: """A board item node in the shape `gh project item-list` gives it: content keyed `type`, `repository` as `owner/name`, and each field's value under its name, first letter @@ -344,30 +304,14 @@ def require_budget(budget: GraphQLBudget, cost: int, what: str) -> None: """Refuse a read, before it spends anything, when it would leave less than the floor.""" if budget.remaining - cost < DEFAULT_GH_GRAPHQL_BUDGET_FLOOR: template = MESSAGES.roadmap.graphql_budget_refused - raise _refusal(template, budget, "roadmap.read", what, cost=cost) - - -def require_write_floor(budget: GraphQLBudget, what: str) -> None: - """Refuse a write, before it starts, while fewer points than the floor are left.""" - if budget.remaining < DEFAULT_GH_GRAPHQL_BUDGET_FLOOR: - template = MESSAGES.roadmap.graphql_budget_write_floor - raise _refusal(template, budget, "roadmap.write", what) + raise _refusal(template, budget, "project.read", what, cost=cost) def require_floor(budget: GraphQLBudget, what: str, page: int) -> None: """Stop a read before page `page` while fewer points than the floor are left.""" if budget.remaining < DEFAULT_GH_GRAPHQL_BUDGET_FLOOR: template = MESSAGES.roadmap.graphql_budget_floor - raise _refusal(template, budget, "roadmap.read", what, page=page) - - -def refusal_reset(exc: BaseException) -> datetime | None: - """The reset a GraphQL budget refusal names, or None for any other error, a rate limiter - error included.""" - if not isinstance(exc, GitHubRateLimitError): - return None - reset = exc.details.get(CONST_GRAPHQL_REFUSAL_RESET_KEY) - return None if reset is None else datetime.fromisoformat(reset) + raise _refusal(template, budget, "project.read", what, page=page) def utc_clock(moment: datetime) -> str: @@ -378,29 +322,24 @@ def utc_clock(moment: datetime) -> str: __all__ = [ "BOARD_BUDGET_OPERATION", "BOARD_BUDGET_QUERY", - "BOARD_CARD_OPERATION", - "BOARD_CARD_QUERY", "BOARD_ITEMS_OPERATION", "BOARD_ITEMS_QUERY", "GRAPHQL_BUDGET_OPERATION", "GRAPHQL_BUDGET_QUERY", "BoardBudgetPayload", - "BoardCardPayload", "BoardItemsPage", + "FieldListingPayload", "GraphQLBudget", "GraphQLBudgetPayload", - "GraphQLSpend", "board_budget_args", - "board_card_args", "board_items_args", + "field_list_args", "graphql_budget_args", + "item_edit_args", "item_list_key", "listing_item", "read_cost", - "refusal_reset", "require_budget", "require_floor", - "require_write_floor", - "spend_between", "utc_clock", ] diff --git a/src/devops_cli/github/projects.py b/src/devops_cli/github/projects.py index be685af231..b9d229f6f6 100644 --- a/src/devops_cli/github/projects.py +++ b/src/devops_cli/github/projects.py @@ -1,8 +1,8 @@ """GitHub Projects v2: the board template, its views, and reconciling Status on its cards. -Neither `devops gh project sync` nor `devops gh project reconcile` adds a card: intake -(`devops roadmap intake`) is the one way an issue reaches the board, and a pull request gets no -card, its progress showing on its issue's (#892). +Neither `devops gh project sync` nor `devops gh project reconcile` adds a card: a person, or the +board's own workflows, add them, and a pull request gets no card, its progress showing on its +issue's (#892). No roadmap job reads or writes a board: labels hold an Item's fields (ADR 0016). """ from __future__ import annotations @@ -46,25 +46,28 @@ unlisted_entry, ) from devops_cli.github.owner_lookup import owner_lookup_failure -from devops_cli.github.rate_limiter import ( - extract_json_payload, - get_github_rate_limiter, - run_gh, -) -from devops_cli.github.session import get_github_session -from devops_cli.lang import MESSAGES -from devops_cli.roadmap.board_read import ( +from devops_cli.github.project_read import ( BoardBudgetPayload, BoardItemsPage, + FieldListingPayload, GraphQLBudget, board_budget_args, board_items_args, + field_list_args, + item_edit_args, read_cost, require_budget, require_floor, utc_clock, ) -from devops_cli.roadmap.store import ItemField, require_option +from devops_cli.github.rate_limiter import ( + extract_json_payload, + get_github_rate_limiter, + run_gh, +) +from devops_cli.github.session import get_github_session +from devops_cli.lang import MESSAGES +from devops_cli.roadmap.store import ItemField logger = logging.getLogger(__name__) @@ -665,7 +668,6 @@ def _provision_single_field(owner: str, project_number: int, field: ProjectField def _fetch_existing_fields_by_name(owner: str, project_number: int) -> dict[str, Any]: """Retrieve existing fields indexed by lowercase name through fail-closed FieldListingPayload.""" - from devops_cli.roadmap.github_store import FieldListingPayload, field_list_args login = _project_login(owner) what = f"project #{project_number} fields" @@ -825,7 +827,6 @@ def _read_field_options(login: str, project_number: int) -> dict[str, tuple[str, Raises when the fields can't be read whole or the board has no Status options, so an unread field never lets every unset card default to New over its `status/*` label. """ - from devops_cli.roadmap.github_store import FieldListingPayload, field_list_args what = f"project #{project_number} fields" listing = _gh_read( @@ -996,7 +997,6 @@ class ReconcileResult(BaseModel): planned: list[FieldChange] = Field(default_factory=list) applied: list[FieldChange] = Field(default_factory=list) stop: str | None = None - awaiting_intake: int | None = None requests: tuple[PlannedRequest, ...] = () @property @@ -1029,31 +1029,11 @@ def stop_line(self) -> str | None: remaining = texts.remaining[count != 1].format(count=count) return texts.stopped.format(reason=self.stop, remaining=remaining) - def intake_line(self) -> str | None: - """How many open issues wait for intake, when the run listed open issues and found any.""" - count = self.awaiting_intake - if not count: - return None - return MESSAGES.project.awaiting_intake[count != 1].format(count=count) - def _item_url(item: Mapping[str, Any]) -> str: return str(item.get("html_url") or item.get("url") or "") -def _awaiting_intake( - issues: list[dict[str, Any]], board: Collection[str], state: str -) -> int | None: - """The open issues not on the board; None when the run listed no open issue.""" - if state == "closed": - return None - return sum( - 1 - for issue in issues - if str(issue.get("state", "")).lower() == "open" and _item_url(issue) not in board - ) - - def _stop_before_write(budget: MutationBudget) -> str | None: """Why the next write must not run: the mutation budget is spent, or the ledger, which the board's pages and the other runs sharing the identity keep, holds fewer GraphQL points @@ -1072,9 +1052,26 @@ def _stop_before_write(budget: MutationBudget) -> str | None: return None -def _item_edit_args(login: str, project_number: int | str, change: FieldChange) -> list[str]: - from devops_cli.roadmap.github_store import item_edit_args +def _require_option( + options: Mapping[str, Sequence[str]], field: ItemField, value: str | None +) -> None: + """Refuse a value that is not one of the board field's options.""" + if field.value not in options: + raise GitHubOperationError( + f"The board has no {field.value!r} field.", + operation="project.reconcile", + details={"field": field.value}, + ) + if value is not None and value not in options[field.value]: + raise GitHubOperationError( + f"{value!r} is not a {field.value} option on the board; " + f"the options are {', '.join(options[field.value])}.", + operation="project.reconcile", + details={"field": field.value, "value": value[:256]}, + ) + +def _item_edit_args(login: str, project_number: int | str, change: FieldChange) -> list[str]: return item_edit_args(login, project_number, change.url, change.field, ["--value", change.new]) @@ -1134,8 +1131,7 @@ def reconcile_project_custom_fields( ) -> ReconcileResult: """Reconcile Status on the cards already on the board, listing every change. - Reconcile adds no card: an issue off the board waits for intake, and a pull request gets no - card. It reads the board (refusing to start when GraphQL's budget can't cover the read), the + Reconcile adds no card, and a pull request gets no card. It reads the board (refusing to start when GraphQL's budget can't cover the read), the board's field options and the repository's issues and pull requests in `state`, then plans every change before making any, so `plan` and `write` evaluate the same cards and plan the same changes. A planned value the board's field has no option for refuses the run before @@ -1151,13 +1147,12 @@ def reconcile_project_custom_fields( on_board = [item for item in issues + prs if _item_url(item) in board] planned = _plan_changes(on_board, board, options[ItemField.STATUS]) for change in planned: - require_option(options, ItemField(change.field), change.new) + _require_option(options, ItemField(change.field), change.new) result = ReconcileResult( project_number=project_number, mode=mode, items_evaluated=len(on_board), planned=planned, - awaiting_intake=_awaiting_intake(issues, board, state), ) if mode == "plan": return result @@ -1179,7 +1174,6 @@ def reconcile_dry_run( Without a board number the run first finds the board `template` names. `writes` False lists a `plan` run, which stops before the writes. """ - from devops_cli.roadmap.github_store import field_list_args from devops_cli.roadmap.request_plan import planned_gh texts = MESSAGES.project @@ -1198,7 +1192,7 @@ def reconcile_dry_run( planned_gh( board_items_args(login, board, "", after=placeholders["cursor"]), targets["page"].format(board=board), - repeat=MESSAGES.roadmap.plan_repeat_board_page, + repeat=texts.request_repeat_page, ), planned_gh(field_list_args(login, board), targets["fields"].format(board=board)), _planned_listing(repo, "issues", state), diff --git a/src/devops_cli/lang/en/help.py b/src/devops_cli/lang/en/help.py index b8f0b51e5f..7d5cd990ad 100644 --- a/src/devops_cli/lang/en/help.py +++ b/src/devops_cli/lang/en/help.py @@ -1001,8 +1001,9 @@ class GHCommandHelp: project_sync: str = ( "Find or create the project board from its template, link it, create the fields it " "lacks, and reconcile Status and Priority on the cards already on it. Sync adds no issue " - "or pull request to the board: devops roadmap intake places issues, and a pull request's " - "progress shows on its issue's card. Exits 1 when reconcile stops early." + "or pull request to the board, and a pull request's progress shows on its issue's card. " + "No roadmap job reads the board: labels hold an item's fields. Exits 1 when reconcile " + "stops early." ) project_sync_dry_run: str = "Make no request and describe what a sync does." project_reconcile: str = ( @@ -1054,8 +1055,8 @@ class GHCommandHelp: ) issues_create: str = "Create a new issue linking milestone and taxonomy labels." issues_triage: str = ( - "Audit open issues for mandatory taxonomy labels, and report those not on the roadmap " - "board as awaiting intake." + "Audit open issues for mandatory taxonomy labels, and report those with no priority/* " + "label as awaiting intake." ) issues_status: str = "Display aggregated issue counts by priority, type, and milestone." issues_edit: str = "Edit an existing issue title, body, state, milestone, or taxonomy labels." @@ -1086,26 +1087,24 @@ class GHCommandHelp: @dataclass(frozen=True) class RoadmapCommandHelp: app: str = ( - "Read and write the roadmap on GitHub, its source of truth: issues, milestones and the " - "project board." + "Read and write the roadmap on GitHub, its source of truth: issues, their labels and " + "milestones." ) repo: str = "Repository as owner/name (default: this checkout's origin)." ref: str = ( - "Branch, tag or commit to read .github/roadmap.toml at (default: the repository's " + "Branch, tag or commit to read .github/labels.yml at (default: the repository's " "default branch)." ) intake: str = ( - "Turn candidates into items: every open issue not on the board, and every board item " - "intake left without a Priority. The model compares each with the board's items and the " - "issues closed as not planned, but not with an issue that has sub-issues, because its " - "sub-issues deliver it. It names a possible duplicate for a person to close: intake " - "never closes an issue and never drops a candidate. Each gets a type, a priority, Value " - "and Effort from the model with a reason comment, and goes to the backlog. Intake sets " - "no milestone: a person plans the milestones on the board, and a milestone an issue " - "has stays. An " - "open issue whose board card a person archived is a candidate too: intake restores the " - "card, which keeps its values and milestone; close the issue as not planned to keep it " - "off the roadmap. A candidate an agent files with --title and --body-file is labeled " + "Turn candidates into items: every open issue with no priority/* label. The model " + "compares each with the items and the issues closed as not planned, but not with an " + "issue that has sub-issues, because its sub-issues deliver it. It names a possible " + "duplicate for a person to close: intake never closes an issue and never drops a " + "candidate. Each gets a type, a status/new label, Value and Effort labels and a reason " + "comment, then its priority label last, and goes to the backlog. A label a person set " + "stays. Intake sets no milestone: a person plans the milestones, and a milestone an " + "issue has stays. Close an issue as not planned to keep it off the roadmap. A candidate " + "an agent files with --title and --body-file is labeled " "source/agent, and intake files it, a possible duplicate too, unless a run that stopped " "after filing left an open issue with its title and body, which intake then places; a " "text that looks like it holds a secret is refused. --dry-run makes no request and prints " @@ -1178,13 +1177,16 @@ class RoadmapCommandHelp: refine_confirm: str = "Refine the items and write the proposed designs to GitHub. Without it, refine prints its plan only." refine_dry_run: str = "Make no request and change no git ref: print what refine would plan and run, with placeholders." return_item: str = ( - "Return an item to New on the roadmap board with an evidence comment, handing it back to " - "refinement when it cannot be built as specified or needs a refactor beyond its scope." + "Return an item to New with an evidence comment, handing it back to refinement when it " + "cannot be built as specified or needs a refactor beyond its scope. The item gets the " + "label status/new in place of its other status/* label." ) return_item_arg: str = "The issue or item number to return to New." return_comment: str = "Evidence comment explaining why the item cannot be built as specified." return_comment_file: str = "Path to file containing the evidence comment." - return_confirm: str = "Make the writes to GitHub (post comment and set Status to New)." + return_confirm: str = ( + "Make the writes to GitHub: post the comment and set the Status to New (status/new)." + ) return_dry_run: str = ( "Make no request: print the requests a run makes, in order, with placeholders for " "values a read gives." diff --git a/src/devops_cli/lang/en/messages.py b/src/devops_cli/lang/en/messages.py index 95a952a493..2527040e81 100644 --- a/src/devops_cli/lang/en/messages.py +++ b/src/devops_cli/lang/en/messages.py @@ -955,12 +955,9 @@ class PRMessages: grounding_closes_closed_issue: str = ( "PR #{number} is not grounded: it closes #{issue}, which is not open." ) - grounding_board_unread: str = ( - "PR #{number} is not grounded: the roadmap board in {path} could not be read ({error})." - ) - grounding_issue_off_board: str = ( - "PR #{number} is not grounded: #{issue} is not on the roadmap board, project {board}. " - "File new work with devops roadmap intake, which puts it on the board." + grounding_issue_not_item: str = ( + "PR #{number} is not grounded: #{issue} is not a roadmap item: it holds no priority " + "label. Run devops roadmap intake on it." ) grounding_change_not_archived: str = ( "PR #{number} is not grounded: it adds no {folder} for #{issue}. Archive the change in" @@ -1563,41 +1560,16 @@ class RoadmapMessages: "GraphQL has {remaining} points left until {reset}, below the {floor} kept in reserve, " "so the read of {what} stopped before page {page}. Run it again after {reset}." ) - graphql_budget_write_floor: str = ( - "GraphQL has {remaining} points left until {reset}, below the {floor} kept in reserve, " - "so the run stopped before writing {what}. Run it again after {reset}." - ) - card_changed: str = ( - "{card}'s {field} is {now} on the board but was {read} when this run read it, so " - "someone changed it since and the run stopped before writing it. Nothing was written; " - "the next run reads the board again and plans with that change." - ) - card_value_unset: str = "unset" - board_count_changed: str = ( - "The {what} changed while they were read ({counts}), and again on a second read, so " - "the read is incomplete. Run it again once the board is still." - ) - board_items: str = "board #{number} items" - board_items_filtered: str = 'board #{number} items matching "{query}"' - board_reread: str = "The {what} changed while they were read ({counts}); reading them again." - graphql_spend: str = "GraphQL: {spent} points spent, {remaining} left until {reset}." - graphql_spend_since_reset: str = ( - "GraphQL: {spent} points spent since the hourly reset during the run, {remaining} left " - "until {reset}." - ) - # The line each Service round that sent GraphQL ends with (#1400). The points are the - # machine account's, which every repository's rounds share. - graphql_round_spend: str = ( - "{repo}: GraphQL, {spent} of the account's points spent during the round, {remaining} " - "left until {reset}." - ) - graphql_round_spend_since_reset: str = ( - "{repo}: GraphQL, {spent} of the account's points spent since the hourly reset during " - "the round, {remaining} left until {reset}." - ) - graphql_round_spend_unread: str = ( - "{repo}: could not read the GraphQL budget after the round, so it has no spend line: " - "{kind}: {error}" + item_changed: str = ( + "{item}'s {field} is {now} on GitHub but was {read} when this run read it, so someone " + "changed it since and the run stopped before writing it. Nothing was written; the next " + "run reads the issue again and plans with that change." + ) + item_value_unset: str = "unset" + field_value_unknown: str = "{value!r} is not a {field} value; the values are {values}." + record_unreadable: str = ( + "The job record block of {issue} holds no JSON object of text values, so it reads as " + "empty, and the next write of its record replaces it." ) # Every comment refine posts starts with its marker (#1758), so a later round finds a reply. refine_ready_comment: str = ( @@ -1674,26 +1646,17 @@ class RoadmapMessages: plan_dry_run_writes: str = "With --confirm, after the reads and before the last request:" plan_dry_run_title: str = "# devops roadmap {job} for {repo}" plan_dry_run_notes: tuple[str, ...] = ( - "A board read whose count changes while it is read reads it once more, from its first " - "page. Pacing a request, whether gh runs it or the GitHub session sends it, may read " - "`gh api rate_limit`; that read costs no quota. A board command whose owner lookup gh " - "could not finish reads GraphQL's budget once, for about one point.", + "Pacing a request, whether gh runs it or the GitHub session sends it, may read " + "`gh api rate_limit`; that read costs no quota.", ) plan_modes_exclusive: str = "Pass one of {modes}, not more." plan_repeat_page: str = "per page, while GitHub links a next one" - plan_repeat_board_page: str = "per page after the first, while GraphQL reports a next page" plan_placeholders: dict[str, str] = field( default_factory=lambda: { - "board": "", - "cursor": "", "number": "", "milestone": "", - "url": "", - "record": "", - "board_id": "", - "field_id": "", - "card_id": "", - "option_id": "