Repository navigation
Tests: follow the sandbox save and snippet name helpers the Files menu split out - #19320
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Four source-contract tests fail on main since #19172 (Files menu for chat), so PRs based on main go red on them:
studio/backend/tests/test_sandbox_files_and_storage_roots.pytest_a_large_file_is_streamed_rather_than_bufferedtest_a_native_download_gets_an_absolute_urltest_the_file_download_button_refreshes_the_session_firsttests/studio/test_desktop_reliability_frontend_contract.py::test_generated_download_buttons_use_the_native_save_boundaryCause
#19172 is a correct refactor. The Files menu needed the same two pieces of logic as existing components, so it moved them into shared modules without changing them:
authFetch, then a streamed download to an absoluteapiUrl(...)carrying the bearer) moved fromSandboxFileRow'ssavecallback insandbox-files-view.tsxtosaveSandboxFileinsandbox-download.ts, which the view now calls;getCodeFilename(the snippet extension table andfallbackExt) moved frommarkdown-text.tsxtocode-filename.ts, whichmarkdown-text.tsxnow imports.The tests read only the original files, so they lost sight of code that still exists. #19172's last
(Python 3.13, rest)run already showed the sandbox three as red.Fix
Test only. The guards now read the code where it lives and also pin the delegation, so a later edit cannot quietly route around the shared helper:
_sandbox_file_save_sources()requires the view to importsaveSandboxFilefrom./sandbox-downloadand call it from the Save button, and returns the body ofsaveSandboxFilefor the three tests. The checks on that body are the same as before (streamed, noresponse.blob(),token=in the URL, absolute URL,authFetchHEAD beforegetAuthToken()), plus one new one: a refused probe throws beforedownloadUrlStreaming, so a 401 body is never saved as the file.markdown-text.tsxto importgetCodeFilenamefrom./code-filenameand callgetCodeFilename(language), and readsfallbackExtandrust: "rs"fromcode-filename.ts.Verification
saveSandboxFile;if (!probe.ok) throw;saveSandboxFile(all three sandbox tests);markdown-text.tsximporting the snippet helper from another module;rust: "rs"fromcode-filename.ts.