Skip to content

fix: bootstrap metadata for nested prompts - #2399

Open
agarwal-ishaan wants to merge 5 commits into
promptdriven:mainfrom
agarwal-ishaan:fix/bootstrap-nested-prompt-metadata
Open

fix: bootstrap metadata for nested prompts#2399
agarwal-ishaan wants to merge 5 commits into
promptdriven:mainfrom
agarwal-ishaan:fix/bootstrap-nested-prompt-metadata

Conversation

@agarwal-ishaan

Copy link
Copy Markdown
Collaborator

Summary

  • bootstrap deterministic PDD tags for a new prompt during pdd update --sync-metadata
  • register only that prompt-relative path before synchronizing architecture.json
  • cover nested registration and dry-run behavior

Fixes #2387

Validation

  • pytest -q tests/test_metadata_sync.py

@gltanaka
gltanaka marked this pull request as ready for review August 12, 2026 16:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cc6e2c6d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pdd/metadata_sync.py
Comment thread pdd/metadata_sync.py
Comment thread pdd/metadata_sync.py Outdated

@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.

Changes requested — Tier A, full-diff review at 56b50db63.

  1. P1 — the issue path is registered with the wrong source filepath (pdd/metadata_sync.py:420). The new call to register_untracked_prompts ignores the authoritative code_path. For issue #2387 exact layout, pdd/prompts/sync_core/manifest_python.prompt is registered as filepath=sync_core/manifest.py, while the real source is pdd/sync_core/manifest.py; metadata sync still reports ok=True. The new test asserts only that the filename exists, so it misses this broken architecture edge. Pass or otherwise preserve the repo-relative code_path, and add an exact pdd/prompts/sync_core regression/E2E assertion for filepath.

  2. P1 — bootstrap persists an invalid placeholder interface (pdd/metadata_sync.py:168-173). The injected {"type":"module"} fails the repository validator with Missing module key for type=module; it also declares none of the source public surface. Because has_pdd_tags then becomes true, later syncs preserve this fabricated metadata indefinitely while reporting success. Derive and validate the interface from the prompt/source before persisting it, or at minimum do not write a structurally invalid interface or claim successful bootstrap.

  3. P1 — the protected verification profile is broken at PR HEAD (pdd/sync_core/verification.py:175-183 and .pdd/verification-profile-rotations.json). The PR pins the metadata transition to profile digest 3af7bc..., but the merged HEAD profile bytes hash to a5d973.... The four focused rollout-policy tests fail, matching the GitHub unit-test job; the PR also now conflicts with current main in the rotations file. Rebase current main, recompute the composed rotation/retirement authority and byte pins for the final artifacts, then rerun the rollout suite.

Validation:

  • pytest -q tests/test_metadata_sync.py — 49 passed.
  • pytest -q tests/test_architecture_sync.py -k "register_untracked_prompts or infer_filepath" — 11 passed, but direct issue-path inference returns sync_core/manifest.py instead of pdd/sync_core/manifest.py.
  • The four affected tests/test_sync_core_pdd_rollout_policy.py cases — 4 failed, identical to CI.
  • validate_interface_structure({"type":"module"}) — invalid.
  • Prior inline findings on basename borrowing, malformed architecture, and tagged-prompt dry-run reporting are fixed at HEAD.

The problem is real and this bootstrap path is needed, but contributor E2E evidence is not sufficient: the focused suite does not exercise the repository layout from #2387, validate the generated architecture entry, validate the injected interface, or cover the protected profile integration. The prompt and profile artifacts are present; the existing architecture.json entry for metadata_sync still matches its unchanged public API, so that file itself does not need an interface update.

agarwal-ishaan and others added 4 commits August 14, 2026 20:39
…d bootstrap interface

register_untracked_prompts inferred the source filepath purely from the
prompt filename, which drops the pdd/ package prefix for prompts nested
under a subdirectory (e.g. pdd/prompts/sync_core/manifest_python.prompt
resolved to sync_core/manifest.py instead of pdd/sync_core/manifest.py).
Add a known_filepaths override and have metadata_sync pass the real
repo-relative code_path through it when available.

Also fix _bootstrap_tags_content's placeholder interface: {"type": "module"}
fails validate_interface_structure (missing the "module" key), but still
satisfies has_pdd_tags, so later syncs preserved the invalid metadata
indefinitely while reporting success. Use a structurally valid empty
interface instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@agarwal-ishaan
agarwal-ishaan force-pushed the fix/bootstrap-nested-prompt-metadata branch from 56b50db to 561f7fa Compare August 15, 2026 01:31

@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.

Follow-up review at 561f7fab7 after the force-rebase/remediation: changes are still required.

  1. P1 — protected profile integration remains invalid. .pdd/verification-profile-rotations.json still binds the metadata transition to stale profile hashes (6e5891… → 3af7bc…) rather than the current base/head bytes (85d010… → a50598…), and pdd/sync_core/verification.py still carries incompatible pins. Final-head CI fails five protected rollout-policy tests, including retirement-byte validation and current-profile reconciliation. Rebuild the composed transition/retirement authority against current main and the final artifacts, then rerun the rollout suite.

  2. P1 — the runtime fixes are missing from the prompt/architecture source of truth. pdd/prompts/metadata_sync_python.prompt still specifies the old invalid {"type":"module"} bootstrap and does not require the authoritative code filepath. pdd/prompts/architecture_sync_python.prompt and the architecture_sync_python.prompt entry in architecture.json still expose register_untracked_prompts(..., only_files=None) without the new known_filepaths parameter. Regeneration can therefore remove this remediation and recreate both prior bugs. Update both prompt contracts and architecture.json, then rotate the resulting protected profiles.

Disposition of the earlier findings:

  • Wrong nested filepath: runtime fixed; exact issue-layout regression passes.
  • Invalid interface structure: runtime fixed; validator-backed test passes.
  • Protected profile integration: unresolved.

Validation: tests/test_metadata_sync.py 50 passed; relevant architecture registration/inference tests 11 passed; final-head GitHub Unit Tests 5 failed / 16,441 passed; git diff --check passed. The PR is conflict-free now, but it is not mergeable while required CI and generated-source synchronization remain broken.

… profiles

pdd/prompts/metadata_sync_python.prompt still specified the invalid
{"type":"module"} bootstrap interface and didn't require the authoritative
code filepath; pdd/prompts/architecture_sync_python.prompt and its
architecture.json entry still exposed register_untracked_prompts(...,
only_files=None) without the known_filepaths parameter the runtime now
uses. Regenerating from these prompts would have silently reintroduced
both bugs the runtime already fixed.

Update both prompt contracts and architecture.json to match the runtime,
and rotate the resulting protected verification profiles: append the two
requirement transitions to .pdd/verification-profile-rotations.json and
bind them in pdd/sync_core/verification.py as a new composed transition
based on the real post-rebase merge-base (main's promptdriven#2376 dependency-fix
state), since the prior branch-local pin had gone stale after rebasing
onto a main that had since merged promptdriven#2374/promptdriven#2376.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@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.

Third review at 1aa266efa: changes are still required.

  1. P1 — duplicate active metadata transitions invalidate the protected policy. .pdd/verification-profile-rotations.json retains the earlier metadata_sync transition 6ab860… → 4b5dba… and adds 6ab860… → 99b422… for the same prompt/language/source identity. The verifier correctly rejects those competing successors as ambiguous. Final-head unit CI fails 16 tests, predominantly with protected active requirement transition rules are ambiguous. Remove or correctly supersede the stale branch-local row and rebuild exact bindings against current main.

  2. P1 — the protected rollout assertion does not recognize the new profile state. test_sync_rollout_repair_executes_the_actual_protected_transition still permits profile heads only through the prior dependency-fix state, while final HEAD is aca4c6…; it fails independently of the ambiguity. Advance the protected-history assertion for the reviewed final composed state.

Current-main compatibility is also blocking: GitHub reports CONFLICTING / DIRTY, with conflicts in .pdd/verification-profile-rotations.json and pdd/sync_core/verification.py. Rebase and compose this transition with the current main profile state, then rerun the complete rollout/profile suite.

Prior source-of-truth findings are resolved: both prompts and architecture.json now include the valid interface and known_filepaths; the nested filepath and interface runtime regressions remain fixed. But this head must not merge while required CI is red and protected transition authority is ambiguous.

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.

sync-architecture cannot bootstrap metadata for a new nested prompt

2 participants