Repository navigation
fix: make stdioDebugPreset copy exactly the files selectDebugInputFilePaths selects - #480
Conversation
…ePaths selects The preset now lists the files under test_cases/, passes them to selectDebugInputFilePaths, and copies the returned files (shared first, then the example's), so an example whose .fin/ directory is empty is skipped in favor of the next example with files, as the helper already did. Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request aligns the file selection logic of Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. The files were picked in different ways, Causing bugs in debug days. Now one rule governs all the flow, And empty folders have to go. Footnotes
|
ReviewFixLoop run summaryRun Run page: https://reviewfixloop.com/runs/e28f2f149ca8-2 Fixed (4)
Rejected (1)
|
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
copyDebugFileInputs reads test cases with readTestCases, lists the files of their .fin/ directories, and copies the .fin/ directories whose files selectDebugInputFilePaths selects with copyTestCaseFileInput, so symlinks and empty subdirectories are placed as the judge places them. Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the selection and copying of debug input files in the stdioDebugPreset harness. It updates the documentation to clarify that the harness copies the .fin/ directory of the first example case that contains input files. The implementation in selectDebugInputFilePaths.ts and stdio.ts is updated to recursively read the test_cases directory and copy the selected files directly, rather than relying on readTestCases. Additionally, the end-to-end tests are refactored to reduce duplication and a new test case is added to verify that empty example input directories are skipped. The reviewer raised a concern regarding the potential performance impact of using fs.promises.readdir with recursive: true on large test_cases directories.
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Why
selectDebugInputFilePathsdecides from a list of file paths, whilestdioDebugPresetdecided from the directories on disk. When an example.fin/directory existed but contained no files, the preset picked that empty directory (and copied nothing from examples) while the helper skipped it and picked the next example that has files. Making the preset feed its file list to the helper removes the divergence, so both selections are one implementation.Requirements
stdioDebugPresetselects its debug input files with the semantics ofselectDebugInputFilePaths, so the two selections are literally one implementation.test_cases/as problem-relative paths, passes them toselectDebugInputFilePaths, and copies exactly the returned files.debug: no example test case has input files, ...stays meaningful under the new rule.example_1.fin/and anexample_2.fin/with a file shows a real preset run sees example_2's file, matching the helper, and it fails without the change.selectDebugInputFilePathssignature and result (selected paths in the given order) are unchanged..fin/directory with the judges'copyTestCaseFileInputrather than file by file, because a per-file copy crashed on a symlinked directory and dropped empty subdirectories that the judge places; for a.fin/all of whose files are selected, the files copied are exactly the returned ones..fin/has files but no example's files are copied, because the old "a non-shared.fin/directory exists" check would also fire for empty directories, which hand nothing to any run.Customer Summary
A debug run of a standard stdio problem now receives the input files of the first example whose
.fin/has files, even if an earlier example's.fin/directory is empty, matching whatselectDebugInputFilePathsreports to clients.Technical Summary
packages/problem-utils/src/helpers/selectDebugInputFilePaths.ts: the internalselectDebugFileInputTestCaseIdsis gone; the id rule is inlined inselectDebugInputFilePaths, and path parsing is extracted to the internalparseFileInputTestCaseId.packages/problem-utils/src/presets/stdio.ts(copyDebugFileInputs): reads the.fin/directories withreadTestCases(as the judge does), lists their files as problem-relative paths, passes them toselectDebugInputFilePaths, and copies the.fin/of each selected id withcopyTestCaseFileInput, shared first so the example's files overwrite same-path shared ones.README.mdand thestdioDebugPresetJSDoc: describe the debug preset as copying the.fin/of the first example case that has input files.Testing
bun run verify: passes.bun wb test test/e2e/stdioDebugInputFiles.test.ts test/e2e/debugAndJudge.test.ts: 36 passed.test/e2e/stdioDebugInputFiles.test.tsthat creates an emptyexample_1.fin/in the temp fixture; with the source change reverted it fails (the run sees no files), and passes with it.example_1.fin/(copied like the judge) and on one with an unreadabletest_1.fout/(debug still runs).Notes
stdioDebugPreseton git-tracked problem directories (directly or via the server's default harness). Git cannot track empty directories, so no existing problem changes behavior.stdioJudgePreset(cognitive complexity 54, ncss 88), which this change does not modify; left as is.