Skip to content

chore: PDD sync for #1005 - #1010

Closed
prompt-driven-github[bot] wants to merge 0 commit into
mainfrom
change/issue-1005
Closed

prompt-driven-github[bot] wants to merge 0 commit into
mainfrom
change/issue-1005

Conversation

@prompt-driven-github

Copy link
Copy Markdown
Contributor

Summary

Updates the update_main_python.prompt so that single-file and regeneration runs of pdd update <code> always finalize the .pdd/meta/<module>.json fingerprint via the shared metadata_sync API, and surface explicit stderr warnings whenever finalization fails.

Closes #1005

Changes Made

Prompts Modified

  • pdd/prompts/update_main_python.prompt — Rewrote Requirement 11 (Metadata finalization):
    • Single-file & regeneration modes now invoke _run_single_file_metadata_sync(prompt_path, code_path, dry_run=dry_run) unconditionally on success (no longer gated by sync_metadata=True).
    • Helper failure lines (orchestrator exceptions and per-stage failed reasons) MUST be written to stderr via Console(stderr=True) or click.echo(..., err=True), naming the stage and reason.
    • Helper returning False causes update_main to raise click.exceptions.Exit(1) so callers (including the preflight auto-heal subprocess) see a non-zero return code. No silent stale-metadata path remains.
    • dry_run is plumbed through the helper so dry-runs remain a no-op.
    • Repo mode behavior is preserved as opt-in via sync_metadata=True (out of scope per Split Contract).

Architecture

  • architecture.json — Encoding-only refresh from the prompt edit (em-dashes re-serialized as \u2014); no semantic change.

Review Checklist

  • Prompt syntax is valid
  • PDD conventions followed (WHAT not HOW, testable requirements)
  • Requirement 11 covers happy path + stderr warning surface
  • Repo-mode opt-in semantics preserved
  • dry_run semantics preserved

Next Steps After Merge

  1. Regenerate code and tests from the modified prompt in dependency order:
    ./sync_order.sh
    Or manually:
    pdd sync sync_main
    pdd sync maintenance
    pdd sync update_main
    pdd sync modify
    pdd sync pin_example_hack
    pdd sync sync_orchestration
    
  2. Run pytest -vv tests/test_update_main.py to verify the regression tests for the happy path and the finalization-failure surface.
  3. Verify .pdd/meta/<module>.json is written after a successful single-file pdd update <code> run.

Created by pdd change workflow

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@prompt-driven-github prompt-driven-github Bot changed the title feat: finalize fingerprint state after successful single-file pdd update (#1005) chore: PDD sync for #1005 May 14, 2026
@Serhan-Asad

Copy link
Copy Markdown
Collaborator

Step 7/8: Review Loop Final Report

PR: #1010
Issue: #1005
issue_aligned: false
reviewer-status: codex=findings claude=fixer fresh-final=missing
fresh-final-review: missing
max-rounds-reached: true
max-cost-reached: false
max-duration-reached: false

Summary

Max review rounds reached: 5.

Per-Reviewer Status

Reviewer Status
codex findings
claude fixer
fresh-final missing

Findings

Severity Status Location Finding Required fix Reviewer
medium open - .pdd/meta/update_main_python.json:5 is stale/incorrect. The recorded hashes do not match the current PR files; for example current pdd/update_main.py is 3ab6238d..., but the metadata records eb894eb.... This directly conflicts with the issue’s fingerprint-finalization goal. Address the reviewer finding. codex
medium open - pdd/prompts/calculator_python.prompt:1 and pdd/prompts/module_python.prompt:1 are deleted, outside the split contract’s allowed write set. module_python.prompt is referenced by README examples, so this is user-visible drift. Address the reviewer finding. codex
medium open - tests/test_update_main.py:560 only asserts that _run_single_file_metadata_sync was called, while mocking out the helper. It does not exercise that .pdd/meta/<module>.json is actually written on the happy path, despite the acceptance criterion requiring that regression coverage. Address the reviewer finding. codex

Fixer Rationale

  • none

Fixes Attempted

  • claude: success; verification=unverified; changed_files=pdd/update_main.py; Applied all four medium findings in pdd/update_main.py: (1) repo dry-run now prints a pending-pair report and returns early without calling update_file_pair or running LLMs/writes; (2) update_main now forwards budget to _run_repo_mode, which breaks the loop once cumulative cost reaches the cap; (3) restored default values for use_git, repo, extensions, directory, strength, and temperature on the public update_main signature so legacy internal callers (sync_orchestration.py, pin_example_hack.py, commands/modify.py) keep working; (4) regeneration mode now distinguishes an explicit prompt-file --output path from an output directory: a non-directory --output is used directly as the destination prompt path instead of being passed as output_dir to resolve_prompt_code_pair. tests/test_update_main.py passes (45/45). Two pre-existing unrelated test failures (test_e2e_issue_493_update_output_subdir.py, tests/test_sync_code_main.py::test_python_file) exist on the base branch and are not caused by these fixes; confirmed via git stash.
  • claude: success; verification=unverified; changed_files=pdd/update_main.py; Fixed the critical input_prompt regression by mirroring base behavior (read existing prompt; git_update if non-empty, else update_prompt with placeholder). Also fixed the P1 architecture_registry import location, the P1 'no changes' arch counting, and the P2 ensure_pddrc_for_scan call signature. The P2 contract-scope concern about generated artifacts (architecture.json, fingerprints, calculator/module prompts, etc.) is out of scope for a focused code fix and is governance-level, not runtime behavior.
  • claude: success; verification=unverified; changed_files=pdd/prompts/module_python.prompt; Fixed extensions string-parsing in repo mode by handling both comma-separated strings and tuples/lists. Reworked the agentic single-file path so when --output names a destination distinct from the source prompt, the destination is seeded with the source content and the agentic update + metadata finalization run against the destination, preserving the source. Removed two new out-of-scope test-artifact prompt files (calculator_python.prompt, module_python.prompt) and reverted the .pdd/meta/update_main_python.json fingerprint to its PR-base content to shrink the PR's diff toward the issue's allowed scope. Kept architecture.json and context/update_main_example.py because the project's prompt+code+example+test sync invariant requires the example to track the prompt, and architecture.json includes a legitimate update_main signature update.
  • claude: success; verification=unverified; changed_files=pdd/prompts/module_python.prompt, pdd/update_main.py, tests/test_update_main.py; Restored .pddrc outputs.prompt.path resolution via construct_paths.detect_context_for_file (the missing pddrc_loader import path was silently swallowing failures). Tightened repo-mode --sync-metadata exit logic so None entries (orchestrator exceptions) trigger Exit(1). Deleted the empty pdd/prompts/module_python.prompt artifact and patched the test that was recreating it. Added two regression tests. Kept architecture.json and context/update_main_example.py because the prompt+code+example+test sync invariant requires the example to track update_main_python.prompt.
  • claude: success; verification=unverified; changed_files=pdd/update_main.py, tests/test_update_main.py; Fixed three medium findings. (1) get_language() now receives just the suffix in resolve_prompt_code_pair and find_and_resolve_all_pairs, so component.tsx resolves to TypeScriptReact and extension filtering works correctly. (2) _run_single_file_metadata_sync now treats a non-ok fingerprint stage as a failure in non-dry-run mode and emits a stderr failure line, so custom.prompt no longer silently 'syncs' when no fingerprint was written. (3) Re-imported get_available_agents into pdd.update_main and added a gate that short-circuits the agentic single-file path when no agents are available; updated the two TestAgenticRouting tests in tests/test_update_main.py to mock get_available_agents so they still exercise the agentic path under the autouse CLI-isolation fixtures. Also fixed a follow-on bug uncovered by the regression test: in regeneration mode with a directory --output, output_path was being set to the directory itself and the final write failed with [Errno 21]; output_path is now the resolved prompt file path under that directory.

Serhan-Asad added a commit that referenced this pull request May 16, 2026
Iteration 1 of claude+codex review loop on PR #1010 (issue #1005).

- Re-expose read_fingerprint, calculate_sha256, git, subprocess at module
  level so tests in test_sync_code_main.py can patch them.
- derive_basename_and_language: accept str|Path, return /-joined relative
  stem and lowercase language; return (None, None) for unknown extensions.
- _check_include_deps_changed, is_code_changed, get_git_changed_files:
  call helpers via module-level names; align reason strings; new merge-base
  call sequence.
- Resolve pddrc strength in single-file and repo modes so .pddrc context
  values flow through to update_prompt.
- Refresh .pdd/meta/update_main_python.json hashes to match current files.
- Add test_single_file_metadata_writes_current_fingerprint_on_success
  integration test (issue #1005 acceptance criterion).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Finalize fingerprint state after successful single-file pdd update <code>

1 participant