Skip to content

tests: resolve every closure name in the restoreSettings sandbox - #13617

Merged
danielhanchen merged 1 commit into
mainfrom
ci-image-restore-test-sandbox
Oct 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-image-restore-test-sandbox

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

studio/frontend/tests/image-restore-negative-prompt.test.ts fails on main, deterministically and on every OS (seen as the Frontend unit tests (Windows) red on #13596):

ReferenceError: changeSamplerChoice is not defined

#13569 (sampler choice on the Images page) made restoreSettings re-apply a restored image's sampler:

if (samplerOptions.length > 0) changeSamplerChoice(restoredChoice);
else setRestoredSampler(restoredChoice);

The test pulls restoreSettings out of images-page.tsx and evaluates it inside a with (scope) sandbox. That sandbox resolves only a fixed list of closure names plus anything named set*. Any new dependency of the callback is a ReferenceError.

Test or product?

The product is right: restoring an image should restore its sampler, either immediately or once the options load. The test is wrong in a way that will recur, because it breaks every time restoreSettings reads another closure value.

Fix

The sandbox now resolves any name that is not a real global (String, Number, Array and so on still resolve to the real ones) to the same recording no-op the set* names already got. The assertion is unchanged: restoring an image keeps its negative prompt while a model that ignores one is loaded.

Verification

  • The test fails on main, and passes here (2 runs).
  • Sabotage: make restoreSettings drop the negative prompt when the model ignores it (negativeCapable && image.guidance > 0 ? ...). The test then fails with actual: '', so the guard still catches the regression it exists for.
  • Full frontend unit suite (npm test) with this change: 12008 tests, 12007 passed, 0 failed.

#13569 made restoreSettings re-apply the restored sampler through
changeSamplerChoice / samplerOptions. The test evaluates the callback
in a sandbox that only knew a fixed list of closure names, so it threw
ReferenceError before reaching the negative prompt and fails on main on
every OS. Resolve any non-global name to a recording no-op instead.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-10-13T15:18:13.837687Z f080f5a Manual request
ℹ️ 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

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: f080f5a1d4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 13, 2026
@danielhanchen
danielhanchen merged commit 85c2c2f into main Oct 13, 2026
@danielhanchen
danielhanchen deleted the ci-image-restore-test-sandbox branch October 13, 2026 15:21
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