Honor architecture.json filepath for prompts in nested .pddrc contexts - #2019
Closed
Serhan-Asad wants to merge 18 commits into
Closed
Honor architecture.json filepath for prompts in nested .pddrc contexts#2019Serhan-Asad wants to merge 18 commits into
Serhan-Asad wants to merge 18 commits into
Conversation
…se regression Cover the PR #1971 replacement behavior for get_pdd_file_paths: - Nested prompts/backend regression: a module resolved under a nested .pddrc prompt root still selects the repository-prompt-root-relative architecture filepath (red before the fix; falls back to the wrong .pddrc code template). - Control: a context-relative architecture filename resolves via the primary lookup, without needing the repository-prompt-root retry. - Control: a custom prompt root outside <project>/prompts does not activate the fallback (the architecture filepath is not honored). - Single-architecture-parse regression: one get_pdd_file_paths resolution parses architecture.json exactly once, so a concurrent rewrite cannot pair a prompt from one registry version with a code target from another. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d .pddrc
get_pdd_file_paths resolves a prompt's code deliverable with architecture.json's
`filepath` as tier-1. architecture.json `filename` fields are stored relative to
the repository `prompts/` root (e.g. "backend/credits_Python.prompt"), but a
nested .pddrc context whose `prompts_dir` points at a subdirectory (e.g.
"prompts/backend") makes the primary lookup key relative to that subdirectory
("credits_Python.prompt") — which never matches the stored filename. Tier-1 then
silently missed and fell back to the wrong .pddrc code template.
Fix: only after a complete primary architecture miss, recompute the lookup key
relative to <architecture root>/prompts and retry. Both keys are computed
lexically with os.path.abspath (not Path.resolve()), so approved lexical prompt
aliases (#1991) remain valid, and the != guard plus try/except ValueError keep
this a pure no-op fallback that never fires when the prompt tree is not under
`prompts/`.
Parse architecture.json once per resolution and thread the same in-memory module
snapshot through _architecture_module_choices, _find_prompt_file, and
_get_filepath_from_architecture (new optional `modules` parameter, backward
compatible). A single snapshot means a concurrent architecture rewrite
mid-resolution cannot pair a prompt selected from one registry version with a
code target from another. Preserves current-main _architecture_artifact_paths,
global-sync, approved-alias, and path/fingerprint governance behavior.
Add the smallest observable contract for this behavior to the governing prompt
(requirement 6). Reported downstream: promptdriven/pdd_cloud#3203.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PDD-Auto-Heal-Checkpoint: success
…0713' into recovery/pr1971-stacked-20260713 # Conflicts: # .pdd/verification-profile-rotations.json
…0713' into recovery/pr1971-stacked-20260713 # Conflicts: # .pdd/verification-profile-rotations.json
Serhan-Asad
force-pushed
the
recovery/pr2003-narrow-port-20260713
branch
7 times, most recently
from
July 20, 2026 21:38
ebd2cd0 to
55bd43a
Compare
Collaborator
Author
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.
Clean replacement for #1971
This is the narrow, reviewed replacement for #1971. It is intentionally stacked on #2017 so GitHub shows only the resolver change; merge #2017 first, then retarget/rebase this PR to
mainbefore the manager merges it.Problem
When a nested
.pddrcsetsprompts_dirto a subdirectory such asprompts/backend, prompt discovery can produce a context-relative filename such ascredits_Python.promptwhilearchitecture.jsonstores the repository-prompt-root-relative namebackend/credits_Python.prompt. That mismatch can skip the authoritative architecture filepath and incorrectly fall back to configured output paths.Fix
<architecture root>/promptsonly after a complete primary miss.<architecture root>/prompts.architecture.jsononce and thread a frozen module snapshot through ambiguity checks, prompt discovery, and code-path selection, including failed/empty loads.Validation
git diff --checkpassed.a9876f16dad191875333664e7527b12dda2ac521.Tracking issue: #1976. Supersedes #1971 after this replacement is accepted.
Manager order: merge #2017 first; then retarget/rebase this PR to
mainand merge it second.