Skip to content

pdd sync --dry-run returns success without analyzing modules that lack a sync log #1978

Description

@niti-go

Problem

pdd sync <basename> --dry-run advertises that it will "Analyze sync state without executing operations" and "Show what sync would do." For an existing prompt/source module with no prior sync log, the command instead reports only:

Found prompt via template in context: src
PDD Sync Dry Run
No sync log found for '<basename>' in language 'python'.
Step 1 (sync): Cost: $0.000000

It does not compare the current prompt, source, tests, or examples, does not explain whether they are synchronized, and does not show a prospective operation. The same behavior reproduces for a nested router module.

This makes --dry-run unusable for the important case where a developer has just brought prompt and code contracts into sync but the repository has no historical sync-log entry for that module.

Reproduction

From a PDD project containing an existing Python prompt and matching source module:

pdd sync pdd_issue_runner_job --dry-run --skip-tests --no-steer
pdd sync webhook_handlers --dry-run --skip-tests --no-steer

Observed on pdd-cli v0.0.284:

  • prompt discovery succeeds;
  • dry-run exits successfully;
  • output says no sync log exists;
  • no current-state analysis or planned action is shown;
  • a debug snapshot is written even though the dry-run yielded no actionable analysis.

Expected behavior

A dry run should analyze the current filesystem state even when no historical sync log exists. At minimum it should report one of:

  • prompt/source/tests/examples appear synchronized;
  • a sync operation would regenerate or modify specific artifacts;
  • analysis cannot be completed, with a concrete reason and non-success outcome.

Absence of a sync log is useful context, but it should not replace current-state analysis.

Why this matters

Prompt-driven development relies on checking that prompt contracts and generated source remain aligned before committing. Returning success with no analysis can be misread as a clean sync audit, while the command has actually validated nothing.

Proposed solution

  1. Make dry-run construct the same module paths and current-state/fingerprint comparison used by normal sync, but stop before any mutation or LLM call.
  2. When the sync log is missing, derive a baseline from current prompt/source/test/example files instead of returning early.
  3. Emit a structured dry-run verdict such as synced, would_sync, or unable_to_analyze, plus the relevant files and planned steps.
  4. Exit non-zero for unable_to_analyze so automation cannot interpret missing analysis as success.
  5. Avoid writing a core-dump/debug snapshot for an expected no-log state unless an actual error occurred or the user requested evidence.

Regression tests

  • Existing prompt + source, no sync log: dry-run produces a current-state verdict rather than only "No sync log found."
  • Drifted source, no sync log: dry-run reports would_sync and names the affected artifacts without modifying them.
  • Missing required source/artifact: dry-run reports unable_to_analyze and exits non-zero.
  • Dry-run leaves the worktree unchanged and does not create debug artifacts for a normal analysis result.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions