Skip to content

ROCMAI-889: make the module-size CI gate blocking - #1010

Merged
jussielo-amd merged 1 commit into
mainfrom
rocmai-889-module-size-gate-blocking
Nov 10, 2026
Merged

jussielo-amd merged 1 commit into
mainfrom
rocmai-889-module-size-gate-blocking

Conversation

@jussielo-amd

@jussielo-amd jussielo-amd commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Closes ROCMAI-889.

What

The cargo xtask check-module-size step in the clippy CI job stops being advisory. The continue-on-error wrapper, the report capture, the warning annotation and the job summary are gone, and the step is the bare command, so a source file over 1,500 production lines fails the job. The precondition holds: the check passes on main (412 files, none over) now that the last oversized file has been split.

  • clippy is a required check, so no administrator action is needed. Evidence: gh pr checks <pr> --required on an open PR lists clippy among the required contexts (18 of 48 checks). The job has no name:, so the context is exactly clippy.
  • The step also runs on merge-queue runs. The changes job sets rust to filter || forced, the filter step only runs on pull_request, and forced=true on every other event, so a merge_group run executes the step. That is what covers two PRs that each pass alone but together push a file over the limit.
  • The failure text gains one remediation line: split the file in the same PR, as a pure move, with its tests moving along with the code, and the rule is in docs/architecture.md. The ticket lists changes to the xtask command as out of scope, but a later comment on it asks for this one line of failure text, so it is included here; the check's behavior, limit and counting rules are unchanged.
  • The advisory hook text said "not blocking yet, but this will fail once the limit is enforced", which is no longer true once CI enforces it. It now says the hook does not block the commit but the CI clippy job fails on it. The local pre-commit hook itself stays advisory; flipping it is a separate change.
  • docs/architecture.md, docs/testing.md, AGENTS.md and the xtask doc comment now say CI blocks and the local hook still only reports, and the "files already over the limit are split under their own tickets" sentence is dropped since none is left.

Tests

  • the_failure_text_points_at_a_split_rule_the_document_states asserts the remediation advice together with the rule it points at: the message names docs/architecture.md and its wording, and the document exists and states the same rule. Shown to fail when the sentence in the document is reworded.
  • the_ci_step_runs_the_strict_check_with_no_non_blocking_wrapper ties the "CI fails on this" wording to the step in ci.yml being the bare cargo xtask check-module-size with no continue-on-error. Shown to fail when continue-on-error: true is put back.
  • Existing advisory-wrapper test updated for the new wording.

Verification

Run locally: cargo test -p xtask (767 passed), cargo clippy -p xtask --all-targets -- -D warnings, cargo fmt --all -- --check, cargo xtask check-module-size, cargo xtask check-architecture-doc, and the commit-time hooks (including lychee on the new link in docs/testing.md). I also pushed one real source file past the limit on a scratch edit (not committed): the check exits 1 with crates/rocm-core/src/confirm.rs: 1768 production lines (268 over) and the remediation line.

Not run locally: the full workspace gate (cargo test --workspace --all-targets, scripts/smoke_local.py), since the change touches only xtask, one workflow step and docs; CI carries it. The pre-push hook was skipped on the push.

Red then green on CI, both running this workflow: the green run is this PR's own clippy job. The red run is a throwaway draft (#1013, closed) that is this branch plus one commit padding crates/rocm-core/src/confirm.rs with comment lines past the limit. Its clippy job passes the Clippy step and fails the module-size step with crates/rocm-core/src/confirm.rs: 1769 production lines (269 over) followed by the remediation line.

No Gherkin scenario: this is CI plumbing and a dev-tool message (cargo xtask), not rocm CLI behavior, so nothing a CLI user observes changes.

The check passes on main now that the last oversized file is split, so the
advisory wrapper in the clippy job (continue-on-error plus the report
capture) goes and the step becomes the bare strict command. clippy is a
required check and the merge queue runs it, so a file over 1,500 production
lines now stops a merge, including two PRs that each pass alone.

The failure text gains one remediation line pointing at the split rule in
docs/architecture.md, and a test asserts the advice together with the rule it
points at. A second test ties the "CI fails on this" wording to the step
being the bare command. The docs that described the gate as advisory now say
CI blocks and the local hook still only reports.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change making CI module-size checks blocking while keeping the local hook advisory.

No open issues 🎉

What changed in this PR

This PR makes the existing 1,500-production-line module-size limit blocking in CI while keeping the local pre-commit hook advisory. The limit and counting rules remain unchanged.

Changes:

  • Replaces the advisory CI wrapper with the strict check in the required clippy job, including merge-queue runs.
  • Adds remediation guidance and tests tying the messages to the documented split rule and strict workflow step.
  • Updates contributor documentation and help text to distinguish blocking CI enforcement from the advisory local hook.
File Description
xtask/​src/​module_size.rs Updates warning and remediation text; adds documentation and workflow contract tests.
xtask/​src/​main.rs Clarifies advisory-command help text without changing behavior.
docs/​testing.md Documents blocking CI enforcement and the advisory hook.
docs/​architecture.md Updates the size-limit policy and removes the transitional exception.
AGENTS.md Aligns contributor guidance with blocking CI enforcement.
.github/​workflows/​ci.yml Removes the non-blocking wrapper and runs the strict check directly.

Review effort: Balanced

@jussielo-amd
jussielo-amd marked this pull request as ready for review November 10, 2026 10:55
@jussielo-amd
jussielo-amd requested a review from a team as a code owner November 10, 2026 10:55
@github-actions

Copy link
Copy Markdown
Contributor

Caution

3 potential secret finding(s) were committed in this pull request. Treat each credential as compromised and revoke or rotate it now, even if a later commit removed it. Deleting the line or force-pushing does not undo the leak: the commits stay reachable from this pull request and from every clone or fork, and automated scanners harvest secrets pushed to public repositories within minutes.

If a finding is a test fixture or a false positive, allowlist it in the configuration of the scanner that reported it.

Security scan found 3 critical or high finding(s) on lines changed by this pull request
Scanner Severity Rule Location Finding
Gitleaks HIGH generic-api-key apps/rocm/src/runtime_install_finalize.rs:1315 Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
Gitleaks HIGH generic-api-key apps/rocm/src/serve_summary.rs:557 Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
Gitleaks HIGH generic-api-key apps/rocm/src/serve_summary.rs:585 Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No blocking findings. This reflects a diff read plus the live check status, not a runtime check.

Non-blocking:

  1. The ROCMAI-889 acceptance criterion asks for a scratch red-then-green CI run with both runs linked in the PR. The PR body says this isn't done yet, so please add it before merge.
  2. The PR also changes the xtask failure/advisory text and adds 2 tests, which the ticket lists as out of scope. It's small and disclosed, and the limit and counting behavior are unchanged.
  3. The new CI-step test finds the step in ci.yml by string match, so reindenting or renaming the step breaks it. It fails loudly, which is acceptable.
  4. "Security scan / Security scanners" and "Security scan / gitleaks" are failing. They aren't required checks and the diff has nothing secret-like, but they're worth a look.

clippy is a required context and all required checks pass. Docs (AGENTS.md, architecture.md, testing.md, doc comments) are consistent, and the leak scan on the diff is clean.

@jussielo-amd
jussielo-amd added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 2d3e0cd Nov 10, 2026
53 of 60 checks passed
@jussielo-amd
jussielo-amd deleted the rocmai-889-module-size-gate-blocking branch November 10, 2026 12:06
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.

3 participants