Skip to content

ci(validate): finish required checks fast for non-code changes - #318

Merged
datacas merged 3 commits into
mainfrom
task-236
Oct 23, 2026
Merged

datacas merged 3 commits into
mainfrom
task-236

Conversation

@datacas

@datacas datacas commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Closes #236

Summary

Validate package now classifies each change before doing expensive work. A pull request or push that touches only the allowlist reports both required checks (and the four Windows shards) green after a privacy/sidecar scan and the few tests that read an allowlisted file. Anything else runs the full validation exactly as before. The two required job names are unchanged.

Issue: #236 (implemented with the owner's 2026-10-23 decisions on the Windows shards, the privacy scan and the tests that read allowlisted files).

Diagnosis

  • Symptom: every change, however small, waits for the full Linux and Windows validation.
  • Reproduction: not applicable (feature request); the workflow ran both jobs unconditionally on every push and pull_request.
  • Cause: the workflow had no notion of what a change touches. Matched the issue's hypothesis; a paths-ignore filter would leave required checks unreported, so classification happens inside the jobs.
  • Invariant: a required job always reports; it only decides how much work to do. Classification fails closed.
  • Related items: basic search only (the issue's own links, ci: parallelize the Windows test suite #255 for the Windows shards). Nothing else shares the cause.
  • Fix shape: one deterministic in-repository classifier, run as the first step of each job; no job-level skip, no second privacy scanner.

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Classify changes; fast path for allowlisted-only changes; full validation otherwise scripts/fast_path.py, scripts/fast-path-tests.json, scripts/validate-package.py, scripts/windows-test-shards.json, .github/workflows/validate.yml, CONTRIBUTING.md, CHANGELOG.md tests/test_fast_path.py, tests/test_validate_workflow.py, tests/test_install_runtime.py see below independent: reverting the commit restores the unconditional validation

Design

  • Allowlist (explicit, in scripts/fast_path.py): .code-cycle.yml; root Markdown except README.md; docs/**; .github/ISSUE_TEMPLATE/**. Everything else runs in full. Both plugin manifests, release.yml, validate.yml, the classifier and its mapping are named as never skippable, and a CHANGELOG.md edit to a ## heading runs in full (release.yml cuts releases from those).
  • Where it runs: first step of validate, of each of the four Windows shards, and of powershell-installer. Pull requests diff against the merge base (base...head), pushes use before..after; checkouts use fetch-depth: 0.
  • Fails closed: any exception, empty diff, unknown event, bad SHA, unreadable mapping or failing guard gives full; the step is continue-on-error, and every later step is gated on mode != 'fast', so a classifier that never ran also runs in full.
  • Fast path runs: validate-package.py --scan-only (the existing privacy and metadata-sidecar scan, now scan_for_private_data(); no second scanner) and the tests mapped to the changed files. Windows shards run the mapped tests that belong to their shard and skip the rest; powershell-installer runs the scan. The summary shows SKIPPED_NON_CODE versus TESTS_PASSED, the validations run and skipped, and the paths that caused a full run.
  • Tests that read allowlisted files: mapped per test in scripts/fast-path-tests.json (four path groups; test_run_cycle is mapped by test method because the module takes minutes). tests/test_fast_path.py parses every test module and fails when one builds a path from the repository root that is or may be allowlisted without being registered. Writing it, the guard found a second read of .code-cycle.yml in test_run_cycle that a text search had missed.
  • Bypass actor: the admin bypass on Protect main is a repository ruleset setting, not part of this change. After this lands, review whether it is still needed, as the issue asks.

Documentation

CONTRIBUTING.md documents the allowlist, the fast path and the fail-closed rule (acceptance criterion 6) and how to register a new test; CHANGELOG.md has an Unreleased entry. No other docs/ page owns CI workflow behaviour, so none changes. README.md is unchanged.

Verification (agent-reported)

  • python3 scripts/validate-package.py: exit 0, VALID: 16 skills ....
  • python3 -m unittest discover -s tests: 1811 tests, one failure (fast_path.py not declared as tooling in test_install_runtime); fixed, then python3 -m unittest tests.test_install_runtime tests.test_fast_path tests.test_validate_workflow tests.test_validate_package: 136 tests OK. The full suite was not re-run after that one-line fix.
  • python3 -m unittest tests.test_fast_path tests.test_validate_workflow: 51 OK, covering allowlisted-only, mixed, workflow-changing, manifest-changing, empty and unreadable diffs, each of the four mapped path groups, an unregistered new dependency, and the workflow's gating.
  • The four mapped tests run in about 0.05 s.
  • Not verified locally: the workflow itself (GitHub Actions) and the Windows shards. The first run of this PR exercises the full path; the fast path is first exercised by the next non-code change. Shares with CI: no global Git identity is assumed (tests set their own).

Each job of Validate package, and each Windows test shard, classifies the change with scripts/fast_path.py. A change that touches only the allowlist (.code-cycle.yml, root Markdown except README.md, docs/**, .github/ISSUE_TEMPLATE/**) runs the privacy and metadata-sidecar scan plus the tests that read an allowlisted file, and reports both required checks green. Anything else, a manifest, a CHANGELOG release heading, either workflow, the classifier, an error or an empty diff runs in full. validate-package.py exposes the existing scan as scan_for_private_data() and --scan-only. A static guard test fails when a test reads an allowlisted file without being registered in fast-path-tests.json.
@datacas

datacas commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261023-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Initial review: CHANGES_REQUESTED

Head reviewed: 1808ccf5412071408de659d2d968d994d332c8ce (merge base 06b08dffc8ca46b5b60561a98735f83cbfe4a0c9, base main). I read the whole accumulated diff: 1632 lines, 10 files, +1354/−2.

Summary. The design meets the issue. The classifier runs inside each required job, so no required check goes unreported. It fails closed on errors, empty diffs, unknown events, bad SHAs and unreadable mappings. Every expensive step is gated on mode != 'fast', so a classifier that never ran gives a full run. Manifests, both workflows, the classifier and its mapping always run in full, and so does a change to a CHANGELOG.md release heading. The privacy and sidecar scan was pulled out of validate_package() without changing its logic. One new test does not work on Windows, and that blocks approval.

Findings

[REV-001] · medium · open · - · blocks:yes — ScanOnlyTests creates an NTFS alternate data stream on Windows instead of a sidecar file

  • Path: tests/test_fast_path.py (ScanOnlyTests.test_the_scan_is_reusable_and_reports_what_the_validator_reports, the guide.md:Zone.Identifier write and the assertEqual(2, len(errors), errors) assertion).
  • Problem: the test writes docs/guide.md:Zone.Identifier and expects two errors: one for private data and one for the metadata sidecar. On NTFS, the colon opens an alternate data stream on guide.md and does not create a file. rglob("*") never sees the sidecar, so the scan returns one error. The count assertion and the "metadata sidecar" assertion both fail.
  • Evidence: code inspection, plus a precedent in this repository. tests/test_validate_package.py already skips test_rejects_a_windows_zone_identifier_sidecar with @unittest.skipIf(os.name == "nt", ...) for exactly this reason. Its skip message reads: "On NTFS a colon opens an alternate data stream instead of creating a file". This PR registers test_fast_path in shard windows-4 (scripts/windows-test-shards.json), and Windows test shard (windows-4) failed on this head. I could not read the shard log: this stage's command policy denies gh run view. So the link between the CI failure and this test is likely but not confirmed. On Linux the test passes.
  • Impact: PowerShell installer, a required check, requires all Windows shards to pass. Every pull request carrying this test would fail it on Windows, whether it takes the full path or not.
  • Suggested direction: apply the same os.name == "nt" treatment. Either skip the colon-sidecar half of the test on Windows, or use the dot-separated guide.md.Zone.Identifier form that test_rejects_a_dot_separated_zone_identifier_sidecar uses. That form is a real file on every platform.

Security triage

  • Deterministic rule: did not fire. The repository's .code-cycle.yml declares no security_review.always_when. The default paths, files and labels in scripts/security_gate.py match none of the changed paths, and the PR has no labels.
  • Reviewer judgement: an audit was requested because the change touches CI workflow configuration and the gating of the privacy scan, which is security tooling. The audit ran inline with the cc-security-review criteria.
  • Audit result, no vulnerability:
    • Event values reach the scripts through env: (FAST_PATH_BASE, FAST_PATH_HEAD, FAST_PATH_TESTS) and are never interpolated into run:. Only the static matrix.shard is interpolated.
    • The trigger stays pull_request, not pull_request_target, so secrets exposure is unchanged. A pull request that edits fast_path.py adds no new trust boundary, because it could already edit validate.yml.
    • Both SHAs are checked against ^[0-9a-f]{40}$ before reaching git, so no option can be injected.
    • FAST_PATH_TESTS entries must match MODULE_RE and name an existing tests/*.py before loadTestsFromName.
    • Paths in the summary go through _inline (backticks and non-printable characters removed).
    • The fast path keeps the privacy and metadata-sidecar scan in both required jobs.

Verification executed (Linux, this clone, head 1808ccf)

Command Result
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest discover -s tests exit 0, Ran 1811 tests in 211.153s, OK (this includes tests.test_fast_path and tests.test_validate_workflow)
python3 -m unittest exit 0, Ran 0 tests. tests/ is not a package, so top-level discovery finds nothing. This predates the PR and is not a finding.

I checked the following by reading the code: the validator reads no docs/ or allowlisted root-Markdown file (README.md stays outside the allowlist), no runtime script reads an allowlisted path, release.yml builds its notes from ## [x.y.z] headings (which the heading rule covers), and the guard's mapping matches the tests that read .code-cycle.yml, docs/telemetry.md, docs/configuration.md and docs/spikes/**.

Not verified

  • Windows behaviour: I have no Windows host. REV-001 comes from code inspection and a repository precedent. The shard log could not be read (gh run view was denied by the stage policy).
  • The fast path on GitHub Actions: this PR changes validate.yml and the classifier, so its own run takes the full path. The fast path will first run on the next allowlisted-only change, and so will the under-2-minute target in acceptance criterion 1.

CI (policy: parallel; read once, not waited on)

Workflow Validate package, run 39988855834, on head 1808ccf:

Check State
Skills, manifests, and Bash installer (required) pass
Windows test shard (windows-1) pass
Windows test shard (windows-2) pass
Windows test shard (windows-3) pass
Windows test shard (windows-4) fail
PowerShell installer (required) fail (its shard-requirement step fails while a shard fails)

The cycle's CI gate decides what to do with these states. They are reported here, not as findings.

Documentation

CONTRIBUTING.md documents the allowlist, the fast path, the fail-closed rule and how to register a test (acceptance criterion 6), and CHANGELOG.md has an Unreleased entry. No docs/ page describes the Validate package workflow; README.md mentions it only in the badge. So the missing docs/ update is not a finding.

Residual risks

  • The test-dependency guard is static. A test that reads an allowlisted file through runtime code (for example a function that finds .code-cycle.yml from the working directory) or through a path assembled from a string is not detected. CONTRIBUTING.md documents this limitation.
  • _covers calls fnmatchcase(pattern, probe), so a glob probe such as ROOT.glob('*.md') counts as covered by any group whose path matches the glob. Because * also matches /, docs/telemetry.md matches it. A test globbing root Markdown and registered only under that group would not run for a CONTRIBUTING.md change. No current test does this.
  • The admin bypass on the Protect main ruleset is outside this change. The issue asks to review it after merge.

Verdict

CHANGES_REQUESTED. REV-001 is open and blocks approval.

@datacas

datacas commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Resolution summary

Status: RESOLVED. REV-001 was valid and is fixed in commit 8a3ed4153a8816629abf458a3a53a02027d497b2 on the existing task-236 branch.

[CCR-20261023-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261023-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:1808ccf5412071408de659d2d968d994d332c8ce · schema:2

[REV-001] · medium · resolved · valid · blocks:yes — ScanOnlyTests creates an NTFS alternate data stream on Windows instead of a sidecar file

Decision: valid. The reviewed test wrote guide.md:Zone.Identifier; on NTFS that creates an alternate data stream, not a listable sidecar, so Windows reported one scan error where the test expected two. The failed Windows shard log confirmed the assertion failure. The separate required PowerShell installer check failed at its step requiring all Windows shards to pass.

Fix: the test now writes guide.md.Zone.Identifier, which is a listable sidecar on Windows and matches the validator's existing cross-platform test. It normalizes path separators before checking the private-data error. The test still asserts both errors and that scanning the repository returns no errors.

Verification (Linux):

  • rtk python3 -m unittest discover -s tests — exit 0; 1811 tests passed in 211.320s.
  • rtk python3 scripts/validate-package.py — exit 0; VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned.
  • rtk python3 -m unittest — exit 0; discovered 0 tests (tests/ is not a package; the configured discovery command above ran the suite).
  • rtk git diff --check HEAD^ HEAD — exit 0.
  • A delegated review of the fix delta from 1808ccf5412071408de659d2d968d994d332c8ce found no issues; that base is an ancestor of the pushed head.

The Linux run exercised the changed test but did not execute it on Windows. No boundary run is required for this test-only change. No docs page owns this test fixture, and no user-visible behavior or configuration changed.

Original failed checks: on reviewed head 1808ccf5412071408de659d2d968d994d332c8ce, Windows test shard (windows-4) failed at test_the_scan_is_reusable_and_reports_what_the_validator_reports (AssertionError: 2 != 1). PowerShell installer failed because it requires all Windows shards to pass. The failure log was read through the connected GitHub job-log tool; the sandbox blocked the gh log request, and the connected tool did not expose the check-annotations endpoint.

Pushed-head checks: the one-time gh pr view 318 --repo datacas/code-cycle-toolkit --json headRefOid,statusCheckRollup read returned head 8a3ed4153a8816629abf458a3a53a02027d497b2 with an empty rollup. The six expected workflow checks had not appeared in that read; they are reported as missing, with no pending checks observed. CI policy is parallel, so this stage did not wait for them. The cycle's CI gate handles these states separately from REV-001.

@datacas

datacas commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261023-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Rereview: REVIEW_PASSED_AWAITING_CI

Head reviewed: 8a3ed4153a8816629abf458a3a53a02027d497b2 (merge base 06b08dffc8ca46b5b60561a98735f83cbfe4a0c9, base main). Previous reviewed head: 1808ccf5412071408de659d2d968d994d332c8ce. I read the whole accumulated diff again: 1635 lines, 10 files.

Earlier run lines on this change request:

[CCR-20261023-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261023-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:1808ccf5412071408de659d2d968d994d332c8ce · schema:2

What changed since the previous review

One commit, 8a3ed41 ("Fix Windows fast path test fixture"), touching only tests/test_fast_path.py (+6/−3):

  • ScanOnlyTests now writes the sidecar as guide.md.Zone.Identifier instead of guide.md:Zone.Identifier.
  • The two content assertions run on a copy of the errors with \ replaced by /, so the Windows form docs\guide.md still matches.
  • The test still asserts exactly two errors and an empty scan of the repository.

No other file changed.

Previous findings

[REV-001] · medium · resolved · valid · blocks:yes — ScanOnlyTests creates an NTFS alternate data stream on Windows instead of a sidecar file

  • Path: tests/test_fast_path.py (ScanOnlyTests.test_the_scan_is_reusable_and_reports_what_the_validator_reports).
  • Verification:
    • The new file name is a regular file on every platform.
    • ZONE_IDENTIFIER_RE = (?i)[.:]Zone\.Identifier$ in scripts/validate-package.py:164 matches the dot form, so scan_for_private_data() still reports it as a metadata sidecar. Because of the continue after that error, the sidecar is never also scanned for content.
    • The separator normalisation covers path.relative_to(root) rendering docs\guide.md on Windows.
    • Locally, python3 -m unittest tests.test_fast_path -v passed: 42 tests, including this one.
    • On CI for this head, Windows test shard (windows-4) passes (5m39s). That shard runs test_fast_path (scripts/windows-test-shards.json) and failed on the previous head.
  • Outcome: resolved.

New findings

None. Reading the full accumulated diff again found nothing that blocks approval and nothing new to report.

Security triage

  • Deterministic rule: did not fire. The repository's .code-cycle.yml declares no security_review.always_when, none of the changed paths matches the default triggers, and the PR has no labels.
  • Reviewer judgement: the inline audit from the initial review still applies to the accumulated change, which touches the CI workflow and the gating of the privacy scan. The only delta is a test fixture, which reaches no trust boundary. No vulnerability.

Verification executed (Linux, this clone, head 8a3ed41)

Command Result
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest discover -s tests exit 0, Ran 1811 tests in 299.392s, OK
python3 -m unittest tests.test_fast_path -v exit 0, Ran 42 tests, OK
python3 -m unittest exit 0, Ran 0 tests. tests/ is not a package, so top-level discovery finds nothing. This predates the PR and is not a finding.

Not verified

  • Windows behaviour: I have no Windows host to run it locally. The Windows evidence for REV-001 is the CI result of windows-4 on this head, not a local run.
  • The fast path on GitHub Actions: this PR changes validate.yml and the classifier, so its own run takes the full path. The fast path, and the under-2-minute target, will first run on the next allowlisted-only change.

CI (policy: parallel; read once, not waited on)

Read once with gh pr checks 318. Workflow Validate package, run 39999325038, on head 8a3ed41:

Check State
Skills, manifests, and Bash installer (required) pass (4m3s)
Windows test shard (windows-1) pass
Windows test shard (windows-2) pass
Windows test shard (windows-3) pending
Windows test shard (windows-4) pass
PowerShell installer (required) not reported yet (it runs after the Windows shards)

The cycle's CI gate decides what to do with these states. They are not findings.

Documentation

This is unchanged from the initial review. CONTRIBUTING.md documents the allowlist, the fast path, the fail-closed rule and how to register a test, and CHANGELOG.md has an Unreleased entry. No docs/ page owns the Validate package workflow, so the missing docs/ update is not a finding. The fix delta changes no visible behaviour.

Residual risks

These carry over from the initial review and do not block approval:

  • The test-dependency guard is static. A test that reads an allowlisted file through runtime code, or through a path assembled from a string, is not detected. CONTRIBUTING.md documents this limitation.
  • _covers uses fnmatchcase(pattern, probe), so a glob probe such as ROOT.glob('*.md') counts as covered by any group whose path the glob matches. No current test does this.
  • The admin bypass on the Protect main ruleset is outside this change. The issue asks to review it after merge.

Verdict

REVIEW_PASSED_AWAITING_CI. REV-001 is resolved and no open finding blocks approval. This is not an approval: the required PowerShell installer check has not reported for this head yet, and windows-3 is still pending. The cycle's CI gate decides.

@datacas
datacas merged commit b8867dc into main Oct 23, 2026
6 checks passed
@datacas
datacas deleted the task-236 branch October 26, 2026 09:32
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.

ci: finish required checks fast for non-code changes without weakening validation

1 participant