Skip to content

Isolate snapshot tests from the job environment - #163

Merged
CNSeniorious000 merged 1 commit into
mainfrom
test/isolate-snapshot-job-environment
Nov 22, 2026
Merged

CNSeniorious000 merged 1 commit into
mainfrom
test/isolate-snapshot-job-environment

Conversation

@CNSeniorious000

Copy link
Copy Markdown
Member

Snapshot tests inherit the caller's GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED. The plaintext roundtrip test can therefore mark the real job as warned, while an inherited marker makes warning tests fail.

Clear both values in the subprocess fixture unless a test explicitly supplies them. Extend the existing paired-save test to cover either archive first, separate environment files for successive steps, and a fresh job reusing the runner's files. Assertions check actual archive operations and warning counts.

Validation: 15 snapshot tests pass on Bun 1.4.5. Before/after probes confirm the caller's environment file now stays untouched and a pre-existing warning marker no longer breaks the tests. git diff --check passes.

Follow-up to #162, incorporating the remaining isolation and coverage from #161.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-22T22:05:01.001927Z
We couldn’t complete this review. Comment @codex review to try again.
5fbc185 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Test isolation: the run helper now sets GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED to empty strings, so tests do not inherit the caller's values.

Plaintext-warning test: now runs for both save orders (session first, events first). It checks that the warning appears once on the first save and not on the second. It uses a separate env file for each step, and a fresh job warns again.

Only scripts/snapshot.test.ts changed (+20/-12).

The snapshot test runner now clears UNENCRYPTED_SNAPSHOT_WARNED for each process. The warning test covers session-first and events-first save orders. It checks that only the first save in a job warns, that the archive remains plaintext, and that a fresh job warns again.

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

Change: Other

Possibly related issues

Possibly related PRs

Merge Risk: Minimal · up to 5fbc1

This change only makes the snapshot tests independent of the surrounding job environment and adds coverage for the plaintext warning behavior. It does not affect production behavior, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: snapshot tests are isolated from the job environment. It matches the raw summary and PR objectives, which describe clearing GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED …
Description check Passed The description states the problem (snapshot tests inherit GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED), the fix (clearing both values in the subprocess fixture), the extended test coverage, and valida…
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 main change: snapshot tests are isolated from the job environment. It matches the raw summary and PR objectives, which describe clearing GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED in the subprocess fixture. It is concise and specific.

Full details: Description check

Explanation

The description states the problem (snapshot tests inherit GITHUB_ENV and UNENCRYPTED_SNAPSHOT_WARNED), the fix (clearing both values in the subprocess fixture), the extended test coverage, and validation steps. It relates directly to the changeset.

Finishing Touches

Fix failing CI checks

  • 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95c1d61d-fa79-46bc-9f9a-70c0720dcd1f
Commits

Reviewing files that changed from the base of the PR and between 52351a5 and 5fbc185.

Files selected for processing: 1

  • scripts/snapshot.test.ts

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

@CNSeniorious000
CNSeniorious000 merged commit 3d96e2b into main Nov 22, 2026
6 of 7 checks passed
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.

1 participant