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

The test suite does not enforce the program allowlist that owner decision 4 of 2026-11-12 sets. Live marks outside the allowlist still run, the host skip hides missing programs, the git allowance lets a test start a real git, and the openspec contract cases skip in CI. This item makes collection fail on a live mark outside the allowlist, which is the base-program set beside RUNNER_TOOLS, removes the host skip and the git allowance, moves the openspec cases to the openspec row, corrects the freezegun reason in docs/TESTING.md, and supersedes ADR 0007 with a new tests record whose 47 citations move. The owner merges the pull request.

Acceptance criteria

Requirement: Live marks use the allowlist

Collection MUST fail when a test carries a live mark for a program outside the allowlist.

Scenario: An unlisted live program stops collection

  • WHEN A pytester case writes a test that carries @pytest.mark.live("curl"), curl is not in the allowlist, and the case runs uv run pytest --collect-only on that tree.
  • THEN pytest exits with a collection error that names curl and the test.

Requirement: Allowlist matches the images

The allowlist MUST be the LIVE_ALLOWLIST beside RUNNER_TOOLS, and that set MUST be the base programs that the Dockerfile and the devcontainer image carry.

Scenario: The test-tree check refuses a non-base live program

  • WHEN curl gains an entry in LIVE_ALLOWLIST, and uv run devops ci --check --only test-tree runs.
  • THEN The test-tree row fails and names curl as outside the base programs of the Dockerfile and the devcontainer image.

Requirement: No host skip

The test suite MUST NOT skip a test because the host lacks a live program.

Scenario: A missing allowed program does not skip a test

  • WHEN A test carries a live mark for an allowed program that is absent from PATH, and the suite runs.
  • THEN The test fails with the missing program, and the run reports no skip for that test.

Requirement: No git allowance

The test suite MUST NOT allow a test to start a real git.

Scenario: A test that starts git is refused

  • WHEN A test starts git without the git fake, and uv run pytest tests/invariants/test_hermetic_floor.py runs.
  • THEN The hermetic floor fails the test and names git.

Requirement: Openspec cases run in the openspec row

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

Scenario: The openspec row runs the contract cases

  • WHEN uv run devops ci --check --only openspec runs.
  • THEN The row runs uv run pytest -n 0 tests/openspec and reports its result.

Requirement: Testing document states the freezegun reason

docs/TESTING.md MUST state that freezegun is not used because its frozen monotonic clock hangs asyncio and tenacity, and MUST NOT call it unmaintained.

Scenario: The testing page gives the clock reason

  • WHEN ! git grep -n -F 'freezegun is not used: it is unmaintained' docs/TESTING.md runs, and uv run devops ci docs runs.
  • THEN The grep exits 0 with no match, and the docs row passes with the statement at docs/TESTING.md:156 giving the frozen monotonic clock reason.

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 link test passes

  • WHEN uv run pytest tests/invariants/test_adr_records.py runs.
  • THEN The test passes and the new record names supersedes: ["0007"] while ADR 0007 names status: superseded and superseded-by.

Requirement: Citations move to the record in force

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

Scenario: The superseded-citation test passes

  • WHEN uv run pytest tests/invariants/test_adr_superseded_citations.py runs.
  • THEN The test passes and no citation of ADR 0007 remains in src/, tests/ or .github/.

Requirement: The record budget holds

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 budget test passes and reports the new record under CONST_ROADMAP_ALTERNATIVES_MAX_ADR_TOKENS.

Requirement: No live mark names a program outside the allowlist

Every @pytest.mark.live in tests/ MUST name a program in the allowlist.

Scenario: The live-mark census finds no unlisted program

  • WHEN uv run pytest tests/roadmap/test_roadmap_runner_tools.py runs.
  • THEN The test passes and the live marks name only sh, bash, git, python, python3, find, sleep, echo, pwd, true and false.

Existing Tool Considered

The alternatives check of 2026-11-16 is not-applicable: class test, no search, no tool found. pytest is the open, maintained tool that covers collection and markers. It lacks the project-specific program allowlist, so the change adds a hook of about 20 lines in tests/conftest.py and a LIVE_ALLOWLIST constant beside RUNNER_TOOLS; no new tool or library is built. The project's RUNNER_TOOLS table remains the one record of each program and its source.

Key questions

  • Which programs does the allowlist permit?: Owner decision 4 of 2026-11-12 (fetched 2026-11-17) admits only the programs that the devcontainer, the GitHub runner and the runner image all carry: sh, bash, git, python, python3, and the base utilities find, sleep, echo, pwd, true and false. curl, jq, ps, kubectl, openspec and devops are outside the list; their live marks move to a fake, a contract suite or a CI row. (best practice) [sources: https://github.com/docs(adr): track the ADR modernization #5233, src/devops_cli/roadmap/runner_tools.py:117, src/devops_cli/roadmap/runner_tools.py:124, src/devops_cli/roadmap/runner_tools.py:162]
    • 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 the runner image holds. It would admit curl, jq and the other tools that the owner decision does not name and keep 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 is it checked against the images?: A LIVE_ALLOWLIST constant in src/devops_cli/roadmap/runner_tools.py holds the set: sh, bash, git, python, python3, find, sleep, echo, pwd, true and false. It sits beside RUNNER_TOOLS, so the table remains the one record of each program's source. The test-tree row checks the set against the table and the Dockerfile, and tests/conftest.py imports it for the collection hook. (best practice) [sources: src/devops_cli/roadmap/runner_tools.py:94, src/devops_cli/roadmap/runner_tools.py:143, tests/roadmap/test_roadmap_runner_tools.py:151, docs/CLUSTER.md:68]
    • Chosen: A LIVE_ALLOWLIST beside RUNNER_TOOLS. It gives one source of truth, and the existing runner-tool tests already compare the table with the Dockerfile.
    • Rejected: A new tests/support/live_programs.py constant. It duplicates RUNNER_TOOLS and drifts from the image.
    • Rejected: Parse the Dockerfile during collection. Collection would read a config file, which docs/TESTING.md forbids; the test-tree row checks the file instead.
  • How does collection fail on an unlisted live mark?: pytest_collection_modifyitems in tests/conftest.py raises pytest.UsageError with each item and its unlisted program. The run stops before any test starts. (best practice) [sources: tests/conftest.py:1261, tests/conftest.py:1286]
    • Chosen: Raise pytest.UsageError from pytest_collection_modifyitems. It fails collection with the item 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 does the new tests record change?: The new record supersedes ADR 0007. It restates each rule and each rejected option that still holds, including the enforced allowlist and the removal of the git and host-skip allowances. It sets supersedes: ["0007"]; ADR 0007 gets status: superseded, superseded-by and its Superseded by line in the same pull request. (best practice) [sources: docs/adr/README.md:64, docs/adr/README.md:67, docs/adr/0007-tests-double-only-process-edges.md:17]
    • 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 amending a superseded record, and the body contradicts the code.
    • Rejected: Leave ADR 0007 in force. The program allowlist changes the rule that ADR 0007 records.
  • Which freezegun reason does docs/TESTING.md state?: The only freezegun statement is docs/TESTING.md:156, not lines 74, 140 or 150. It must say that freezegun is not used because its frozen monotonic clock hangs asyncio and tenacity. The claim that it is unmaintained is removed: freezegun 1.5.5 is the current release (09 Aug 2025, fetched 2026-11-17). [sources: docs/TESTING.md:156, https://github.com/spulec/freezegun/releases]
  • How do the openspec contract cases run in the openspec row?: The openspec CheckSpec in src/devops_cli/commands/ci.py adds also_cmds=[['uv', 'run', 'pytest', '-n', '0', 'tests/openspec']], so uv run devops ci --check --only openspec runs both devops openspec check and the contract cases. The general test run no longer selects tests/openspec. (best practice) [sources: src/devops_cli/commands/ci.py:991, tests/openspec/test_openspec_tool.py:1, docs/TESTING.md:76]
    • Chosen: The openspec row runs the 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, and the issue moves them.
    • Rejected: Delete the cases. They are contract cases and the issue keeps them.
  • Which citations move to the new record?: The 47 lines in src/, tests/ and .github/ that cite ADR 0007 move to the new record. Archived changes and CHANGELOG.md stay as history. The references in docs/TESTING.md, docs/SDLC.md and docs/SERVICE_PATTERNS.md also point to the new record so no document cites a superseded record. [sources: docs/adr/README.md:70, tests/invariants/test_adr_superseded_citations.py]
  • What length 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. Designs, tables, caps and measurements go to OpenSpec or docs with a link under More Information. [sources: docs/adr/README.md:75]
  • Do the live marks outside the allowlist move in this pull request?: Yes. The curl, jq, ps, kubectl, openspec, devops and other non-base marks move to a fake, a contract suite or a CI row in the same pull request. The collection failure cannot land while a mark outside the allowlist remains. (best practice) [sources: src/devops_cli/roadmap/runner_tools.py:202, tests/roadmap/test_roadmap_runner_tools.py:151]
    • Chosen: Move every mark outside the allowlist. Owner decision 4 fails collection on an unlisted mark, so the existing marks must fit the list or move.
    • Rejected: Add a ratchet over the 67 marks. A ratchet keeps host-dependent marks; owner decision 4 requires collection to fail.
    • Rejected: Grandfather the existing marks. It leaves the program ban unenforced, the finding that the review recorded.

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.

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