Add failing tests for #154: file overwrite silently skipped#344
Draft
jamesdlevine wants to merge 4 commits intopromptdriven:mainfrom
Draft
Add failing tests for #154: file overwrite silently skipped#344jamesdlevine wants to merge 4 commits intopromptdriven:mainfrom
jamesdlevine wants to merge 4 commits intopromptdriven:mainfrom
Conversation
…the .[dev] requirements from the current worktree - Added a phony target to do the update; made the appropriate test targets depend on it.
…ne/pdd into makefile-update-pdd-conda-env
Address Copilot review feedback: the ensure-dev-deps dependency is redundant on all-regression since regression, sync-regression, and cloud-regression already depend on it. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… skipped This commit adds unit tests and E2E tests that reproduce the bug where "generation overwrite a file doesn't always happen". The tests verify that the code should raise an error when output_path is empty or None, rather than silently skipping the file write. Unit tests (tests/test_code_generator_main.py): - test_issue_154_empty_output_path_should_raise_error - test_issue_154_none_output_path_should_raise_error - test_issue_154_llm_should_not_be_called_with_invalid_output_path E2E tests (tests/test_e2e_issue_154_overwrite.py): - test_generate_fails_when_output_path_is_empty - test_generate_fails_when_output_path_is_empty_string - test_generate_succeeds_when_output_path_is_valid - test_no_overwrite_prompt_when_output_path_invalid These tests currently FAIL on the buggy code and will pass once the fix is implemented at pdd/code_generator_main.py:1087. Fixes promptdriven#154 Co-Authored-By: Claude Opus 4.5 <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.
Summary
Adds failing tests that detect the bug reported in #154 where "generation overwrite a file doesn't always happen".
Test Files
tests/test_code_generator_main.py(new tests inTestIssue154OverwriteNotHappeningclass)tests/test_e2e_issue_154_overwrite.pyWhat This PR Contains
Root Cause
There's an architectural disconnect between overwrite confirmation and file write operations. The overwrite confirmation happens in
construct_paths(), but the actual write happens later with additional conditional gates. Ifoutput_pathis falsy (empty string or None), the write is silently skipped atpdd/code_generator_main.py:1087.Bug Location:
pdd/code_generator_main.py:1087- theif output_path:check silently skips the write block instead of failing early with a clear error.Failing Tests
Unit Tests
test_issue_154_empty_output_path_should_raise_error- Verifies empty output_path raisesclick.UsageErrortest_issue_154_none_output_path_should_raise_error- Verifies None output_path raisesclick.UsageErrortest_issue_154_llm_should_not_be_called_with_invalid_output_path- Verifies LLM is NOT called when output_path is invalidE2E Tests
test_generate_fails_when_output_path_is_empty- Command should fail with non-zero exit codetest_generate_fails_when_output_path_is_empty_string- Command should fail for empty string outputtest_no_overwrite_prompt_when_output_path_invalid- No misleading overwrite confirmation when write will be skippedNext Steps
pdd/code_generator_main.py:1087Fixes #154
Generated by PDD agentic bug workflow