Skip to content

test: enforce the program allowlist and record it #5250

Open

Description

@dan-petty

Problem or Motivation

Child 12 of the ADR modernization (#5233). Decision (owner decision 4). It waits for the owner.

The review of each record that this item changes:

  • ADR 0007 (supersede after owner decision 4 (tests record)): The seam and fake rules hold (internal patches fell from 1,925 to 223). The program ban is not enforced: 67 live marks remain, and the openspec contract tests skip in CI. One ratchet over all of tests/ can go in now.

Proposed Solution & Architectural Design

Collection fails on a live mark outside the allowlist, which comes from the Dockerfile and the runner and devcontainer images. Remove the host skip at tests/conftest.py:1212-1250 and the git allowance at :555-556. Move the openspec cases to the openspec row. Fix docs/TESTING.md:74, :140 and :150 (the freezegun reason). A new tests record supersedes 0007, and 47 citation lines move.

Owner decision 4 of 2026-11-12: Option B, an enforced program allowlist. Only the programs that the devcontainer, the runner and the runner image all carry (sh, git, the interpreter, coreutils) are allowed. A mark outside the list fails at collection, and no host skips a test.

Rules of the ADR process (docs/adr/README.md, #5225) that apply:

  • Supersession: the new record sets 'supersedes', and the same PR sets status and 'superseded-by' on the old record. The test fails on a link that goes only one way. The new record restates each rule and each rejected option that still holds, because the alternatives check drops superseded records. Never amend a superseded record. After a third amendment, or when a body contradicts the code, the next change is a supersession.
  • Length: the body of a new record has 1,000 words or fewer, its title has 10 words or fewer, and its slug has 60 characters or fewer. Designs, catalogues, row tables, cutover plans, caps and measurements go to OpenSpec changes and specs, to settings or to docs, with a link under More Information.
  • Use one Considered Options section. Each bullet ends with 'chosen.', 'rejected, because .' or 'deferred until .'. 'Deferred' does not match the rejected regex (adr.py:49), so the check stops refusing on a premise that changed. Each record has a Confirmation section that names its test, CI row or metric, and an optional tracker key.
  • Code, tests and workflows cite the record in force. A test fails on a citation of a superseded record in src/, tests/ and .github/ (archived changes and CHANGELOG.md are history). Each superseding PR moves the citations of the records that it supersedes. Rename sweeps do not change docs/adr/.
  • Merge ADR changes in batches. Each change of the ADR set changes adr_hash (alternatives.py:634-644, 1006) and makes every checked item due again. So all pure status changes go in docs(adr): add MADR front matter, a Status History and the ADR rules #5225, and the record PRs merge one at a time in the planned order.
  • Keep the fix(roadmap): the ADRs in force fill the alternatives ADR budget #5049 budget test. A new record must fit in the tokens that the records it supersedes free. Short option bullets keep the budget, because options are 6,883 of the 8,464 tokens today.

The owner merges this pull request.

Target Subsystem

tests/conftest.py, docs/TESTING.md, src/devops_cli/commands/ci.py (the openspec row), docs/adr/.

Existing Tool Considered

pytest collection hooks and the image Dockerfile. No new tool.

Acceptance Criteria

  • Collection fails on a live mark outside the allowlist. The allowlist comes from the Dockerfile and the runner and devcontainer images, and a test checks it against the Dockerfile.
  • The host skip at tests/conftest.py:1212-1250 and the git allowance at :555-556 go.
  • The openspec contract cases run in the openspec row of devops ci.
  • docs/TESTING.md:74, :140 and :150 (the freezegun reason) are correct.
  • A new tests record supersedes ADR 0007, and the 47 citation lines move.
  • The index and link tests of docs(adr): add MADR front matter, a Status History and the ADR rules #5225 pass, and the fix(roadmap): the ADRs in force fill the alternatives ADR budget #5049 budget test passes: the alternatives check fits every record in force under its cap.

Dependencies

Owner decision 4 of 2026-11-12 is made. The ratchet item sets the ceilings that this item keeps.

Related

Source: #5233

Alternatives check of 2026-11-16: not-applicable.
Class: test, no search.
Tool: none found.

Proposed design

Problem statement

Make collection fail on a live mark outside the program allowlist, and supersede ADR 0007 with a new tests record. The suite does not enforce the allowlist now. A live mark outside the list still runs. The host skip hides a missing program, and the git allowance lets a test start a real git. The openspec contract cases skip in CI. This change adds LIVE_ALLOWLIST, removes the two allowances, moves the openspec cases to the openspec row, and corrects the freezegun reason. The owner merges the pull request alone, in the planned record order.

Acceptance criteria

Requirement: Unlisted live program fails collection

Collection MUST fail with a usage error when a test carries a live mark for a program outside LIVE_ALLOWLIST.

Scenario: An unlisted live program stops collection

  • WHEN A case in tests/roadmap/test_live_allowlist.py calls check_live_marks with an item that carries pytest.mark.live("curl").
  • THEN The call raises pytest.UsageError that names curl and the test id, and uv run pytest tests/roadmap/test_live_allowlist.py passes.

Requirement: Allowlist holds only base programs

LIVE_ALLOWLIST MUST hold only the base programs that RUNNER_TOOLS records for the Dockerfile and the devcontainer image.

Scenario: The allowlist matches the runner tools table

  • WHEN uv run pytest tests/roadmap/test_roadmap_runner_tools.py runs.
  • THEN The test passes and each entry of LIVE_ALLOWLIST is a base program of RUNNER_TOOLS.

Requirement: Suite collects with no unlisted mark

The whole test suite MUST collect with no live mark for a program outside LIVE_ALLOWLIST.

Scenario: The suite collects cleanly

  • WHEN uv run pytest --collect-only -q runs at the repository root.
  • THEN The command exits 0 and its output names no unlisted live program.

Requirement: No host skip

Collection MUST fail, and MUST NOT skip, when a live mark names an allowed program that PATH does not hold.

Scenario: An absent allowed program fails collection

  • WHEN A case calls check_live_marks with an item that carries pytest.mark.live("sh") and a which function that returns None for sh.
  • THEN The call raises pytest.UsageError that names sh, and the run reports no skip.

Requirement: No git allowance

The test suite MUST refuse a test that starts a real git.

Scenario: The hermetic floor refuses git

  • WHEN A case calls the hermetic floor's process guard with a command that starts git, and no git fake is in place.
  • THEN The guard refuses the command and names git.

Requirement: Openspec cases run in the openspec row

The openspec row of devops ci MUST run the openspec contract test cases.

Scenario: The openspec row runs the contract cases

  • WHEN uv run devops ci --check --only openspec runs.
  • THEN The row runs the openspec contract test suite and reports its result, and no contract case is skipped.

Requirement: Testing page gives the freezegun reason

docs/TESTING.md MUST give the frozen monotonic clock as the reason that the project does not use freezegun, and MUST NOT call freezegun unmaintained.

Scenario: The testing page gives the clock reason

  • WHEN ! git grep -n -F 'unmaintained' docs/TESTING.md and git grep -n -F 'monotonic' docs/TESTING.md run.
  • THEN The first command exits 0 with no match, and the second command exits 0 with the freezegun statement.

Requirement: New tests record supersedes ADR 0007

A new tests record MUST supersede ADR 0007, and both records MUST link to each other.

Scenario: The ADR record test and the index check pass

  • WHEN uv run pytest tests/invariants/test_adr_records.py and uv run devops docs check run.
  • THEN Both commands pass, the new record names supersedes: ["0007"], and ADR 0007 names status: superseded and superseded-by.

Requirement: Citations cite the record in force

Code, tests and workflows MUST cite the new tests record and MUST NOT cite superseded ADR 0007.

Scenario: No citation of ADR 0007 remains

  • WHEN ! git grep -n -E 'ADR 0007|0007-tests-double-only-process-edges' src tests .github runs.
  • THEN The command exits 0 with no match, and uv run pytest tests/invariants/test_adr_records.py passes.

Requirement: The record fits the budget

The new tests record MUST fit in the tokens that ADR 0007 frees under the #5049 budget test.

Scenario: The ADR budget test passes

  • WHEN uv run pytest tests/roadmap/test_roadmap_alternatives.py runs.
  • THEN The test passes and the new record stays under CONST_ROADMAP_ALTERNATIVES_MAX_ADR_TOKENS.

Requirement: Pending a person after the merge

The owner MUST merge the pull request alone, in the planned record order, before the change reaches main.

Scenario: The owner merges the record pull request

  • WHEN The checks pass and the pull request is ready.
  • THEN The owner merges the pull request, and no agent merges it.

Existing Tool Considered

The alternatives check of 2026-11-16 in the issue body gives not-applicable: class test, no search, and no tool found. pytest is the open, maintained tool that covers collection and markers. It lacks a program allowlist, so the change adds check_live_marks of about 25 lines in tests/support/live_marks.py and one constant in src/devops_cli/roadmap/runner_tools.py. The cost is about 4,000 tokens to build that code, about 1,000 tokens a year to keep and fix it, and under one day of work. The change builds no new tool or library.

Key questions

  • Which programs does LIVE_ALLOWLIST hold?: Owner decision 4 of 2026-11-12 admits only the programs that the devcontainer, the runner and the runner image all carry: sh, bash, git, python, python3, find, sleep, echo, pwd, true and false. curl, jq, ps, kubectl, openspec and devops are outside the list. A live mark for one of them moves to a fake, a contract suite or a CI row. (best practice) [sources: src/devops_cli/roadmap/runner_tools.py:119, docs/adr/0007-tests-double-only-process-edges.md]
    • Chosen: Only the base programs of the three images. Owner decision 4 names sh, git, the interpreter and coreutils, and RUNNER_TOOLS records those base entries with their source.
    • Rejected: Every program of the runner image. It admits curl, jq and the other tools that the owner decision does not name, and it keeps host-dependent live marks.
    • Rejected: Every program on the host PATH. It is the host-dependent behavior that owner decision 4 removes.
  • Where does the allowlist live, and how does a test check it against the images?: A LIVE_ALLOWLIST constant in src/devops_cli/roadmap/runner_tools.py sits beside RUNNER_TOOLS, so the table stays the one record of each program and its source. tests/roadmap/test_roadmap_runner_tools.py checks the set against the table and the Dockerfile. tests/support/live_marks.py imports the set for the collection check. (best practice) [sources: src/devops_cli/roadmap/runner_tools.py:119, tests/roadmap/test_roadmap_runner_tools.py, tests/support/markdown_examples.py]
    • Chosen: A LIVE_ALLOWLIST beside RUNNER_TOOLS. It gives one source of truth, and the runner-tool test already compares the table with the Dockerfile.
    • Rejected: A new constant file under tests/support/. It duplicates RUNNER_TOOLS and drifts from the image.
    • Rejected: Read the Dockerfile during collection. Collection would read a config file, and the runner-tool test checks the file instead.
  • How does collection fail on an unlisted live mark?: check_live_marks in tests/support/live_marks.py raises pytest.UsageError with each test id and its program. pytest_collection_modifyitems in tests/conftest.py calls it, so the run stops before any test starts. (best practice) [sources: tests/conftest.py]
    • Chosen: Raise pytest.UsageError from the collection hook. It stops collection and names the test and the program.
    • Rejected: Skip the test at run time. Owner decision 4 removes host skips.
    • Rejected: Warn and continue. The issue requires collection to fail.
  • What do the host skip and the git allowance do?: The body names the host skip at tests/conftest.py:1212-1250 and the git allowance at tests/conftest.py:555-556. The host skip hides a live program that the host lacks. The git allowance lets a test start a real git beside the hermetic floor. The change removes both. [sources: tests/conftest.py]
  • What does the new tests record change?: The new record supersedes ADR 0007 and restates each rule and each rejected option that still holds. It sets supersedes: ["0007"]. The same pull request sets status: superseded and superseded-by on ADR 0007, and adds its Superseded by line. (best practice) [sources: docs/adr/README.md, docs/adr/0007-tests-double-only-process-edges.md]
    • Chosen: Supersede ADR 0007 with a new record. The body contradicts the code, and the ADR process says the next change is a supersession.
    • Rejected: Amend ADR 0007. The ADR process forbids an amendment of a superseded record.
    • Rejected: Leave ADR 0007 in force. The program allowlist changes the rule that ADR 0007 records.
  • Which reason does docs/TESTING.md give for freezegun?: The page gives the frozen monotonic clock as the reason: it hangs asyncio and tenacity. The page does not call freezegun unmaintained. [sources: docs/TESTING.md]
  • How do the openspec contract cases run in the openspec row?: The openspec CheckSpec in src/devops_cli/commands/ci.py gains the contract test command as an extra command of the row. uv run devops ci --check --only openspec then runs devops openspec check and the contract cases. (best practice) [sources: src/devops_cli/commands/ci.py:172]
    • Chosen: The openspec row runs the contract cases. The issue moves the cases to the row, and CI then runs them.
    • Rejected: Keep the cases in the general test run. They skip in CI there.
    • Rejected: Delete the contract cases. The issue keeps them.
  • Do the live marks outside the allowlist move in this pull request?: Yes. Each mark for a program outside the list moves to a fake, a contract suite or a CI row in the same pull request. Collection cannot fail on an unlisted mark while one remains. (best practice) [sources: src/devops_cli/roadmap/runner_tools.py:119, tests/conftest.py]
    • Chosen: Move every mark outside the allowlist. Owner decision 4 fails collection on an unlisted mark, so each existing mark must fit the list or move.
    • Rejected: Add a ratchet over the marks. A ratchet keeps host-dependent marks, and owner decision 4 requires collection to fail.
    • Rejected: Grandfather the existing marks. It leaves the program ban unenforced, the finding that the review recorded.
  • Which citations move to the new record?: The citations in src/, tests/ and .github/ move to the new record. The archived OpenSpec changes and CHANGELOG.md keep their citations as history. The pages that name ADR 0007 also point to the new record. [sources: docs/adr/README.md]
  • What limits does the new tests record keep?: The body has 1,000 words or fewer, the title has 10 words or fewer, and the slug has 60 characters or fewer. The record must also fit in the tokens that ADR 0007 frees under CONST_ROADMAP_ALTERNATIVES_MAX_ADR_TOKENS. [sources: docs/adr/README.md, src/devops_cli/config/constants.py:3896]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5249, #5248

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/test
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: test. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 7a05312 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  7. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions