fix(ci): run CodeQL on merge-queue commits - #2870
Conversation
Preserve native socket capabilities in the isolated network guard and shorten real sparse-cache fixture paths. Cover both failures in the Windows compatibility gate. Refs #2866 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Docs sync advisoryVerdict: no_change * Pages affected: 0 * LLM calls: 1/15 The deterministic L0 path gate confirms this PR only changes tests and existing contributor documentation. No production user surface changed, so no additional docs work or panel is needed. The orchestrator completed the classification directly after the classifier child lacked repository tools. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new test_isolated_network_guard embeds an indented python -c script string that can raise IndentationError unless it is dedented before execution.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
tests/unit/test_isolated_network_guard.py — The embedded Python script literal includes a leading space at the start of each line (e.g., the… |
What changed in this PR
Repairs Windows release-smoke fixture failures by preserving native socket capability detection in the hermetic test harness and shortening sparse-cache fixture roots to stay under Windows path-length limits, plus adds Windows-gate regression coverage.
Changes:
- Make the network-guarded socket
sendmsgoverride conditional on nativesendmsgavailability to avoid triggering Unix-only feature paths on Windows. - Add/extend targeted tests to validate child-process imports under the network guard and to exercise sparse-cache recency scenarios within the
windows_compatgate. - Document the harness behavior (native socket capability preservation) and the recommended short fixture-root pattern for sparse Git fixtures.
| File | Description |
|---|---|
| tests/utils/isolated_apm_environment.py | Conditionally defines guarded sendmsg only when supported by the native socket implementation. |
| tests/unit/test_isolated_network_guard.py | Adds regression tests covering optional socket-method preservation and child imports under the generated guard. |
| tests/unit/cache/test_git_cache_recency.py | Introduces a short recency_root fixture and promotes sparse recency scenarios to windows_compat. |
| tests/integration/test_isolated_apm_environment_contract.py | Runs sendmsg network-denial probes only when the native socket provides sendmsg. |
| docs/src/content/docs/contributing/integration-testing.md | Documents the native socket capability preservation and short sparse-fixture roots for Windows path limits. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| """ | ||
| result = subprocess.run( |
Preserve the worker-depth fixture and broader socket contracts from #2869, which supersede the overlapping local fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep existing analysis identities and security rules intact. Document the separate API-upload producer dependency without deleting its findings or claiming its PR comparison is resolved. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

fix(ci): run CodeQL on merge-queue commits
TL;DR
Run the existing Python and Actions CodeQL analyses on merge-queue commits as well as PRs and main pushes. Preserve analysis identities, findings, and protection rules. Resolve the overlap with #2869 by retaining its broader Windows regression coverage and keeping the contributor guidance from this branch.
Related: #2866. Its original test-harness fixes have already landed through #2869.
Warning
This fixes the missing merge-queue trigger, not the separate
API upload <default>comparison problem. Both repository analyses were already uploaded for the original PR merge commit; GitHub's CodeQL summary identifies an additional base-branch API configuration. That producer still needs matching PR/queue results. No analyses or findings were deleted, and no ruleset was weakened.Problem (WHY)
mainuses a merge queue and requires CodeQL code scanning, butcodeql.ymlhad nomerge_grouptrigger. PR results belong to a different commit and cannot supply the queue commit's analysis.1 configuration not foundunderAPI upload, despite both normal language analyses completing. Adding or renaming normal categories would not reproduce that producer.The regression procedure follows the Agent Skills validation loop: "do the work, run a validator (a script, a reference checklist, or a self-check), fix any issues, and repeat until validation passes."
Approach (WHAT)
merge_group/checks_requestedscoped tomain.analyzejob ID, Python/Actions matrix, and unconditional uploads.Implementation (HOW)
.github/workflows/codeql.ymltests/unit/test_security_workflow_contracts.pydocs/src/content/docs/contributing/development-guide.mddocs/src/content/docs/contributing/integration-testing.mdtests/utils/isolated_apm_environment.pyasynciorequires native capability detection; implementation is main's version.The cache-recency and socket regression implementations from #2869 are retained unchanged. No dependency, production behavior, or changelog changes.
Diagrams
The highlighted interaction supplies the queue commit to the existing analyses; external API uploads remain a separate responsibility.
sequenceDiagram participant E as GitHub event participant W as codeql.yml participant A as Python and Actions analyses participant S as Code scanning alt Pull request or main push E->>W: Existing trigger else Merge queue rect rgb(255, 247, 200) E->>W: NEW checks_requested trigger end end W->>A: Analyze event commit A->>S: Upload existing analysis configurations Note over S: Separate API-upload producer remains externalTrade-offs
Benefits
Validation
Local validation is against merged main
16edaf5ea. Remote CI is not claimed green.Focused results and lint evidence
Before the workflow change, the new contract failed with
KeyError: 'merge_group':After the fix and conflict resolution:
The canonical pre-push lint chain ran over
src/,tests/, and the architecture scripts:The architecture-boundary command also exited successfully. The Mermaid diagram passed
mmdc. Pytest emitted existing temporary-directory cleanup warnings after successful completion.Scenario Evidence
tests/unit/test_security_workflow_contracts.py::test_codeql_covers_merge_queue_with_existing_analysis_configurations(regression trap)tests/unit/cache/test_git_cache_recency.py(retained from #2869)tests/unit/test_isolated_network_guard.py;tests/integration/test_isolated_apm_environment_contract.py(retained from #2869)How to test
API upload <default>, coordinate with that producer's owner; do not treat successful repository jobs as proof that the additional configuration ran.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com