Skip to content

fix(ci): count tests and specs as hardening guardrails - #3684

Merged
dan-petty merged 4 commits into
mainfrom
fix/3479-hardening-audit-counts-tests-and-specs
Nov 5, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/3479-hardening-audit-counts-tests-and-specs

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The hardening audit reported a defect fix as unhardened when it added a regression test or a living spec. Both are checks that fail when the defect returns, so the audit now counts additions under tests/ and openspec/specs/. A change folder under openspec/changes/ still counts for nothing, because every item pull request writes one. The audit workflow now writes its report to the job summary. It files no issue, passes no --fail-on-missing and holds no issues: write permission. The table of surfaces moves into the defect classifier, its one reader.

Closes #3479

Change: openspec/changes/archive/2026-11-05-3479-hardening-audit-counts-tests-and-specs/

Only the defect classifier reads the table, so CONTRIBUTING.md puts it in that module. The test pins the surface names through the audit result and imports no private name.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners labels Nov 5, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results

Fail-to-pass (uv run devops ci fail-to-pass --base origin/main, exit 0): 7 tests fail on the base tree and pass on the head. 102 other tests of the two files pass on both.

  • tests/github/test_defect_classifier.py: test_defect_pr_that_adds_a_regression_test_is_hardened, test_defect_pr_that_adds_a_living_spec_requirement_is_hardened, test_defect_pr_3467_recorded_file_list_is_hardened, test_audit_pr_hardening_reports_each_declared_surface, test_match_hardening_surface_declared_surfaces
  • tests/invariants/test_workflow_contracts.py: test_defect_pr_hardening_audit_workflow_contract, test_defect_pr_hardening_audit_workflow_mutation

Full uv run devops ci on the code before the archive commit: every row passes except test and coverage. The test row has 4 failed, 1 error and 18896 passed. The coverage row fails because the test row fails. The 4 tests read the state of this host. They fail the same way on origin/main, and four open issues track them: #3585, #3590, #3593 and #3597.

  • tests/crypto/test_ssh.py::test_get_ssh_key_prefix_resolution (name of the checkout directory)
  • tests/telemetry/test_config_env_overrides.py::test_find_project_config_path_skips_directory (a stray /tmp/config.yaml on the host)
  • tests/commands/test_devcontainer_install_tools_dry_run.py::test_mark_only_commands_under_global_dry_run (the devcontainer tool is installed on the host)
  • tests/ai/test_tool_executor_contract.py::test_the_direct_executor_refuses_a_network_profile_before_it_starts_the_tool[direct] (the popeye tool is installed under the home directory)

The test row took 6m 46s on this host, over the 5 minute budget. Issue #3593 tracks that too. This pull request adds 5 fast tests and does not change the time.

After the archive and the last rebase: 209 tests pass across the classifier test, the hardening report test, test_workflow_contracts.py, test_architectural_invariants.py, test_change_folders.py and test_source_tree.py. Ruff and mypy pass on the changed src files.

Workflow step, run locally against pull request 3467: it exits 0 and shows Hardened (tests/ +186, openspec/specs/ +64).

Review finding

One finding was confirmed and fixed in commit refactor(ci): keep the hardening surface table beside its owner. git grep showed that only devops_cli.github.defect_classifier reads CONST_HARDENING_SURFACES, and CONTRIBUTING.md (Closed Lists and Standard Parsers) says to move a table of one package to its owner when a change touches the owner. The table is now _HARDENING_SURFACES in defect_classifier.py, and config/constants.py no longer holds it. The test imports no private name: it lists the path-to-surface pairs and pins the surface names through the keys of audit_pr_hardening(...).surface_additions. The proposal, design and tasks name the new place.

Follow-up

The 8 family issues (#3138, #3313, #3345, #3383, #3402, #3455, #3459 and #3469) and the comments on #2526 and #2660 are GitHub writes that no test checks. Issue #3661 tracks them.

@dan-petty
dan-petty marked this pull request as ready for review November 5, 2026 19:04
@dan-petty
dan-petty merged commit 1d75506 into main Nov 5, 2026
23 checks passed
@dan-petty
dan-petty deleted the fix/3479-hardening-audit-counts-tests-and-specs branch November 5, 2026 19:14
dan-petty pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.63.0](v0.62.7...v0.63.0)
(2026-11-05)


### Features

* **roadmap:** let a negative search verify check more than one name
([#3678](#3678))
([5a4364c](5a4364c))
* **telemetry:** count the tool calls of the stage planner by outcome
([#3679](#3679))
([45da6dd](45da6dd))


### Bug Fixes

* **ci:** count tests and specs as hardening guardrails
([#3684](#3684))
([1d75506](1d75506))
* **security:** mask the user name of a URL with no password
([#3676](#3676))
([bc1cd9c](bc1cd9c))
* **service:** count each GitHub request with its HTTP status
([#3686](#3686))
([b39dcba](b39dcba))
* **telemetry:** Service counters read true across pods and repos
([#3680](#3680))
([05544ab](05544ab))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): the hardening audit files no issue for a tested fix

1 participant