Repository navigation
feat: export selectDebugInputFilePaths for stdio debug input files - #479
Merged
Merged
Conversation
A client that ships only learner-visible files to debug a problem needs to know which input files the stdio debug preset hands to the program. Export a pure helper that selects them from problem-relative paths, and make the preset derive its choice from the same rule. Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Member
Author
ReviewFixLoop run summaryRun Run page: https://reviewfixloop.com/runs/5a94e38819d5-2 Fixed (5)
|
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
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.
Why
A client that debugs a problem on a judge that has no copy of it must send the problem files itself. Sending everything would hand hidden test cases and model answers to the debugged program, so such a client wants to send only what
stdioDebugPresetwould give the program anyway:test_cases/_shared.fin/and the.fin/of the first example case. Sending onlyproblem.mdinstead leaves the program without its input files (e.g.pd.read_csv('members.csv')fails in debug while the same code passes judging). Exporting the preset's selection rule lets such a client ship exactly the right files without re-implementing the rule and drifting from the preset.Requirements
stdioDebugPresetuses:_shared.fin/plus the.fin/of the first example case (sorted ids matchingEXAMPLE_TEST_CASE_ID_PATTERN) that has onestdioDebugPresetderives its choice from the same rule instead of duplicating it.in/.out, model answers, solutions or templatesCustomer Summary
No behavior change for problem authors or learners:
stdioDebugPresetcopies the same files as before. Tools built on this package can now callselectDebugInputFilePaths(paths)to learn which problem files a debug run receives.Technical Summary
packages/problem-utils/src/helpers/selectDebugInputFilePaths.ts:selectDebugFileInputTestCaseIdsholds the rule (sorted ids;_sharedfirst, then the first example id, so the example's files overwrite shared ones at the same path);selectDebugInputFilePathsnormalizes each path (./test_cases/...is accepted), mapstest_cases/<id>.fin/...paths to ids, applies the rule, and returns the matching paths with their original spelling and order. Only the latter is exported from the package entry.presets/stdio.ts: the debug run's input copying moved tocopyDebugFileInputs, which feeds the ids of the existing.fin/directories to the same rule. The warning for problems whose.fin/inputs are all on hidden cases is kept.readTestCases.ts: the_sharedname is now the exportedSHARED_TEST_CASE_IDso both places use one constant.Testing
test/e2e/stdioDebugInputFiles.test.ts: on a problem with shared files, examples listed out of sorted order (with and without.fin/, one overriding a shared file), and hidden cases, it checks the helper's selection (including./-prefixed paths) and that a realstdioDebugPresetrun sees exactly those files with the example's content winning. It fails if the rule's sorting, the path normalization, or the preset's copy order regresses.bun run verifypasses;bun wb test test/e2e/stdioDebugInputFiles.test.ts test/e2e/stdioWorkingDirectory.test.ts test/e2e/debugAndJudge.test.tspasses.Notes
.fin/directory with no files cannot appear in a path list, so in that edge case the helper may pick a later example than the preset; the preset copies nothing from such a directory either.stdioJudgePreset(cognitive complexity 54, ncss 88), which this change does not modify; left as is.