fix: pdd-change Step 6 should use <pdd-dependency> tags, not <include> tags - #2376
fix: pdd-change Step 6 should use <pdd-dependency> tags, not <include> tags#2376agarwal-ishaan wants to merge 15 commits into
Conversation
…not <include> Step 6's _build_dependency_context() currently builds its module-dependency graph by scanning <include> tags (build_dependency_graph()), but <include> tags are LLM context, not declared architectural dependencies. A module can truly depend on another via <pdd-dependency> without ever <include>-ing it, and can <include> another module's example purely for style without depending on it at all -- so the current graph both misses real dependents and fabricates false ones. Updates the source prompts (not the generated code yet) to specify a new sync_order.build_dependency_graph_from_architecture() that reads architecture.json's `dependencies` field (already populated from <pdd-dependency> tags by architecture_sync.py) and wires it into Step 6's dependency context instead. Fixes promptdriven#1807 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… not pseudocode Restyles the two sections added for promptdriven#1807 (sync_order's 3a and agentic_change_orchestrator's Dependency Context section) to state the required behavior in prose, matching the prompting guide's requirements-as- contract convention, instead of an imperative step-by-step algorithm.
Implements the function specified in pdd/prompts/sync_order_python.prompt (PR promptdriven#2373): builds the module dependency graph from architecture.json's `dependencies` field (populated from <pdd-dependency> tags) instead of scanning <include> tags, matching what pdd-change Step 6 needs per promptdriven#1807. Generated via `pdd generate --incremental`. Adds unit tests covering the bare-array and {"modules": [...]} architecture.json formats, and missing/ invalid-file handling.
_build_dependency_context() now takes architecture_path and calls build_dependency_graph_from_architecture() (added in promptdriven#2375) instead of the include-based build_dependency_graph(prompts_dir). This is the actual Step 6 behavior fix from promptdriven#1807: the dependency graph shown to the LLM now reflects declared <pdd-dependency> tags (via architecture.json) instead of <include> tags, so it no longer misses real dependents or fabricates false ones from stylistic includes. Matches pdd/prompts/agentic_change_orchestrator_python.prompt (promptdriven#2373) exactly. Adds 3 unit tests covering: a <pdd-dependency> edge surfacing correctly with no matching <include>, missing architecture.json, and an empty graph.
…xt prompt Drops the leftover implementation-step narration (which helper function to call, exact variable assignment) in favor of stating the contract: what the summary contains, where it's stored, and when it's empty.
… spec Reverts to the file's established Helper: func_sig: - bullet convention, changing only what the fix actually requires (signature, the function call, the existence check) instead of rephrasing the whole section into prose.
Trims wording (drops "Builds"/"Accepts...as either"/redundant phrasing) to match the file's established telegraphic bullet style, same substance.
…ction Merges the shape/naming-reuse and format-acceptance/self-dep bullets into one; same substance, less bulk for a ~20-line function.
Replaces "same shape as build_dependency_graph()" with the actual shape description, and drops the "NOT build_dependency_graph(prompts_dir)" comparison (the surrounding paragraph already establishes that contrast). Each function's contract should stand on its own without requiring the reader to cross-reference a sibling function's spec.
|
/heal |
gltanaka
left a comment
There was a problem hiding this comment.
Thanks for consolidating the earlier prompt and implementation PRs. The architecture-based direction is sensible, but this version has two merge-blocking correctness problems:
-
architecture.json.dependenciesis not currently a<pdd-dependency>-only data source.merge_auto_deps_includes_into_architecture()intentionally writes module/example<include>targets into the same array, and existing tests require that behavior. Consequently, reading this field cannot prove that an include-only module edge is excluded. The new Step 6 test hand-writes JSON without the include edge, so it does not exercise the real prompt → architecture → Step 6 path. -
build_dependency_graph_from_architecture()usesextract_module_from_include()for architecture identities. That helper drops directories and rejects_LLM.promptfiles. This loses real declared dependencies in the current repository. For example,commands/gate_python.prompt -> gate_python.promptcollapses togate -> gateand is discarded as a self-edge; dependencies such asagentic_update_python.prompt -> agentic_update_LLM.promptare also omitted.
Please resolve the dependency provenance/semantics and use a path-preserving architecture identity that supports LLM modules. Add regressions for:
- a real prompt-to-architecture-to-Step-6 flow distinguishing
<pdd-dependency>from context-only<include>; - path-qualified modules with the same basename;
_LLM.promptdependencies;- root plus nested architecture files.
The focused suites pass (317 tests), but they cover only flat _python.prompt names and do not exercise these production shapes. Follow-up scope should also address the issue's requested prompting-guide examples and the retained top-30/top-10 truncation.
…t architecture.json's mixed dependencies field Addresses both merge-blocking issues from PR promptdriven#2376 review: - architecture.json's `dependencies` field is not <pdd-dependency>-only (merge_auto_deps_includes_into_architecture() also writes <include>-derived edges into it), so build_dependency_graph_from_architecture() no longer reads it directly. It now uses architecture.json only to enumerate modules and locate each one's prompt file, then parses <pdd-dependency> tags fresh from that file via the existing architecture_sync helpers. - extract_module_from_include() dropped directory prefixes and rejected _LLM.prompt files, causing real collisions/dropped edges in this repo's own architecture.json (e.g. commands/gate_python.prompt colliding with gate_python.prompt as a false self-edge). Replaced with a new _architecture_module_key() that preserves path and LLM-prompt identity. Replaced the hand-written-JSON tests the reviewer flagged with real prompt-file fixtures covering all four requested regression scenarios: pdd-dependency vs. include-only, path-qualified same-basename collision, _LLM.prompt dependencies, and nested architecture.json files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Implemented the above changes, requesting you to please review |
Summary
pdd changeStep 6 built its module-dependency context by scanning<include>tags (build_dependency_graph()), but<include>tags are LLM context, not declared architectural dependencies. A module can truly depend on another via<pdd-dependency>without ever<include>-ing it, and can<include>another module's example purely for style without depending on it at all -- so the old graph both missed real dependents and fabricated false ones.pdd/prompts/sync_order_python.prompt,pdd/prompts/agentic_change_orchestrator_python.prompt): specify a newbuild_dependency_graph_from_architecture()function and wire Step 6's dependency context to use it.pdd/sync_order.py: implementsbuild_dependency_graph_from_architecture(architecture_path) -> Dict[str, List[str]], readingarchitecture.json'sdependenciesfield (populated from<pdd-dependency>tags byarchitecture_sync.py) instead of scanning<include>tags. Generated viapdd generate --incremental.pdd/agentic_change_orchestrator.py:_build_dependency_context()now takesarchitecture_pathand calls the function above instead of the include-basedbuild_dependency_graph(prompts_dir)-- the actual Step 6 behavior fix.Test plan
pytest tests/test_sync_order.py-- 52 passedpytest tests/test_agentic_change_orchestrator.py-- 265 passedpdd-issue-1807-repro/):_build_dependency_context()now correctly showspayment_status -> affects: customer_service(previously missing) and no longer fabricateslegacy_wizard -> affects: onboardingagentic_sync,sync_graph_order_consistency) that also import fromsync_orderstill import cleanlyFixes #1807