Add failing tests for #1677: pdd sync module resolver ambiguous basename#1681
Draft
prompt-driven-github[bot] wants to merge 1 commit into
Draft
Add failing tests for #1677: pdd sync module resolver ambiguous basename#1681prompt-driven-github[bot] wants to merge 1 commit into
prompt-driven-github[bot] wants to merge 1 commit into
Conversation
Adds regression tests covering four bugs in module identity resolution: Bug 1 (agentic_sync.py:391): `if fp_stem not in basename_counts` guard prevents any filepath stem from being counted more than once, making ambiguity detection impossible for modules with the same leaf filename. Bug 2 (agentic_sync.py:394): `set(basename_counts.keys())` discards all count data before the validity loop, so even correctly-counted ambiguous basenames pass through as valid. Bug 3 (sync_determine_operation.py:528): The filepath cross-check safeguard is gated on `"/" in basename`; bare basenames like "page" fall through to unconditional first-match return, silently selecting the wrong module path. Bug 4 (agentic_sync.py:2279-2289): AsyncSyncRunner in the agentic code path is constructed without `module_targets`, so _build_command falls back to bare basename for all child sync subprocesses. Real production evidence: pdd_cloud PR #1828 generated `frontend/src/page.tsx` instead of `frontend/src/app/login/page.tsx`. Fixes #1677 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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 #1677:
pdd syncresolves modules by short leaf basenames (e.g.,page) rather than canonical path-qualified IDs, causing wrong-path file generation when multiple modules share the same basename.Test Files
tests/test_issue_1677_module_resolver.pyWhat This PR Contains
Root Cause
Four implementation bugs in the module identity resolution path:
Bug 1 (
agentic_sync.py:391):if fp_stem not in basename_countsguard prevents any filepath stem from being counted more than once. Twopage.tsxentries in different directories never produce count > 1 for the bare"page"stem.Bug 2 (
agentic_sync.py:394):set(basename_counts.keys())discards all count data before the validity loop. Even if count reaches 2 (via the filename path), the set conversion makes"page"(count=2) indistinguishable from"page"(count=1).Bug 3 (
sync_determine_operation.py:528): The filepath cross-check safeguard is gated on"/" in basename; bare basenames like"page"fall through to unconditional first-match return, silently selecting the wrong module path.Bug 4 (
agentic_sync.py:2279-2289):AsyncSyncRunnerin the agentic code path is constructed withoutmodule_targets;_build_commandatagentic_sync_runner.py:2098falls back to bare basename for all child sync subprocesses.Real production evidence:
pdd_cloudPR #1828, PDD bot commits82f2723b/7782f10c(2026-05-29) generatedfrontend/src/page.tsxinstead offrontend/src/app/login/page.tsx.Test Results (Current Code)
Next Steps
if fp_stem not in basename_counts:toif fp_stem:atagentic_sync.py:391set(basename_counts.keys())with count-aware check atagentic_sync.py:394if "/" in basename:gate atsync_determine_operation.py:528; return(None, None)when multiple entries match a bare basenamemodule_targetsdict toAsyncSyncRunnerin the agentic path (agentic_sync.py:2279-2289)pytest -vv tests/test_issue_1677_module_resolver.pypytest -vv tests/Fixes #1677
Generated by PDD agentic bug workflow