Skip to content

Add failing tests for #493: update --output subdirectory crash#496

Merged
gltanaka merged 4 commits intopromptdriven:mainfrom
Serhan-Asad:fix/issue-493
Feb 16, 2026
Merged

Add failing tests for #493: update --output subdirectory crash#496
gltanaka merged 4 commits intopromptdriven:mainfrom
Serhan-Asad:fix/issue-493

Conversation

@Serhan-Asad
Copy link
Contributor

Summary

Adds failing tests that detect the bug reported in #493.

Test Files

  • Unit test: tests/test_update_main.py
  • E2E test: tests/test_e2e_issue_493_update_output_subdir.py

What This PR Contains

  • Failing unit test that reproduces the reported NameError
  • Failing E2E test that verifies the bug at integration level
  • Tests are verified to fail on current code and will pass once the bug is fixed

Root Cause

context_config is only defined in the else branch (line 75 of update_main.py) but used unconditionally at line 91 when the code file is in a subdirectory. Fix: initialize context_config = {} before the if/else block.

Next Steps

  1. Implement the fix (add context_config = {} before the if/else block)
  2. Verify the unit test passes
  3. Verify the E2E test passes
  4. Run full test suite
  5. Mark PR as ready for review

Fixes #493


Generated by PDD agentic bug workflow

…n#493)

Unit test and E2E test that reproduce the NameError when using
pdd update with --output flag on a code file in a subdirectory.
context_config is only defined in the else branch but used
unconditionally at line 91.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 12, 2026 14:42
@gltanaka gltanaka requested a review from Copilot February 13, 2026 02:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds regression coverage for issue #493 where pdd update --output crashes when the target code file lives in a subdirectory, and includes the minimal fix to prevent the context_config scoping error.

Changes:

  • Add unit tests covering resolve_prompt_code_pair() with/without --output and with root/subdirectory code paths.
  • Add an E2E regression test exercising update_main() with --output + subdirectory code file.
  • Initialize context_config = {} before branching on output_dir to avoid UnboundLocalError.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tests/test_update_main.py Adds unit regression tests for resolve_prompt_code_pair() covering the reported crash scenario.
tests/test_e2e_issue_493_update_output_subdir.py Adds an integration-level test to reproduce issue #493 via update_main() with --output.
pdd/update_main.py Fixes scoping by initializing context_config before it’s used in subdirectory path logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Serhan-Asad Serhan-Asad marked this pull request as draft February 13, 2026 02:58
- Remove unused imports (os, pytest) from e2e test
- Replace hardcoded line number references with descriptive text in docstrings
- Use Path.is_relative_to() instead of fragile substring check for path assertion
- Fix missing newline at EOF in test_update_main.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 13, 2026 20:57
@gltanaka gltanaka marked this pull request as draft February 13, 2026 23:37
@gltanaka gltanaka marked this pull request as ready for review February 13, 2026 23:37
@gltanaka gltanaka marked this pull request as draft February 13, 2026 23:43
@gltanaka
Copy link
Contributor

please fix the CI failures

@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 14, 2026 14:59
@Serhan-Asad Serhan-Asad marked this pull request as draft February 14, 2026 15:03
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 14, 2026 15:30
@Serhan-Asad Serhan-Asad marked this pull request as draft February 14, 2026 15:31
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 15, 2026 16:23
@Serhan-Asad Serhan-Asad marked this pull request as draft February 15, 2026 16:32
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 15, 2026 21:22
@Serhan-Asad Serhan-Asad marked this pull request as draft February 15, 2026 21:23
@Serhan-Asad Serhan-Asad marked this pull request as ready for review February 15, 2026 22:39
@gltanaka gltanaka merged commit 03ad2b9 into promptdriven:main Feb 16, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pdd update --output crashes with NameError when code file is in subdirectory

2 participants