Skip to content

feat(roadmap): run the project hooks and scoped CI in the Job - #3112

Merged
dan-petty merged 16 commits into
mainfrom
feat/3043-runner-hooks-and-scoped-ci
Nov 1, 2026
Merged

dan-petty merged 16 commits into
mainfrom
feat/3043-runner-hooks-and-scoped-ci

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The runner Job now runs the checks that a person runs in the devcontainer. It uses the same definitions.

  • The Job runs the hooks of .pre-commit-config.yaml as a child with no GitHub token. It installs no git hook. Every run reads a copy of the configuration of the default branch, so an edit of the agent skips no hook.
  • A step runs the pre-commit stage as an exit check. A failed hook goes to the agent as a repair turn. The setting roadmap.implement.repair_rounds (default 3) bounds all repair turns.
  • Before the push, the Job runs the pre-push stage, the static rows of devops ci, and the tests that cover the changed files. The tests check stays small: above 30 test modules it runs only the changed test modules, and it does not run when no test covers the change. The Job pushes only a head that passed. Any stop in this phase pushes nothing.
  • A failed check of the pull request gets bounded repair rounds after the push. Each round has a comment.
  • The actionlint and zizmor hooks run on a push only when the push changes a workflow.

The change is openspec/changes/archive/2026-11-01-3043-runner-hooks-and-scoped-ci/.

Closes #3043

…#3043)

The scoped tests check runs the test modules that cover the changed
files, and only the changed test modules above 30. It does not run when
no test covers the change.

Every hook run reads a copy of the configuration of the default branch.
A hook run that runs out of time is a failure that no repair fixes. An
error in the scoped phase pushes nothing. A failed check after the push
gets bounded repair rounds, with a comment for each.
@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 1, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results and review findings for #3043.

Fail-to-pass: uv run devops ci fail-to-pass --base origin/main ended with exit 0. 35 tests failed on the base and pass now (in test_roadmap_implement_checks, test_runner_hooks, test_workflow_contracts, test_roadmap_implement_hooks, test_roadmap_implement_job_scoped, test_roadmap_implement_scoped_ci, test_roadmap_implement_step_hooks and others).

Full uv run devops ci on the final tree: 16107 tests passed, 2 failed, 1 error, and the test check took 293 s. The failures are host problems, not this change. The popeye test (tests/ai/test_tool_executor_contract.py) is issue #2165. The test test_mark_only_commands_under_global_dry_run fails because the devcontainer image tool is installed on this host. All other rows passed, including mypy, ast-grep, docs, OpenSpec, actionlint and zizmor. The coverage row did not run after the test failure.

Time of the scoped tests check on 2 CPUs (taskset -c 0,1, 2 xdist workers): 12 changed test modules, 348 tests, 88 s. The cap of 30 modules gives about 3.5 minutes.

Findings fixed:

  • major, scoped tests not scoped: plan_tests picks the test modules with the selector of devops ci test. Above 30 modules (333 of 725 for this item) it runs only the changed test modules. Tests with a 31-module selection cover it. Docs and Feasibility now state the measured time.
  • minor, no covering test failed the check: the check does not run when no test covers the change, and the comment says so.
  • minor, post-push repair: a failed check after the push now gets up to repair_rounds rounds, each with a comment. The spec requirement is renamed and modified.
  • major, hook configuration edit: every pre-commit call gets --config with a copy of the default branch configuration. Tests cover an edit and a deletion.
  • minor, ADR 0014: the pre-push sentence now names the devops-ci-workflows-pre-push hook.
  • major, hook stage timeout: a timed-out hook run is a failure that no repair fixes. Any error or timeout in the scoped phase stops the item with no push. Tests cover the stage in a fix step, an error of git, and a timed-out tests check.

Findings not fixed: none.

# Conflicts:
#	README.md
#	docs/CLI_REFERENCE.md
#	docs/commands/roadmap.md
#	openspec/specs/roadmap-implement-runner/spec.md
#	openspec/specs/roadmap-implement-step/spec.md
#	src/devops_cli/ai/tasks/roadmap_implement_step.md
#	tests/roadmap/test_roadmap_implement_prompt.py
dan-petty added a commit that referenced this pull request Nov 1, 2026
…3115)

## What changes

The test
`test_a_hostile_agents_md_is_data_and_never_changes_the_instructions`
compares `inputs.instructions` with
`fill_prompt(load_task_prompt("roadmap_implement_step.md"))`. It
compared with the raw prompt, which #3111 stopped returning when it made
`build_step_inputs` fill the two table placeholders. The merge of #3107
and #3111 left the required check Tests & Coverage red on `main`.

## Why

A red `main` blocks every open pull request, such as #3112. The test
still proves its rule: a hostile `AGENTS.md` leaves the instructions
unchanged.

## Verification

- Before: `uv run pytest
tests/roadmap/test_roadmap_implement_step_rules.py -k hostile -n0` on
`origin/main` fails with `(False, True, True)`.
- After: the same file passes (11 tests).

Closes #3114
@dan-petty
dan-petty marked this pull request as ready for review November 1, 2026 22:59
@dan-petty
dan-petty merged commit b7ab211 into main Nov 1, 2026
20 checks passed
@dan-petty
dan-petty deleted the feat/3043-runner-hooks-and-scoped-ci branch November 1, 2026 23:00
dan-petty-release Bot added a commit that referenced this pull request Nov 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.38.0](v0.37.4...v0.38.0)
(2026-11-01)


### Features

* **review:** osv-scanner toolrun records its database digest
([#3120](#3120))
([5731fac](5731fac))
* **roadmap:** add gate tools to the runner, one shell policy
([#3111](#3111))
([7735d8b](7735d8b)),
closes [#3072](#3072)
* **roadmap:** give the step AGENTS.md and routed rules
([#3107](#3107))
([80a22eb](80a22eb)),
closes [#3097](#3097)
* **roadmap:** run the project hooks and scoped CI in the Job
([#3112](#3112))
([b7ab211](b7ab211)),
closes [#3043](#3043)


### Bug Fixes

* **ai:** send the per-call sampling of LLMClient.chat
([#3126](#3126))
([8207bdc](8207bdc))
* **argo:** replace a token that Argo CD refuses
([#3121](#3121))
([b4955b4](b4955b4))
* **devcontainer:** remove CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
([#3125](#3125))
([295c32c](295c32c))
* **k8s:** set q8_0 KV cache on every Ollama tier
([#3101](#3101))
([aad0115](aad0115))
* **rag:** raise EmbeddingsError for an empty Ollama URL list
([#3118](#3118))
([111a031](111a031))
* **security:** refuse PYTEST_ADDOPTS and npm_config_logs_dir overrides
([#3119](#3119))
([9fe2af5](9fe2af5))


### Code Refactoring

* **security:** read legacy numeric hosts with getaddrinfo
([#3128](#3128))
([41779f9](41779f9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
@dan-petty

Copy link
Copy Markdown
Owner Author

Advisory pre-merge review (automated; a person decides).

Recommendation: hold. One major finding is proven: a Job item that changes a workflow cannot pass the scoped pre-push check. The PR is already merged (b7ab211), so a follow-up fix is needed.

# Severity Where Problem Evidence Fix
1 major .pre-commit-config.yaml hook devops-ci-workflows-pre-push; src/devops_cli/roadmap/implement_scoped_ci.py scoped_checks The new hook runs devops ci --check --only actionlint,zizmor when a push changes .github/workflows/ or .github/actions/. The runner image holds no actionlint, so the row fails. The agent cannot install a tool, so a fix step cannot repair it. The Job spends all repair_rounds fix steps and then stops the item with no push. Before this PR, a workflow item had no such block. The hook has files: ^\.github/(workflows|actions)/. docs/ROADMAP_WORKFLOW.md line 191 says the image leaves out actionlint. scoped_checks runs the pre-push stage over origin/<default>..HEAD, so the hook fires. src/devops_cli/commands/ci.py (about line 2101) fails when shutil.which("actionlint") is None. I ran devops ci --check --only actionlint with a PATH that has no actionlint: result actionlint ✗ fail. tests/invariants/test_runner_hooks.py::test_every_local_hook_runs_a_tool_that_the_runner_image_holds passes, because it checks only that the entry starts with uv run devops. I did not run a full Job. Skip this hook in the Job (for example SKIP=devops-ci-workflows-pre-push in the hook environment), or add actionlint to the image after #3108. Extend the invariant test to map each devops ci --only <row> hook to its programs and compare them with RUNNER_TOOLS.
2 minor tests/roadmap/test_roadmap_implement_job_scoped.py:336 test_a_tests_check_that_runs_out_of_time_is_a_failed_check does not name the failure. It passes on the base, so it is not fail-to-pass. The tests lens ran it on b7ab2111^: it passed. It asserts only that the item ends ready and a push exists. Assert the failed scoped check tests line in the comment, or the fix-step count.
3 minor src/devops_cli/lang/en/help.py (RoadmapCommandHelp.implement, --group); implement_step.py _commit docstring; archived design.md The text says the standalone step runs the pre-commit hooks. The code does not: run_step runs no hook when hooks is None, and commands/roadmap.py passes none. grep -rn 'hooks=' src shows the value only in implement_run.py. Spec line 858 of openspec/specs/roadmap-implement-step/spec.md says the step runs no hook when the Job gives none. Change the help text to say that the Job runs the hook stage. Fix the docstring and the design sentence.
4 minor .pre-commit-config.yaml (files: of the workflow hook) The filter leaves out .github/zizmor.yml. A push that only edits the zizmor configuration no longer runs zizmor before the push. CI still runs it, so this is a late failure, not a hole. .github/zizmor.yml exists. src/devops_cli/security/zizmor.py:156 names it as the scanner configuration. Use ^\.github/(workflows/|actions/|zizmor\.yml$).
5 minor src/devops_cli/ai/knowledge_base/it_domains/topics/continuous_integration_and_progressive_verification.md:36 A document that this PR makes wrong was not fixed (AGENTS.md rule 8). It says the pre-push hook always runs actionlint and zizmor. The PR fixed the same text in CONTRIBUTING.md and ci_quality_gate.md, but not this file. Say that these two checks run only when the push changes a workflow.
6 minor src/devops_cli/roadmap/implement_run.py stop(), _sync (line 466) Criterion 3 of #3043 says the Job pushes only a head that passed the scoped CI. A stop in an earlier step, and a rebase conflict in _sync, still push earlier group commits that the scoped checks did not run on. The design records this, but the PR body says only that any stop in this phase pushes nothing. _StopError.push defaults to True; _sync uses push_on_conflict=True; design.md: "The stops of earlier steps keep their rule". Say this in the PR body or the docs, or push a stopped item only after the scoped checks pass.

Nits, not findings: the archived proposal and tasks.md list some test files that the PR did not change and omit some that it did; the four branch merge commits use the subject merge:; test_the_table_of_a_step_shows_the_repair_rounds checks only the column heading.

Weighing of the lens results: the correctness finding (row 1) is kept as major because I reproduced the failing row and read the hook and the image rules. The test, fidelity and standards findings are kept at minor. Fidelity criterion 2 (a shared module runs only the changed test modules) is stated in the proposal and the design, so I drop it. No lens found a secret leak, a swallowed error or test-detecting code.

Checks that I ran:

  • Read the hook, implement_scoped_ci.py, runner_tools.py and ci.py in the review worktree at head cd652833.
  • devops ci --check --only actionlint with a PATH that has no actionlint: fail.
  • Lens runs (summary): ruff check, ruff format --check and mypy --strict on the changed files pass; devops ci test on the 12 changed test files: 358 passed; devops docs generate --sync-readme shows no drift; the head checks on GitHub passed (Tests & Coverage 4 min 29 s).
  • Fail-to-pass run of the new tests on the base: 34 new or changed tests fail on the base and pass on the head.

dan-petty added a commit that referenced this pull request Nov 2, 2026
## What changes

The Job leaves out of its hook configuration any hook whose program the
runner image does not hold. Today that is
`devops-ci-workflows-pre-push`, which runs `actionlint`. The checks of
the pull request run it.

- `runner_tools.py`: `HOOK_PROGRAMS` (hook id to programs) and
`hooks_without_programs()`.
- `implement_hooks.py`: `trusted_config` drops those hooks from the copy
it writes for every hook run, and a repository that keeps no hook. The
copy is the same text when nothing is dropped.
- Tests: the copy without the hook, the copy with the program on PATH, a
repository with no hook left, the search-path check, and a check that
each skipped hook is in `.pre-commit-config.yaml` and each program is in
`NOT_IN_RUNNER`.

## Why

#3111 left `actionlint` out of the runner image, and #3112 made the Job
run the hooks of the `pre-push` stage. So an item that changes a
workflow file failed that hook in the Job, no agent could repair it, and
the Job stopped with no push. The independent review of #3112 proved the
failure.

## Verification

- `pre-commit validate-config` accepts the repository configuration with
that hook removed (17 of 18 hooks stay).
- `uv run devops ci test tests/roadmap` and the invariant tests pass
(2642 tests).

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

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): the implement job runs the scoped CI before it pushes and repairs failures

1 participant