Skip to content

test(robot-repo-automaton): stop the kill-switch test mutating process env - #727

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/kill-switch-test-no-global-env
Dec 5, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/kill-switch-test-no-global-env

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

What

kill_switch_blocks_everything set HYPATIA_AUTOMATION=off for the whole test process. Tests in other modules call registry_guard::check_write, which reads that variable, so a fixer test running in parallel could see a denied write: Fixer::apply returned Ok(FixResult { success: false }) instead of the Err that test_disable_preserves_existing_disabled_file expects. That is the intermittent failure seen on #689.

Change

  • ExclusionRegistry::check now delegates to a private check_with_kill_switch(ctx, Option<&str>) with the env value; behaviour is unchanged.
  • The kill-switch test passes Some("off") directly and no longer touches the process environment.
  • Only robot-repo-automaton/src/exclusion_registry.rs changes.

Verification

The robot-repo-automaton lib tests run 25 times locally: no failure other than test_atomic_replace_failure_preserves_original_bytes. That test fails identically on main because this container runs as root, which ignores the read-only-directory permission it relies on. It is unrelated to this change.

Decisions recorded


Generated by Claude Code

Summary by CodeRabbit

  • Behavior
    • Automation exclusion checks now read the current automation setting. Existing scan exemptions and kill-switch behavior remain unchanged; no user-facing functionality changes are noted.

…s env

kill_switch_blocks_everything set HYPATIA_AUTOMATION=off for the whole
process. Tests in other modules (fixer) call registry_guard::check_write,
which reads that variable, so when they ran in parallel they saw denied
writes: apply() returned Ok(success: false) and
test_disable_preserves_existing_disabled_file, which expects Err, failed
intermittently.

Add check_with_kill_switch(ctx, Option<&str>) and have check() delegate to it
with the env value; the test passes Some("off") directly. check() behaves
as before.
@gitnotebooks

gitnotebooks Bot commented Dec 5, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The exclusion registry passes the optional HYPATIA_AUTOMATION value to a private helper for its kill-switch check. The test supplies "off" directly instead of changing process environment variables.

Changes: Exclusion registry

Layer / File(s) Summary
Pass kill-switch input and test directly
robot-repo-automaton/src/exclusion_registry.rs
check passes the optional environment value to a private helper. The helper retains the scan exemption before the kill-switch check. The test passes "off" directly.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: Minimal · up to 4505b

This change only makes a test independent of process-wide environment state. Production behavior of the exclusion registry is unchanged, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the test-only change: the kill-switch test no longer mutates the process environment. The raw summary and objectives confirm the change: the test now passes Some("off") to a private he…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the test-only change: the kill-switch test no longer mutates the process environment. The raw summary and objectives confirm the change: the test now passes Some("off") to a private helper, and check() still reads HYPATIA_AUTOMATION. The title is specific and matches the main change, and its scope (test hygiene in one crate) is accurate. It omits the refactor into check_with_kill_switch, which is acceptable for a short title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b178c56 and 4505b3e.

Files selected for processing: 1

  • robot-repo-automaton/src/exclusion_registry.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review December 5, 2026 08:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T08:47:04.601941Z 4505b3e Draft marked ready
🔒 Security Review ✅ Completed 2026-12-05T08:48:05.591149Z 4505b3e Draft marked ready
ℹ️ 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.

@hyperpolymath
hyperpolymath merged commit 52bb1a6 into main Dec 5, 2026
141 checks passed
@hyperpolymath
hyperpolymath deleted the fix/kill-switch-test-no-global-env branch December 5, 2026 08:48
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.

2 participants