Aller au contenu

Write inventory — current state

Status: CURRENT Last consolidated by: BC-068D This document is the operational source of truth for currently certified business/runtime write surfaces.

Date: 2026-07-14

Runtime write boundary

BC-063B introduces an explicit runtime write boundary for the runtime surfaces already identified in BC-063A.

Current write services:

  • CCX_RuntimeWriteService
  • wraps runtime SQL writes for runs, batches, raw rows and quarantine
  • owns action-facade entry points for:
    • runtime feed enable/disable
    • stage raw cleanup
    • runtime spool cleanup
  • CCX_FeedSnapshotWriteService
  • wraps snapshot download persistence
  • wraps snapshot prune
  • CCX_OfferProjectionWriteService
  • wraps offer projection persistence
  • wraps offers normalization projection sync
  • CCX_ProductModelProjectionWriteService
  • wraps destructive product-model projection replace by vertical_id
  • delegates SQL delete/insert to CCX_LegacyProductModelProjectionWriter
  • does not add a transaction layer
  • CCX_ProductVariantProjectionWriteService
  • wraps destructive variant projection replace by vertical_id
  • delegates SQL delete/insert to CCX_LegacyProductVariantProjectionWriter
  • CCX_ProductSpecificationProjectionWriteService
  • wraps destructive specification projection replace by vertical_id
  • delegates SQL delete/insert to CCX_LegacyProductSpecificationProjectionWriter
  • CCX_ProductGalleryProjectionWriteService
  • wraps destructive gallery projection replace by vertical_id
  • delegates SQL delete/insert to CCX_LegacyProductGalleryProjectionWriter

Active runtime write consumers

Adapters and facades now delegate to services instead of instantiating runtime SQL writers directly:

  • includes/application/admin-sync-runtime-actions.php
  • includes/application/sync-runtime-actions.php
  • includes/pipeline/30-download.php

Runtime internals now route write calls through CCX_RuntimeWriteService while keeping repository reads in CCX_RunRepository:

  • includes/application/sync-runner.php
  • includes/application/sync-runner/lifecycle-trait.php
  • includes/application/sync-runner/monitoring-trait.php
  • includes/application/sync-runner/internals-trait.php
  • includes/runtime/feed-reader.php

Offer replay now reuses the same runtime write boundary for runtime-only writes:

  • includes/application/offer-replay.php
  • runtime run creation
  • runtime raw-row staging for replay provenance
  • projection persistence through CCX_OfferProjectionWriteService
  • offers normalization through CCX_OfferProjectionWriteService

Product Models rebuild now reuses a dedicated projection write boundary for ccx_product_models_v1:

  • includes/application/product-models.php
  • still resolves the vertical scope
  • still reads ccx_offers_norm_v2
  • still builds the same grouped rows / model keys / slugs
  • delegates destructive replace to CCX_ProductModelProjectionWriteService

Variants / Specs / Gallery rebuilds now follow the same pattern:

  • includes/application/product-models.php
  • ccx_product_model_variants_rebuild()
  • still reads Product Models + offer rows
  • still builds the same variant rows
  • delegates destructive replace to CCX_ProductVariantProjectionWriteService
  • includes/application/product-model-enrichment.php
  • ccx_product_specs_rebuild()
  • still reads the same enrichment groups
  • still builds the same specification rows
  • delegates destructive replace to CCX_ProductSpecificationProjectionWriteService
  • ccx_product_gallery_rebuild()
  • still reads the same enrichment groups
  • still builds the same gallery rows
  • delegates destructive replace to CCX_ProductGalleryProjectionWriteService

BC-063C5 adds a dedicated orchestration boundary for the only currently proven multi-rebuild entrypoint of this family:

  • CCX_ProductModelRebuildOrchestrator
  • centralizes the certified order:
    1. Product Models
    2. Variants
    3. Specs
    4. Gallery
  • centralizes the canonical CLI command list for one vertical
  • is currently consumed by the ccx offer replay --rebuild-projections path

Audit result: the global ccx sync rebuild-chain flow does not orchestrate these four Product Models projection rebuilds today, so BC-063C5 does not broaden its scope to that separate chain.

Remaining direct legacy write consumers

The following areas still contain direct legacy repository or SQL write behavior and remain candidates for later BC-063 slices:

  • offer replay transactional apply still owns transaction orchestration
  • governance apply / rollback
  • taxonomy v2 apply / rollback
  • projection rebuild families after Product Models:
  • orchestration consolidation / shared certification
  • schema / install / migration paths

Destructive runtime operations

Destructive runtime operations remain legacy in implementation, but are now invoked through the runtime write boundary:

  • raw stage cleanup
  • expired claim recovery
  • stale run recovery
  • stale batch recovery
  • snapshot prune
  • runtime spool cleanup

The runtime write services do not change semantics. They isolate call sites and preserve the existing structured results returned by the legacy implementations.

Governance writes now follow the same boundary pattern for the certified admin entrypoints:

  • adapters delegate to includes/application/governance-actions.php;
  • the application facade delegates to includes/application/governance-write-service.php;
  • legacy governance SQL and transaction logic remain behind:
  • includes/governance/decisions.php
  • includes/governance/apply.php
  • includes/governance/rollback.php
  • includes/governance/promotion.php
  • includes/governance/manual-review/30-actions.php
  • includes/governance/product-resolution.php

Taxonomy V2 writes now follow an explicit CLI write boundary as well:

  • CLI adapter delegates to includes/application/taxonomy-v2-actions.php;
  • the action facade delegates to includes/application/taxonomy-write-service.php;
  • technical SQL concerns are isolated behind:
  • CCX_TaxonomySchemaAdapter
  • CCX_TaxonomySnapshotStore
  • CCX_TaxonomyLegacyWriter
  • command effects are still write-capable and not read-only:
  • audit: schema bootstrap;
  • dry-run: schema bootstrap + temp resolution table;
  • apply: snapshot writes + offer taxonomy updates;
  • cleanup: cleanup writes;
  • rollback: offer restore + rollback snapshot write.

Global BC-063D certification state:

  • Governance admin entrypoints are certified behind their action facade and write service;
  • Taxonomy CLI entrypoints are certified behind their action facade and write service;
  • destructive writes remain confined to documented legacy writers / schema adapters / snapshot stores;
  • no adapter-level SQL, schema or transaction orchestration remains in the certified Governance and Taxonomy entrypoints.

Rollback for BC-063C3 is mechanical:

  • restore direct DELETE / INSERT writes inside ccx_product_models_rebuild()
  • remove product-model-projection-write-service.php
  • remove Product Models write-boundary gates
  • resync runtime mirror
  • rerun validations

No SQL rollback or rebuild replay is required because this slice does not execute a real rebuild during validation.

Technical state / transient / lock boundary

Merchant activation is excluded from this write boundary. CCX_ACTIVE_FEEDS is deployment-owned; the legacy ccx_runtime_enabled_feeds option must remain absent.

BC-063E2 adds a dedicated technical boundary for non-business WordPress writes:

  • CCX_WordPressTechnicalStateStore
  • wraps certified option writes such as:
    • ccx_governance_snapshot_v1
    • ccx_catalog_nav_cache_v1_state
    • ccx_premium_whitelist_dryrun_last
    • ccx_offers_version
  • CCX_WordPressTransientStore
  • wraps certified transient writes for:
    • health endpoint rate-limit
    • feed-health heavy recalculation throttle
    • Product Models / variants / specs / gallery / similar-model caches
  • CCX_TechnicalLockService
  • wraps MySQL named locks reused by:
    • includes/infrastructure/db-lock.php
    • catalog nav cache
    • governance review queue
    • rebuild-chain fallback

Legacy public wrappers stay unchanged. Keys, TTLs, lock names and timeouts remain identical.

BC-063E3 extends the technical boundary with:

  • CCX_CronScheduleService + CCX_WordPressCronAdapter
  • confine wp_next_scheduled(), wp_schedule_event(), wp_schedule_single_event() and wp_clear_scheduled_hook()
  • CCX_RewriteMaintenanceService + CCX_WordPressRewriteAdapter
  • confine add_rewrite_rule() and flush_rewrite_rules()
  • reuse CCX_WordPressTechnicalStateStore for the Product Models route-contract fingerprint

BC-063E4 extends it again for schema concerns:

  • CCX_SchemaInstallService
  • explicit wrapper for schema installation entrypoints
  • CCX_MigrationRunner
  • explicit wrapper for legacy structure migrations
  • CCX_TemporarySchemaService
  • explicit wrapper for active temporary-schema creation paths
  • CCX_WordPressSchemaAdapter
  • confines schema probes and structural adapter concerns

The schema version option remains unchanged and is now written through the technical state boundary.

BC-063E5 closes the global certification of WordPress technical writes:

  • direct option/transient/lock/cron/rewrite/schema APIs are now confined to explicit infrastructure adapters;
  • passive contexts are certified with zero technical write on load;
  • legacy sync-log maintenance no longer issues opportunistic writes from passive init;
  • residual explicit DDL debt is limited to documented legacy strict/temp-table contexts.