fix: bootstrap metadata for nested prompts - #2399
Conversation
There was a problem hiding this comment.
💡 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".
gltanaka
left a comment
There was a problem hiding this comment.
Changes requested — Tier A, full-diff review at 56b50db63.
-
P1 — the issue path is registered with the wrong source filepath (
pdd/metadata_sync.py:420). The new call toregister_untracked_promptsignores the authoritativecode_path. For issue #2387 exact layout,pdd/prompts/sync_core/manifest_python.promptis registered asfilepath=sync_core/manifest.py, while the real source ispdd/sync_core/manifest.py; metadata sync still reportsok=True. The new test asserts only that the filename exists, so it misses this broken architecture edge. Pass or otherwise preserve the repo-relativecode_path, and add an exactpdd/prompts/sync_coreregression/E2E assertion forfilepath. -
P1 — bootstrap persists an invalid placeholder interface (
pdd/metadata_sync.py:168-173). The injected{"type":"module"}fails the repository validator withMissing module key for type=module; it also declares none of the source public surface. Becausehas_pdd_tagsthen 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. -
P1 — the protected verification profile is broken at PR HEAD (
pdd/sync_core/verification.py:175-183and.pdd/verification-profile-rotations.json). The PR pins the metadata transition to profile digest3af7bc..., but the merged HEAD profile bytes hash toa5d973.... The four focused rollout-policy tests fail, matching the GitHub unit-test job; the PR also now conflicts with currentmainin the rotations file. Rebase currentmain, 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 returnssync_core/manifest.pyinstead ofpdd/sync_core/manifest.py.- The four affected
tests/test_sync_core_pdd_rollout_policy.pycases — 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.
…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>
56b50db to
561f7fa
Compare
gltanaka
left a comment
There was a problem hiding this comment.
Follow-up review at 561f7fab7 after the force-rebase/remediation: changes are still required.
-
P1 — protected profile integration remains invalid.
.pdd/verification-profile-rotations.jsonstill binds the metadata transition to stale profile hashes (6e5891… → 3af7bc…) rather than the current base/head bytes (85d010… → a50598…), andpdd/sync_core/verification.pystill 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 currentmainand the final artifacts, then rerun the rollout suite. -
P1 — the runtime fixes are missing from the prompt/architecture source of truth.
pdd/prompts/metadata_sync_python.promptstill specifies the old invalid{"type":"module"}bootstrap and does not require the authoritative code filepath.pdd/prompts/architecture_sync_python.promptand thearchitecture_sync_python.promptentry inarchitecture.jsonstill exposeregister_untracked_prompts(..., only_files=None)without the newknown_filepathsparameter. Regeneration can therefore remove this remediation and recreate both prior bugs. Update both prompt contracts andarchitecture.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
left a comment
There was a problem hiding this comment.
Third review at 1aa266efa: changes are still required.
-
P1 — duplicate active metadata transitions invalidate the protected policy.
.pdd/verification-profile-rotations.jsonretains the earliermetadata_synctransition6ab860… → 4b5dba…and adds6ab860… → 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 withprotected active requirement transition rules are ambiguous. Remove or correctly supersede the stale branch-local row and rebuild exact bindings against currentmain. -
P1 — the protected rollout assertion does not recognize the new profile state.
test_sync_rollout_repair_executes_the_actual_protected_transitionstill permits profile heads only through the prior dependency-fix state, while final HEAD isaca4c6…; 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.
Summary
pdd update --sync-metadataarchitecture.jsonFixes #2387
Validation
pytest -q tests/test_metadata_sync.py