Conversation
Reproduces issue #3: an output path whose parent does not exist aborts with "Failed to create output directory: No such file or directory", after the expensive Dart VM build has already run. The directory is created before the snapshot is loaded, so the tests pass a deliberately invalid input file — the run is expected to fail later, and what is asserted is that it does not fail at directory creation. No snapshot parsing, no analysis, so the suite finishes in under a second. Seven cases: the two failing shapes (missing parent, deeply nested), two that already worked and must not regress (existing directory, single component under an existing parent), and three that must still be reported as failures rather than swallowed (output path is a file, a parent component is a file, unwritable parent). The unwritable-parent case skips under root, which is why the file-in-the-way cases exist — they exercise the error path either way. Standard library only, no test framework added. Refs: #3 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
std::filesystem::create_directory fails when the parent does not exist, so `-o out/some/new/path` aborted the run after the Dart VM build had already happened. create_directories has mkdir -p semantics. Both overloads return false for an already-existing directory without setting the error code, so the surrounding guard is unchanged and a genuine failure — an unwritable parent, or a file in the way — is still reported and still exits 1. Fixes #3 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
std::filesystem::create_directoryfails when the parent does not exist, so anoutput path like
-o out/some/new/pathaborts withand exits 1 — after the Dart VM build has already run, which is what makes a
one-line bug worth reporting.
create_directorieshasmkdir -psemantics. Both overloads return false foran existing directory without setting the error code, so the surrounding guard
is unchanged, and a genuine failure — an unwritable parent, or a file in the
way — is still reported and still exits 1.
Adds
tests/test_output_directory.py: standard library only, no test frameworkintroduced, and no sample application needed. The directory is created before
the snapshot is loaded, so the tests pass a deliberately invalid input file and
assert only that the run does not fail at directory creation. Seven cases,
under a second: missing parent, deeply nested, existing directory, single
component, output path is a file, parent component is a file, unwritable
parent.