Skip to content

test(crew-container): scope the vanish race with monkeypatch.context() - #18015

Merged
KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
koenvincent:fix/sidecar-test-scoped-monkeypatch
Oct 19, 2026
Merged

KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
koenvincent:fix/sidecar-test-scoped-monkeypatch

Conversation

@koenvincent

@koenvincent koenvincent commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Make SAST (Semgrep) green again for every pull request, by removing the bare monkeypatch.undo() that #13374 added to a crew-container test (now suppressed on main rather than fixed).

Since #13374 merged, SAST (Semgrep) fails on unrelated pull requests with one finding, semgrep.kirocrew.test-bare-monkeypatch-undo, at test_sidecar_durability_gaps.py:4402. The scan covers files changed since the PR's baseline, so every branch based before #13374 now inherits the finding.

Update 2026-10-19: main has since split the file (#21518), moving the test to test_sidecar_durability_gaps_walk.py, and added a nosemgrep: kirocrew.test-bare-monkeypatch-undo suppression above the undo(). So SAST is no longer red on other PRs, but the bare undo() is still there. This PR now changes the split file, and with the undo() gone the suppression is no longer needed, so it's removed too.

Why it matters

Every open PR shows a red SAST check it did not cause, which hides real findings and costs each author an investigation. The finding itself is also real: monkeypatch.undo() reverts every patch on the shared fixture, including the autouse fixtures this test inherits, so the test's second cycle runs on the host's real values.

Not a goal

  • Changing the Semgrep rule or its scope.
  • Any change to the backup cycle under test or to _vanish_after_listing.

What changed (motivation → approach → change)

test_a_gone_transcript_does_not_withhold_on_the_following_cycle needs the deletion race only for its first cycle, and ended it with monkeypatch.undo(). The race patch is now applied inside with monkeypatch.context() as mp: around that first cycle, which is the rule's own suggested fix (D11). The second cycle and every assertion are unchanged.

Backwards compatibility

N/A — test-only change.

Tests

The changed test keeps its assertions; only the patch scope changes. The crew container suite skips on non-Linux hosts (conftest.py), so it was only compiled and linted locally (py_compile, ruff check); CI runs it on Linux.

Manual verification

N/A — test-only change.

Screenshots / video

N/A — no UI change.

Related Issues

Follow-up to #13374.

Pattern harvest

Not generalizable: the class is already caught by semgrep.kirocrew.test-bare-monkeypatch-undo; this is the one occurrence that merged before the rule could block it.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality (CI runs the Linux-only suite)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

I agree that this contribution is made under the project's Apache-2.0 license.

@koenvincent
koenvincent requested a review from a team as a code owner October 8, 2026 05:45
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ⏭️ skipped

Revision dd56b5749d9356ea63068b1c2ae45e1a9714c95b ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of dd56b5749d9356ea63068b1c2ae45e1a9714c95b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] dd56b57

Description read

[DESCRIPTION-READ] befb0453deb83c35a763b872365a31f3ad791c06ecd55248d04b76a3e2b45615

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed dd56b5749d9356ea63068b1c2ae45e1a9714c95b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] dd56b57

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision dd56b5749d9356ea63068b1c2ae45e1a9714c95b touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed dd56b5749d9356ea63068b1c2ae45e1a9714c95b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] dd56b57

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 8, 2026
@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 66f3075 to 002427a Compare October 8, 2026 09:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 8, 2026
@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 002427a to 9fd5706 Compare October 9, 2026 11:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 9, 2026
@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 9fd5706 to e6d2f1a Compare October 13, 2026 12:10
@koenvincent

Copy link
Copy Markdown
Contributor Author

The GPT 6.1 Review check on e6d2f1a is red with "review incomplete": the fork lane (run 38395961667) finished without producing a verdict, so this is not a finding against the diff. The check's own summary says to re-run it, and re-running needs admin rights I don't have. Could a maintainer re-run that lane? Everything else on this head is green, and the earlier GPT and Opus reviews of this change had no findings.

@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from e6d2f1a to 44128d9 Compare October 14, 2026 13:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 14, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@koenvincent

Copy link
Copy Markdown
Contributor Author

@chenmingwei23 friendly ping, this has been waiting for a first review since 8 Oct. It only narrows the crew-container test scoping. The two red backend shards are the known flakes #20324 and #20325, which this PR doesn't touch (details here).

@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 44128d9 to 9bdf7c4 Compare October 15, 2026 09:15
@koenvincent

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4cae548 (now 9bdf7c4, same one-file diff), which carries #20673, the fix for flake #20324 behind the red shard 3. #20325 (maintenance.lock, shard 8) is still open upstream, so that shard can still flake.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 15, 2026
@koenvincent

Copy link
Copy Markdown
Contributor Author

The red Windows shard 7 on 9bdf7c4 is not from this PR: both failures are in test_app_mcp_tool_policy_scope.py (2 failed, 21493 passed), the Windows-only cross-drive path comparison that came in with #20530 and is currently red on main. Fixes are open in #20711, #20725 and #20746. Linux shard 8, where the maintenance.lock flake (#20325) used to hit, is green on this head. I will rebase once one of the mcp fixes lands.

@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 9bdf7c4 to 91ac1d2 Compare October 16, 2026 03:19
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 17, 2026
test_a_gone_transcript_does_not_withhold_on_the_following_cycle called a bare
monkeypatch.undo() to end the deletion race before its second cycle. That also
reverts every autouse fixture's patch, so the second cycle ran on host values.
Scope the race patch with monkeypatch.context() instead. Clears the
semgrep.kirocrew.test-bare-monkeypatch-undo finding introduced by kirodotdev#13374.
@koenvincent
koenvincent force-pushed the fix/sidecar-test-scoped-monkeypatch branch from 91ac1d2 to dd56b57 Compare October 19, 2026 06:24
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 19, 2026 09:04

@KiroCrewCaptain KiroCrewCaptain 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.

Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change that scopes the vanish-race patch to the first backup cycle with monkeypatch.context() instead of a bare undo().

@KiroCrewCaptain
KiroCrewCaptain merged commit 9918572 into kirodotdev:main Oct 19, 2026
104 of 111 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants