Skip to content

ci(codeql): separate production scans from test fixtures - #8450

Merged
gensokyo-dev merged 1 commit into
mainfrom
ci/codeql-production-scope
Nov 1, 2026
Merged

gensokyo-dev merged 1 commit into
mainfrom
ci/codeql-production-scope

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CodeQL currently extracts test programs and fixtures into the production analysis, generating security alerts for intentional negative inputs and allowing test-only data flows to reach production helpers. Add an extraction scope that excludes tests/, scripts/fixtures/, *.test.*, *.fixture.*, test_*.py, and *_test.py while retaining production source, bridges, shipped scripts, release controllers, and Actions.

The default queries and existing local threat model are preserved. Behavioral test selection is unchanged. CI classification now runs the semantic guards for changes to the workflow or its configuration, without selecting provider/package runs for configuration-only edits.

Activation and scope

The new workflow is deliberately gated by REA_CODEQL_ADVANCED=true. A repository administrator must disable default setup first, then set that Actions variable and dispatch CodeQL production on main. Default setup rejects advanced CodeQL uploads. The supplied contributor account has push access but no administration access, so this PR does not claim that the server-side scope has already changed. Existing default scanning continues until activation.

Each language uses two threads and a 4096 MiB CodeQL budget; matrix jobs run sequentially. Full SARIF evidence is retained for seven days. JavaScript/TypeScript, Python, and Actions coverage is preserved; shell, Java, and Swift remain under their existing checks. No CLI/MCP, provider, target-authority, package, or Evidence contracts change. New capability scope approval: not applicable. This focused configuration change follows the requested audit; no separate issue was opened.

Validation performed

  • Actual CodeQL 2.27.3 extraction/query controls passed with identical rules and local threat model: JS 12 → 4 alerts; Python 8 → 2. Every production path/command injection control remains detected; test/fixture controls are excluded. Fixture programs were analyzed, not executed.
  • node scripts/run-exact-tests.mjs run tests/boundary/filesystem/ciCodeqlScope.test.ts tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/workflowActionPinning.test.ts — 391 tests passed. After adding the colocated fixture case, the scope file passed again with 29 tests.
  • npm run check:fast -- --concurrency=1, actionlint, changed-file formatting, test discovery, architecture guards, production reachability, and typed lint passed on Node 24.22.1 / npm 11.16.0. Typed lint reports advisory warnings, with no errors.
  • npm run check fails at the existing unused DarwinHelperCache type (src/process/DarwinHelperCache.ts:465); the identical finding was reproduced in an immutable copy of base e18594b24. No unrelated cleanup is included.
  • Six fresh whole-repository CodeQL scans completed on unchanged source e18594b24754ab95ebd119311cc32a1d1ad6fa13, with identical bundle, query metadata, and local threat model. JS/TS: 553 → 303 alerts; Python: 97 → 35; Actions: 5 → 5. Total: 655 → 343 (47.6% fewer), with no new alert locations. Sanitization alerts: 35 → 3; the three retained alerts are in verification scripts.
    +- Actual JS extraction diagnostics: 6,265 → 2,938 repository inputs, zero extraction errors in both runs. All 3,327 removed inputs match the test/fixture exclusions; no excluded inputs remain and no unexpected baseline inputs are lost. CodeQL's pre-existing expected-file coverage gap for docs/.vitepress/config.ts is present in both runs; this change does not establish coverage of that file.

+| Scope | Alerts | Extract + analyze elapsed | CPU time | Peak sampled process-group RSS |
+| --- | ---: | ---: | ---: | ---: |
+| Complete baseline | 655 | 1597.427 s | 2743.112 s | 4.260 GiB |
+| Production scope | 343 | 598.569 s | 1046.824 s | 3.281 GiB |
+
+These are single sequential pairs on a shared busy host, with fresh databases and result caches. OS/tool caches were not cleared; bundled precompiled queries are reused. Summed RSS was sampled every 0.5 seconds, may double-count shared pages, and may miss short peaks. These observations do not establish a controlled cold/warm speedup. Agent tokens and hosted runner CPU/memory were not measured. Raw SARIF, commands, source inventories, and measurements are retained locally in /tmp/rea-codeql-scope-validation/.
+
+- Hosted CI 41283247085 passed for head d4d260a0b97c52e0b3c0979e8e56c2844daec489, including all eight portable-test shards and the native package baseline. Existing default CodeQL checks passed. The new production job is intentionally skipped until administrator activation.
+- Codex review completed with no findings; Greptile completed with confidence 5/5 and no actionable findings.

The separate PR readiness status fails because the human declarations below remain unchecked. The production workflow cannot be activated with the contributor's current permissions. No real-provider behavior changes are claimed.

Author readiness

Human owner: @gensokyo-dev

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T07:05:23.705784Z d4d260a PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with its documented administrator activation step.

Summary

Adds a production-only CodeQL configuration and an administrator-gated workflow for JavaScript/TypeScript, Python, and Actions.

  • CodeQL scans production paths without test fixtures.
  • CodeQL edits select workflow and code checks.

Acknowledged by gensokyo-dev: administrator activation is intentionally deferred; hosted validation and the full-scan comparison remain pending. These are disclosed limits, not new findings.

Review checks were source-based. Live supersession status could not be checked because GitHub authentication was unavailable.

Reviews (1) · Last reviewed commit: "ci(codeql): separate production scans fr..." · Reviewed by Greptile

@gensokyo-dev
gensokyo-dev merged commit a6caa79 into main Nov 1, 2026
48 of 50 checks passed
@gensokyo-dev
gensokyo-dev deleted the ci/codeql-production-scope branch November 1, 2026 07:24
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 1, 2026
Take main a6caa79 (morluto#8441, morluto#8450). The one conflict was an import in
tests/boundary/providers/hopper/hopperAnalysisProfile.test.ts: main
moved HOPPER_PROVIDER_IDENTITY to HopperProviderMetadata.js, and this
branch added the rawLoadAtEntry fixture import; both are kept.
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
@morluto morluto added the area: tests Test suite and verification label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants