Skip to content

Bug: pdd sync generated-test phase can pollute or break existing test files #860

@Serhan-Asad

Description

@Serhan-Asad

Ported from https://github.com/gltanaka/pdd/issues/1424

Problem

During global sync canaries, the generated-test phase appended large/noisy test suites directly into existing test files.

Observed cases:

  • track_cost: generated tests produced a bad generated state with 8 failed, 58 passed, 25 errors and had to be manually removed.
  • get_test_command: generated tests passed, but appended duplicate imports and local sys.path setup into tests/test_get_test_command.py.

Why this is genuine

This is not just stale prompt/code drift. Even after modules are synced, sync should not pollute existing tests or make test files noisier than necessary. The generated-test step needs stronger placement, isolation, and cleanup rules.

Expected behavior

  • Generated tests should be isolated, focused, and idempotent.
  • Existing checked-in tests should not receive duplicate imports, ad hoc sys.path setup, or broad generated dumps.
  • If generated tests fail badly, sync should cleanly discard or quarantine them instead of leaving broken test files.

Evidence

Recorded in global_sync_investigation_notes.md under Track Cost Canary and Get Test Command Canary.

Acceptance criteria

  • Add regression coverage for generated-test append behavior.
  • Prevent duplicate imports/path setup when appending to existing tests.
  • Quarantine or roll back generated tests when generated-test/fix produces large failure states.
  • Ensure successful sync leaves a clean, reviewable test diff.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions