Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/roadmap/alternatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The request holds the entries as `decisions`, the newest ADR first. The text has

### How the job confirms a proposal

The model proposes `rejected` in the key `adr`, with the number of the ADR that rejected its tool. The job gives `rejected` when `decisions` holds that ADR and only its rejected options name the tool. A rejected option is an item of the `Considered Options` list that says `rejected` or `not chosen`. If the title or another option names the tool too, the ADR adopts the tool or decides on a part of it, and the job drops the proposal. ADR 0010 names OpenSpec in its chosen option and in two rejected options, so it rejects no OpenSpec. The comment shows the ADR number to a person.
The model proposes `rejected` in the key `adr`, with the number of the ADR that rejected its tool. The job gives `rejected` when `decisions` holds that ADR, an item of its `Considered Options` list names the tool, and no chosen or adopted option names it. A chosen or adopted option that names the tool wins even when it also says `not chosen` or `not adopted`. ADR 0010 names OpenSpec in its chosen option and in other options, so it rejects no OpenSpec. The comment shows the ADR number to a person.

The model proposes `in-use` in the key `in_use`. The job gives `in-use` when the title or the body of the item names the tool. It reads the body outside its own block and outside the refine section, because both name the tool of an earlier check. Without the flag of the model, the text of the item never gives `in-use`. The tools in use can (see [The tools in use](#the-tools-in-use)).

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-17
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Design

## Decisions

### Invert the rule around the chosen option

`rejects()` returns false when the title names the tool. Otherwise it collects the options that
name the tool. When none names it, the ADR does not reject it. When a chosen or adopted option is
among them, the ADR chose the tool and rejects nothing. Otherwise the option is one the decision
did not take, so the ADR rejects the tool. This matches the `Considered Options` section of an ADR
better than a list of rejection words.

### A chosen marker wins over a not-chosen phrase

`_says_chosen()` removes `not chosen` and `not adopted` from an option, then looks for `chosen` or
`adopted`. An option that says both is chosen, which is the safe result: it cannot reject a tool
that the ADR adopted.

### A deferred option counts as rejected

ADR 0018 says of `kubernetes-sigs/agent-sandbox` that the record does not measure it. No chosen or
adopted option names the tool, so the rule rejects it. A later ADR or a re-measurement changes the
answer, and the check runs again when the ADR changes.

### Replay the real ADR files

The replay test reads the ADR files in `docs/adr/` and asserts the four census rejections and the
ADR 0010 exclusion. A synthetic option alone would not prove the rule against the records that
showed the defect.

## Rejected alternatives

- **Keep the rejection words:** it drops the correct rejections of ADR 0018 and ADR 0024.
- **Reject only when the title names the tool:** it ignores the options and loses the census.
- **Treat a mixed-marker option as rejected:** it can reject a tool that the ADR adopted.
- **Exclude the deferred option:** it needs a fragile phrase list and delays a correct rejection.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Proposal: #5082

## Why

`rejects()` accepts an ADR rejection only when every option that names the tool says `rejected` or
`not chosen`. ADR 0018 lists `gVisor` and `nsjail` without those words, and ADR 0024 lists IBM
Carbon and GitHub Primer the same way, so the alternatives job drops correct rejections. #3827
then keeps a `covers` verdict for a tool that ADR 0018 did not choose. Closes #5082.

## What Changes

- `rejects()` inverts the rule: an ADR rejects a tool when an option names it and no chosen or
adopted option names it. The title still excludes a rejection.
- A chosen or adopted option wins even when it also says `not chosen` or `not adopted`.
- Tests replay the #4661 census cases, the mixed-marker case and the deferred-option case.
- `docs/roadmap/alternatives.md` and the `roadmap-alternatives` specification state the rule.

## Capabilities

### Modified

- `roadmap-alternatives`: the confirmation of a `rejected` proposal follows the inverted rule.

## Impact

The alternatives job keeps the four true rejections of the census and loses none. ADR 0010 still
does not reject OpenSpec. A deferred option counts as rejected, and the check runs again when the
ADR changes.

## Feasibility

Confirmed against the issue and the code: `rejects()` in `src/devops_cli/roadmap/adr.py` holds
the marker test, and `_options()` already gives each option's markdown. The real ADR files hold
the census cases, so the replay test needs no fixture.

## Existing Tool Considered

No open tool or library covers the need. The alternatives check of 2026-11-15 returned `none`: only
generic ADR authoring and parsing projects exist, and none supplies this project's rejection rule.
The change corrects the project's own rule in about 1,500 tokens to build.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## MODIFIED Requirements

### Requirement: The model proposes rejected and the job confirms it

The reply MAY hold the key `adr`: the number of the ADR that rejected the tool of a `covers` or
`partly` verdict. The job SHALL give `rejected` when the ADRs that the model saw hold that ADR, an
option of its `Considered Options` list names the tool, and no chosen or adopted option names it.
The check SHALL record the tool URL. The comment SHALL keep the tool line with the URL and name the
ADR as four digits. The block SHALL name the ADR too.

#### Scenario: Temporal and ADR 0008

- **WHEN** ADR 0008 holds the options line "Temporal and Hatchet: rejected." in strong emphasis, and the reply gives `covers` for `https://github.com/temporalio/temporal` with `adr` 8
- **THEN** the check has the verdict `rejected`, its comment holds the tool URL and `ADR 0008`, and its block names `ADR 0008`

#### Scenario: The record

- **WHEN** a run with `--confirm` writes that check
- **THEN** the job record holds the verdict `rejected` and the tool URL
- **AND** the counter `devops_cli_roadmap_alternatives_total` has a point with the `verdict` `rejected`

#### Scenario: The display name of the tool

- **WHEN** ADR 0008 says "DBOS Transact in-process (runner-up): rejected for now.", the tool is `dbos-inc/dbos-transact-py`, and the reply gives `tool_name` "DBOS Transact" and `adr` 8
- **THEN** the check has the verdict `rejected`

#### Scenario: A rejected tool that the item names

- **WHEN** the job confirms `adr` 8 and the body of the item names the tool too
- **THEN** the check has the verdict `rejected`

#### Scenario: An ADR that adopts the tool

- **WHEN** ADR 0010 names OpenSpec in its chosen option and in two options that say "rejected", and the reply gives `covers` for `https://github.com/Fission-AI/OpenSpec` with `adr` 10
- **THEN** the check has the verdict `covers` and no ADR

#### Scenario: An unmarked rejected option

- **WHEN** ADR 0018 has an option that names `google/gvisor` and no chosen or adopted option names it
- **THEN** the check has the verdict `rejected` and names ADR 0018

#### Scenario: The census replay

- **WHEN** the test reads ADR 0018 for gVisor and bubblewrap, ADR 0008 for APScheduler and ADR 0005
for `github/codeql`
- **THEN** each ADR rejects its tool

#### Scenario: A deferred option

- **WHEN** ADR 0018 names `kubernetes-sigs/agent-sandbox` only in an option that it does not measure
- **THEN** ADR 0018 rejects `kubernetes-sigs/agent-sandbox`

## ADDED Requirements

### Requirement: A chosen option wins over a not-chosen phrase

A chosen or adopted option that names the tool SHALL win over a `not chosen` or `not adopted`
phrase in the same option, so the ADR rejects no tool that it adopted.

#### Scenario: An option holds both markers

- **WHEN** an option names a tool and holds both `chosen` and `not chosen`
- **THEN** the job confirms no rejection of that tool
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Tasks

## 1. Behavior

- [x] 1.1 Write the failing replay tests for the #4661 census and the mixed-marker option.
- Verification: `$ uv run devops ci test tests/roadmap/test_roadmap_adr.py`
- [x] 1.2 Invert the rejection rule around the chosen or adopted option.
- Verification: `$ uv run devops ci test tests/roadmap/test_roadmap_adr.py`

## 2. Documents

- [x] 2.1 Correct the rule in `docs/roadmap/alternatives.md`.
- Verification: `$ uv run devops ci docs`
- [x] 2.2 Update the `roadmap-alternatives` specification.
- Verification: `$ uv run devops openspec check`
- [x] 2.3 Archive the change into the main specification.
- Verification: `$ uv run devops openspec archive 5082-adr-rejects-a-tool-that-no-chosen-option-names`
38 changes: 37 additions & 1 deletion openspec/specs/roadmap-alternatives/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,29 +465,55 @@ A text SHALL name a tool when it holds the full `owner/name` of the repository.
- **THEN** the text does not name the tool

### Requirement: The model proposes rejected and the job confirms it
The reply MAY hold the key `adr`: the number of the ADR that rejected the tool of a `covers` or `partly` verdict. The job SHALL give `rejected` when the ADRs that the model saw hold that ADR and only its options that say `rejected` or `not chosen` name the tool. The check SHALL record the tool URL. The comment SHALL keep the tool line with the URL and name the ADR as four digits. The block SHALL name the ADR too.

The reply MAY hold the key `adr`: the number of the ADR that rejected the tool of a `covers` or
`partly` verdict. The job SHALL give `rejected` when the ADRs that the model saw hold that ADR, an
option of its `Considered Options` list names the tool, and no chosen or adopted option names it.
The check SHALL record the tool URL. The comment SHALL keep the tool line with the URL and name the
ADR as four digits. The block SHALL name the ADR too.

#### Scenario: Temporal and ADR 0008

- **WHEN** ADR 0008 holds the options line "Temporal and Hatchet: rejected." in strong emphasis, and the reply gives `covers` for `https://github.com/temporalio/temporal` with `adr` 8
- **THEN** the check has the verdict `rejected`, its comment holds the tool URL and `ADR 0008`, and its block names `ADR 0008`

#### Scenario: The record

- **WHEN** a run with `--confirm` writes that check
- **THEN** the job record holds the verdict `rejected` and the tool URL
- **AND** the counter `devops_cli_roadmap_alternatives_total` has a point with the `verdict` `rejected`

#### Scenario: The display name of the tool

- **WHEN** ADR 0008 says "DBOS Transact in-process (runner-up): rejected for now.", the tool is `dbos-inc/dbos-transact-py`, and the reply gives `tool_name` "DBOS Transact" and `adr` 8
- **THEN** the check has the verdict `rejected`

#### Scenario: A rejected tool that the item names

- **WHEN** the job confirms `adr` 8 and the body of the item names the tool too
- **THEN** the check has the verdict `rejected`

#### Scenario: An ADR that adopts the tool

- **WHEN** ADR 0010 names OpenSpec in its chosen option and in two options that say "rejected", and the reply gives `covers` for `https://github.com/Fission-AI/OpenSpec` with `adr` 10
- **THEN** the check has the verdict `covers` and no ADR

#### Scenario: An unmarked rejected option

- **WHEN** ADR 0018 has an option that names `google/gvisor` and no chosen or adopted option names it
- **THEN** the check has the verdict `rejected` and names ADR 0018

#### Scenario: The census replay

- **WHEN** the test reads ADR 0018 for gVisor and bubblewrap, ADR 0008 for APScheduler and ADR 0005
for `github/codeql`
- **THEN** each ADR rejects its tool

#### Scenario: A deferred option

- **WHEN** ADR 0018 names `kubernetes-sigs/agent-sandbox` only in an option that it does not measure
- **THEN** ADR 0018 rejects `kubernetes-sigs/agent-sandbox`

### Requirement: The job drops a rejection that it cannot confirm
If the job cannot confirm the ADR of a reply, it SHALL drop the number, keep the verdict of the reply and write the check. It SHALL NOT refuse the reply for that reason. A reply with a verdict that names no tool SHALL keep its verdict.

Expand Down Expand Up @@ -806,3 +832,13 @@ The folded block of the comment SHALL show every source of the reply, and SHALL
#### Scenario: More than five sources
- **WHEN** the reply cites eight sources that the tools returned
- **THEN** the folded block shows all eight, no source is outside the block, and the comment has no line that counts sources left out

### Requirement: A chosen option wins over a not-chosen phrase

A chosen or adopted option that names the tool SHALL win over a `not chosen` or `not adopted`
phrase in the same option, so the ADR rejects no tool that it adopted.

#### Scenario: An option holds both markers

- **WHEN** an option names a tool and holds both `chosen` and `not chosen`
- **THEN** the job confirms no rejection of that tool
29 changes: 20 additions & 9 deletions src/devops_cli/roadmap/adr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

`names` is the test of the check whether a text names a tool. The check applies it to the title and
the body of an item, and to the text of an ADR. `rejects` is the test whether an ADR rejects a tool:
only its rejected options name the tool.
an option names it and no chosen or adopted option names it.
"""

from __future__ import annotations
Expand Down Expand Up @@ -54,9 +54,17 @@
# A space, `-`, `_` or `.` between the words of a tool name is one separator, so "Argo Workflows"
# names `argo-workflows`.
_SEPARATOR = r"[\s._-]+"
# An option of an ADR that the decision did not take says so: "rejected", "rejected for now" or
# "not chosen".
_REJECTED_OPTION = re.compile(r"\b(?:rejected|not chosen)\b", re.IGNORECASE)
# An option of an ADR that the decision took says "chosen" or "adopted". An option can also say
# that the decision did not take something, as in "chosen for the notes and not chosen for the
# tags": the chosen marker wins, so the safe test removes the negative phrases first.
_CHOSEN_OPTION = re.compile(r"\b(?:chosen|adopted)\b", re.IGNORECASE)
_NOT_CHOSEN_OPTION = re.compile(r"\bnot\s+(?:chosen|adopted)\b", re.IGNORECASE)


def _says_chosen(option: str) -> bool:
"""Whether `option` marks a chosen or adopted tool, even when it also says `not chosen`."""
return bool(_CHOSEN_OPTION.search(_NOT_CHOSEN_OPTION.sub("", option)))


# The number of another ADR in a link key: four digits in quotes. YAML reads an unquoted `0017` as
# the octal 15, so a strict string refuses it.
Expand Down Expand Up @@ -308,14 +316,17 @@ def _options(text: str) -> list[str]:


def rejects(adr: Adr, *tool_names: str) -> bool:
"""Whether `adr` rejects the tool that `tool_names` name (#4661): an option of its `Considered
Options` that says `rejected` or `not chosen` names the tool, and neither its title nor an
option that says neither names it. ADR 0010 names OpenSpec in rejected options, but its
chosen option names OpenSpec too, so it rejects no OpenSpec."""
"""Whether `adr` rejects the tool that `tool_names` name (#4661, #5082): an option of its
`Considered Options` names the tool, and neither its title nor a chosen or adopted option
names it. An option that an ADR defers counts as rejected, because the check runs again when
the ADR changes. ADR 0010 names OpenSpec in other options, but its chosen option names
OpenSpec too, so it rejects no OpenSpec."""
if names(adr.title, *tool_names):
return False
named = [option for option in _options(adr.options) if names(option, *tool_names)]
return bool(named) and all(_REJECTED_OPTION.search(option) for option in named)
if not named:
return False
return not any(_says_chosen(option) for option in named)


__all__ = [
Expand Down
55 changes: 53 additions & 2 deletions tests/roadmap/test_roadmap_adr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import datetime
import logging
from pathlib import Path

import pytest

Expand Down Expand Up @@ -385,7 +386,7 @@ def test_a_common_word_in_a_code_span_a_link_or_the_owner_name_form_names_the_to
pytest.param(
Adr(8, "Argo Workflows runs the jobs", OPTIONS),
("dbos-inc/dbos-transact-py", "DBOS"),
False,
True,
id="runner-up-option",
),
pytest.param(
Expand Down Expand Up @@ -423,7 +424,57 @@ def test_a_common_word_in_a_code_span_a_link_or_the_owner_name_form_names_the_to
),
],
)
def test_an_adr_rejects_a_tool_only_when_rejected_options_alone_name_it(
def test_an_adr_rejects_a_tool_when_no_chosen_or_adopted_option_names_it(
adr: Adr, tool_names: tuple[str, ...], rejected: bool
) -> None:
assert rejects(adr, *tool_names) is rejected


@pytest.mark.parametrize(
("option", "rejected"),
[
("**Changie**: chosen, although changie was not chosen for the tags.", False),
("**Changie**: not chosen, after a comparison.", True),
("**Changie**: adopted, then not adopted for the next release.", False),
],
ids=["chosen-and-not-chosen", "only-not-chosen", "adopted-and-not-adopted"],
)
def test_a_chosen_marker_wins_over_a_not_chosen_phrase(option: str, rejected: bool) -> None:
adr = Adr(11, "Releases", f"## Considered Options\n\n- {option}")
assert rejects(adr, "changie") is rejected


def _real_adr(number: int) -> Adr:
path = next(Path(ADR_DIRECTORY).glob(f"{number:04d}-*.md"))
adr = adr_of(f"{ADR_DIRECTORY}/{path.name}", path.read_text(encoding="utf-8"))
assert adr is not None
return adr


@pytest.mark.parametrize(
("number", "tool_names", "rejected"),
[
(18, ("google/gvisor", "gVisor"), True),
(18, ("containers/bubblewrap", "bubblewrap"), True),
(18, ("kubernetes-sigs/agent-sandbox",), True),
(24, ("IBM Carbon",), True),
(24, ("GitHub Primer", "Primer"), True),
(8, ("APScheduler",), True),
(5, ("github/codeql", "CodeQL"), True),
(10, ("Fission-AI/OpenSpec", "OpenSpec"), False),
],
ids=[
"gvisor",
"bubblewrap",
"deferred-agent-sandbox",
"ibm-carbon",
"github-primer",
"apscheduler",
"codeql",
"openspec-chosen",
],
)
def test_the_census_rejections_replay(
number: int, tool_names: tuple[str, ...], rejected: bool
) -> None:
assert rejects(_real_adr(number), *tool_names) is rejected