Skip to content

Add failing tests for #1284#1302

Draft
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
fix/issue-1284
Draft

Add failing tests for #1284#1302
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
fix/issue-1284

Conversation

@prompt-driven-github
Copy link
Copy Markdown
Contributor

Summary

Adds failing tests that detect the bug reported in #1284: auto-heal fails on whitespace-only PR commits.

Test Files

  • tests/test_ci_drift_heal.py — Tests 1–4 (direct _get_git_changed_files + caller detect_drift)
  • tests/test_ci_detect_changed_modules.py — Tests 5–7 (scripts/ source, pdd/ mirror, caller detect())

Prompt Files (Step 7 fixes)

  • pdd/prompts/ci_drift_heal_python.prompt — mandates whitespace-aware change detection
  • pdd/prompts/ci_detect_changed_modules_python.prompt — replaces git diff --name-only with git diff -w --numstat

What This PR Contains

  • 7 behavioral failing tests (real git repos, no mocked subprocess.run) that reproduce the reported bug
  • Anti-regression controls confirming functional and mixed whitespace+functional changes are still detected
  • Source-of-truth prompt corrections so regeneration does not reintroduce the whitespace-blind command
  • Tests verified to fail on current code (5 bug-detecting assertions fail, 2 controls pass) and will pass once the bug is fixed

Root Cause

Changed-file detection uses whitespace-blind git diff --name-only <base> in pdd/ci_drift_heal.py:_get_git_changed_files (and the sibling _git_changed_files in both pdd/ and scripts/ci_detect_changed_modules.py). A trailing-whitespace-only commit is reported as a changed file, so detect_drift reclassifies the module to an update operation and triggers a spurious pdd update heal — failing auto-heal on an approved, otherwise-green PR. The fix is to derive the changed set from git diff -w --numstat <base> (path column); note git diff -w --name-only does NOT work because -w does not affect tree-level name selection.

Next Steps

  1. Implement the fix at the three code sites (parse git diff -w --numstat, third tab-separated path field), keeping the pdd/ mirror byte-identical to the scripts/ source
  2. Verify the 7 behavioral tests pass
  3. Run full test suite for regressions
  4. Mark PR as ready for review

Fixes #1284


Generated by PDD agentic bug workflow

Changed-file detection uses whitespace-blind `git diff --name-only`, so a
trailing-whitespace-only commit is treated as a real code change. This
reclassifies the module to an `update` op and triggers a spurious heal,
failing auto-heal on approved, otherwise-green PRs.

Adds behavioral tests (real git repos) covering all three code sites
(ci_drift_heal, scripts/ and pdd/ ci_detect_changed_modules) plus the
caller paths (detect_drift, detect). Also corrects the source-of-truth
prompt specs to mandate whitespace-aware detection via
`git diff -w --numstat`.

Tests fail on current code and will pass once detection ignores
whitespace-only changes.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
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.

auto-heal fails on whitespace-only PR updates

1 participant