Skip to content

fix: pdd-change Step 6 should use <pdd-dependency> tags, not <include> tags - #2376

Open
agarwal-ishaan wants to merge 15 commits into
promptdriven:mainfrom
agarwal-ishaan:fix/issue-1807-pdd-dependency-orchestrator
Open

fix: pdd-change Step 6 should use <pdd-dependency> tags, not <include> tags#2376
agarwal-ishaan wants to merge 15 commits into
promptdriven:mainfrom
agarwal-ishaan:fix/issue-1807-pdd-dependency-orchestrator

Conversation

@agarwal-ishaan

@agarwal-ishaan agarwal-ishaan commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

pdd change Step 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.

  1. Prompts (pdd/prompts/sync_order_python.prompt, pdd/prompts/agentic_change_orchestrator_python.prompt): specify a new build_dependency_graph_from_architecture() function and wire Step 6's dependency context to use it.
  2. pdd/sync_order.py: implements build_dependency_graph_from_architecture(architecture_path) -> Dict[str, List[str]], reading architecture.json's dependencies field (populated from <pdd-dependency> tags by architecture_sync.py) instead of scanning <include> tags. Generated via pdd generate --incremental.
  3. pdd/agentic_change_orchestrator.py: _build_dependency_context() now takes architecture_path and calls the function above instead of the include-based build_dependency_graph(prompts_dir) -- the actual Step 6 behavior fix.

Test plan

  • pytest tests/test_sync_order.py -- 52 passed
  • pytest tests/test_agentic_change_orchestrator.py -- 265 passed
  • Manual repro (pdd-issue-1807-repro/): _build_dependency_context() now correctly shows payment_status -> affects: customer_service (previously missing) and no longer fabricates legacy_wizard -> affects: onboarding
  • Confirmed no regression: sibling modules (agentic_sync, sync_graph_order_consistency) that also import from sync_order still import cleanly

Fixes #1807

agarwal-ishaan and others added 6 commits August 6, 2026 02:14
…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.
@agarwal-ishaan agarwal-ishaan changed the title fix: wire pdd-change Step 6 dependency context to architecture.json fix: pdd-change Step 6 should use <pdd-dependency> tags, not <include> tags Aug 6, 2026
…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.
@gltanaka
gltanaka self-requested a review August 7, 2026 16:06
@gltanaka

gltanaka commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/heal

@gltanaka gltanaka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for consolidating the earlier prompt and implementation PRs. The architecture-based direction is sensible, but this version has two merge-blocking correctness problems:

  1. architecture.json.dependencies is 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.

  2. build_dependency_graph_from_architecture() uses extract_module_from_include() for architecture identities. That helper drops directories and rejects _LLM.prompt files. This loses real declared dependencies in the current repository. For example, commands/gate_python.prompt -> gate_python.prompt collapses to gate -> gate and is discarded as a self-edge; dependencies such as agentic_update_python.prompt -> agentic_update_LLM.prompt are 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.prompt dependencies;
  • 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>
@agarwal-ishaan

agarwal-ishaan commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Implemented the above changes, requesting you to please review

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.

Make prompt files properly use <pdd-dependency> tags and <include> tags so we can trust our architecture.json

2 participants