Aller au contenu

Sync-one helper boundary

plugins/ccx-feeds-industrial/includes/pipeline/95-sync-one-helpers.php currently owns several distinct phases of one-feed synchronization.

The refactor is intentionally staged. The first step locks the historical surface before moving code.

Locked responsibilities

  1. Runtime context and run-id helpers.
  2. Stage reset, download and CSV parsing into stage buffers.
  3. Final offer upsert and canonical offer_key completion.
  4. offers_norm_v2 upsert and related metrics/review synchronization.
  5. Stage-meta cleanup, final meta upsert, run pruning, integrity metrics and temporary-file cleanup.

Historical ordering

The contract preserves the effective phase sequence:

bootstrap -> reset stage -> download -> parse/flush -> offers upsert -> offers_norm -> meta/prune -> finalize.

Planned module boundary

The next mechanical extraction should target pipeline/sync-one/ with modules grouped by the responsibilities above, while keeping 95-sync-one-helpers.php as the compatibility facade.

No business rule, SQL condition, run-id source, pruning rule, diagnostic key or temporary-file policy should change during that extraction.