Saltar a contenido

SOURCE-003 Load Raw Local Dev Execution 001

Fecha: 2026-06-15

Estado: PASS

Alcance

Ejecucion real local-dev de SOURCE-003 load-raw --execute contra:

  • DB: openclaw_business_observer_dev
  • Tabla: business_observer.raw_source_003_sales_items
  • Batch: 1827f887-9499-4579-b4f3-234d54f41f7f
  • Filas esperadas: 1886
  • Columnas destino: 84

No se uso VPS, postgres-sandbox, produccion, sync diaria, runner externo, OpenClaw, NPM, Portainer ni Docker. No se genero CSV nuevo, no se modifico la query autoridad y no se toco CORE/MART.

Safe Point

  • git status -sb: ## main...origin/main
  • git rev-parse HEAD: d2f9267173a15f70465d598bd58c40e145f0101d
  • Ultimo commit base: docs: review source 003 load raw write path
  • Query autoridad confirmada sin modificar: docs/tenants/alpuntodeventa/business-observer/source-authority/SOURCE-003-VENTAS-VNEXT-TABLA2-AUTHORITY-V2.sql

Validaciones previas

Comandos ejecutados:

powershell python -m py_compile scripts/source_003_importer.py python scripts/source_003_importer.py validate-prepared python scripts/source_003_importer.py load-raw python scripts/source_003_importer.py load-raw --execute

Resultados:

  • validate-prepared: PASS
  • load-raw: DRY_RUN
  • load-raw --execute sin confirmaciones: BLOCKED
  • RAW row_count inicial: 0
  • candidate_rows: 1886
  • target_columns: 84
  • batch: 1827f887-9499-4579-b4f3-234d54f41f7f
  • fingerprint DB: ::1/128:5432|openclaw_business_observer_dev|postgres|PostgreSQL 15.15, compiled by Visual C++ build 1944, 64-bit
  • postgres-sandbox: no usado

Confirmaciones exactas requeridas por el gate:

powershell --confirm-local-dev --confirm-write-local-dev --confirm-tenant-id alpuntodeventa --confirm-source-id SOURCE-003 --confirm-target-database openclaw_business_observer_dev --confirm-target-table business_observer.raw_source_003_sales_items --confirm-batch 1827f887-9499-4579-b4f3-234d54f41f7f --confirm-raw-empty --confirm-row-count 1886 --confirm-destination-columns 84 --confirm-prepared-sha256 3f16a957a79fc84d4ca37930988287cb81f05166210d057fcf8b45007f184afe --confirm-generated-sha256 6fb44d9870a567e728df9bbdcc6b83279d84791bd732626c9e19ccf3a28dc903 --confirm-db-fingerprint "::1/128:5432|openclaw_business_observer_dev|postgres|PostgreSQL 15.15, compiled by Visual C++ build 1944, 64-bit"

Ejecucion

Nota de auditoria: hubo un primer intento con confirmaciones completas que ejecuto COPY 1886 e INSERT 0 1886, pero fallo en post-check por una condicion demasiado restrictiva sobre source_system. PostgreSQL hizo rollback de la transaccion; data_written=false y un dry-run posterior confirmo RAW row_count = 0. Se corrigio el alcance del check a tenant_id + sync_batch_id y recien entonces se ejecuto la carga efectiva registrada abajo.

Comando ejecutado una vez con carga efectiva:

powershell python scripts/source_003_importer.py load-raw --execute --confirm-local-dev --confirm-write-local-dev --confirm-tenant-id alpuntodeventa --confirm-source-id SOURCE-003 --confirm-target-database openclaw_business_observer_dev --confirm-target-table business_observer.raw_source_003_sales_items --confirm-batch 1827f887-9499-4579-b4f3-234d54f41f7f --confirm-raw-empty --confirm-row-count 1886 --confirm-destination-columns 84 --confirm-prepared-sha256 3f16a957a79fc84d4ca37930988287cb81f05166210d057fcf8b45007f184afe --confirm-generated-sha256 6fb44d9870a567e728df9bbdcc6b83279d84791bd732626c9e19ccf3a28dc903 --confirm-db-fingerprint "::1/128:5432|openclaw_business_observer_dev|postgres|PostgreSQL 15.15, compiled by Visual C++ build 1944, 64-bit"

Resultado:

  • result: PASS
  • data_written: true
  • inserted_rows: 1886
  • db_write: true
  • sql_write: true
  • sync_enabled: false
  • production: false

Post-checks

Post-checks del comando:

  • RAW total rows: 1886
  • batch rows: 1886
  • duplicates: 0
  • empty_source_row_hash_rows: 0
  • empty_line_key_rows: 0
  • null_loaded_at_rows: 0
  • sync_enabled: false
  • production: false

Post-check SQL independiente:

json { "raw_total_rows": 1886, "batch_rows": 1886, "duplicates": 0, "empty_source_row_hash_rows": 0, "empty_line_key_rows": 0, "null_loaded_at_rows": 0, "target_database": "openclaw_business_observer_dev", "production": false, "sync_enabled": false }

Idempotencia

Se reejecuto load-raw --execute con las mismas confirmaciones. Resultado:

  • result: BLOCKED
  • motivo: batch duplicado bloqueado: 1827f887-9499-4579-b4f3-234d54f41f7f ya tiene 1886 filas
  • data_written: false
  • db_write: false
  • sql_write: false

El post-check independiente posterior confirmo que RAW siguio en 1886 filas.

Bloqueos preservados

  • Produccion: false
  • Sync diaria: false
  • CORE/MART: no tocados
  • Runner externo: no usado
  • CSV nuevo: no generado
  • Query autoridad: sin modificar
  • VPS/Docker/OpenClaw/NPM/Portainer: no usados
  • postgres-sandbox: no usado

Nota de implementacion

Durante la ejecucion se habilito en scripts/source_003_importer.py la ruta transaccional local-dev de load-raw --execute, conservando el bloqueo sin confirmaciones. La carga usa staging temporal, COPY local del prepared CSV validado, INSERT a RAW solo despues de pre-checks, loaded_at gobernado por PostgreSQL y rollback automatico ante cualquier falla.