Skip to content

[P0] Stabilize analysis recovery, inflight dedup and post-sync drain regressions #35

Description

@fxbin

Context

Bounded full PostgreSQL suite run from diagnostic PR #34 (after composing the verified #22 and #27 isolation fixes) progressed past the previous hang boundaries and exposed a coherent Analysis/Recovery failure cluster before 9% of the suite.

Observed failing tests:

  1. tests/test_analysis_notification_permissions.py::test_analysis_and_notifications_require_login
  2. tests/test_analysis_recovery.py::test_analyze_pending_deduplicates_inflight_background_jobs
  3. tests/test_analysis_recovery.py::test_analysis_job_inflight_ttl_releases_stuck_ids
  4. tests/test_analysis_recovery.py::test_post_sync_drain_processes_backlog_and_stale_analyzing
  5. tests/test_analysis_recovery.py::test_post_sync_drain_uses_configured_default_batch_size
  6. tests/test_analysis_recovery.py::test_post_sync_drain_releases_claims_after_batch_timeout

This issue is the WorkOrder for diagnosis and root-cause decomposition, not permission to patch all six tests together.

Objective

Determine whether these failures share one production contract regression or represent multiple independent defects, then split implementation into the smallest independently verifiable Worker slices.

Required diagnostic pass

Run the six tests against PostgreSQL with:

  • pytest -vv
  • full traceback (--tb=long)
  • bounded execution time
  • no public network calls
  • no test skipping or xfail conversion

For each failure capture:

  • expected vs actual behavior;
  • exact assertion/exception and stack;
  • production call path involved;
  • whether the test is stale or production behavior is incorrect;
  • shared-state/background-task/transaction involvement;
  • smallest repair boundary.

Decision rules

  • Do not make tests pass by weakening assertions unless the current product contract explicitly changed and is independently verified.
  • Do not combine unrelated failures just because they live in test_analysis_recovery.py.
  • If a production lifecycle/concurrency defect is reproduced, create a dedicated child Issue before modifying behavior.
  • If a test contract is stale, document the authoritative current contract before changing the test.

Acceptance criteria

  • All six failures have exact tracebacks from a targeted PostgreSQL CI run.
  • Failures are grouped by demonstrated root cause, not filename proximity.
  • Each root-cause group has a bounded Worker Issue with acceptance criteria and verification plan.
  • Any process-only diagnostic workflow/branch/PR is closed without merge.
  • Durable fixes contain no planning/diagnostic artifacts.

Parent stabilization: #2
Related backend-suite recovery: #14
Related lifecycle hardening: #6 / #28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions