Skip to content

ci: run classifier tests in Required Merge Gate - #160

Merged
kiwidream merged 6 commits into
1.x.xfrom
kiwidream/require-classifier-tests
Sep 17, 2026
Merged

kiwidream merged 6 commits into
1.x.xfrom
kiwidream/require-classifier-tests

Conversation

@kiwidream

@kiwidream kiwidream commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Run all 24 merge-profile classifier tests and the 5 workflow contract tests in the Required Merge Gate's own classify-changes job, before it produces routing outputs. A failing suite now fails the job and required gate instead of allowing a regression to route itself to insufficient validation. Addresses #157.

Add an executable workflow contract that runs the actual step and gate shell, verifies every classifier test executes, and checks failure propagation and successful lightweight routing. Install python3-yaml and run the contract with /usr/bin/python3 so the interpreter uses the distribution-provided PyYAML package. Classification policy and unrelated gate requirements remain unchanged.

Testing

  • Documented tests: the verbose parser accepts unittest's two-line descriptions, including descriptions containing .... A documented classifier fixture passes the actual workflow contract; filtering it out still fails. The updated regression fails against the previous parser.
  • Full test identities: duplicate method names in different classes pass the contract; filtering out either class fails. The regression reproduced the previous 25-versus-24 count failure. Parser coverage includes both verbose unittest formats, script/module names, multiline results, and incomplete execution.
  • Review follow-up: executed the dependency-install block and actual contract command in Ubuntu 24.04. The normal workflow passed; removing, filtering, or reordering the classifier-test step and injecting a contract failure each produced a nonzero exit. Docker actionlint 1.7.12 and full repository Docker lint passed on the updated signed head.
  • python3 ci/checks/test_classify_merge_profile.py -v: 24 tests passed.
  • python3 ci/checks/test_classifier_ci_contract.py -v: 5 tests passed, including an intentionally failing assertion in the real classifier suite and failure/skipped/cancelled dependency results.
  • Adversarial workflow mutations covered removed or filtered test execution, swallowed failures, bypassed gate checks, and incorrect dependency/output bindings; offending mutations were rejected on macOS and Ubuntu.
  • Docker repository lint and Docker actionlint 1.7.12 passed. Focused suites rerun after merging the current 1.x.x base.
  • Built locally. Not applicable: CI/test-only changes; no C++ code changed.
  • Ran focused unit or functional tests for the changed area.
  • Ran lint or formatting checks relevant to this change.
  • Not run. Reason: hosted check attachment and same-event-head failure propagation await CI. Local contract tests execute the gate shell with modeled dependency results and simulate check-run polling.

Target Branch

  • This PR targets main or a maintainer-requested release branch such as 0.1.x. Targets 1.x.x as requested.

Risk / Review Notes

  • Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
  • No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes: CI wiring and its regression test only. Both the classifier suite and workflow contract run unconditionally before routing outputs; the classification job installs PyYAML for the contract. Issue closure should follow merge and verification of hosted gate behavior because this PR targets a maintenance branch.

Docs / Process Impact

  • I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
  • No public docs update needed. Reason: internal CI wiring; workflow comments and the contract test docstring explain the behavior.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The merge-profile classifier decides which validation profile routes a
change, but its unit suite was not executed by any workflow. Core Checks
cannot protect the lightweight Required Merge Gate: if the classifier is
broken in a way that still classifies successfully, the gate routes to a
lightweight profile and passes while Core Checks fails elsewhere.

Run test_classify_merge_profile.py in the gate's own classify-changes job,
before the step that produces the routing outputs, so a failing suite fails
classification and the gate shell rejects the run.

Add ci/checks/test_classifier_ci_contract.py, which parses the workflow with
an `on`-preserving loader and executes the extracted step and gate shell:

- test_workflow_executes_all_classifier_tests runs the actual step script
  and observes every loader-discovered method (24) reported ok, with the
  step unconditional, ordered before routing outputs and free of
  continue-on-error.
- test_suite_failure_reaches_required_gate injects a failure into one test
  in a temporary copy of the suite, shows the extracted step exits nonzero
  while still executing every method, then drives the extracted gate shell
  with modeled dependency results: failed, skipped and cancelled
  classification exit nonzero before any check polling, while a successful
  classification keeps github-metadata and rpc-docs profiles usable. The
  gh check-run API is simulated for polling only.
An adversarial mutation review found four ways the Required Merge Gate
workflow could be changed so a failing classifier suite no longer fails
the required check, none of which the contract test detected:

* CLASSIFY_CHANGES_RESULT bound to a literal instead of
  needs.classify-changes.result
* VALIDATION_PROFILE bound to a literal instead of
  needs.classify-changes.outputs.profile
* job-level continue-on-error on classify-changes, which reports the
  job as a success when its steps fail
* the gate job's `if` conditioned on needs.classify-changes.result,
  which skips the gate on classifier failure and reports a skipped job
  as a passing required check

The root cause was that the test only checked which env keys the gate
step declared and then supplied the modeled values itself.  It now
evaluates each modeled env binding against a fake `needs` context and
requires the binding to be exactly needs.<job>.result or
needs.<job>.outputs.<name> of a modeled dependency, and a new focused
test asserts that classify-changes has neither `if` nor
`continue-on-error` and that the gate's `if` uses always() without
referencing any needs.* result.

Also mark the file executable to match its shebang and the sibling
ci/checks tests, as lint-files.py requires.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-16T19:25:36.943222Z 89e458f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5dfc27c37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/checks/test_classifier_ci_contract.py
Install the distribution's PyYAML package and run the workflow contract
with its system Python in the unconditional classification job. Contract
failures now stop routing outputs and reach the Required Merge Gate.

Verify the actual command in Ubuntu 24.04 with missing, filtered, and
reordered classifier-test steps and an injected contract-test failure.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c716a18f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/checks/test_classifier_ci_contract.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5207610c39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/checks/test_classifier_ci_contract.py Outdated
@kiwidream
kiwidream merged commit a2efbc1 into 1.x.x Sep 17, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant