Saltar a contenido

SOURCE-003 Load Raw Execute Implementation 001

Fecha local: 2026-06-15

Estado: IMPLEMENTADO COMO GATE / NO EJECUTADO CON ESCRITURA

portal_visible = yes

Scope: tenant

tenant_id: alpuntodeventa

Owner: Gabi / Carlos Canu

Fuente de verdad: docs/tenants/alpuntodeventa/business-observer/design/SOURCE-003-LOAD-RAW-EXECUTE-IMPLEMENTATION-001.md

1. Objetivo

Implementar en scripts/source_003_importer.py el camino controlado para una futura ejecucion local-dev:

powershell python scripts/source_003_importer.py load-raw --execute

Esta etapa no ejecuta carga real, no escribe en PostgreSQL, no invoca runner, no genera CSV nuevo y no habilita sync.

2. Safe point

Control Resultado
workspace C:\APV\openclawai
rama main
HEAD inicial a918adf1d49cea4c1ee44fa4366c518350e55109
ultimo commit inicial docs: define source 003 load raw execution gate
decision SAFE POINT PASS

3. Implementacion

load-raw sin --execute conserva el comportamiento DRY_RUN.

load-raw --execute queda implementado como gate local-dev con confirmaciones explicitas. Si falta una confirmacion, devuelve BLOCKED antes de tocar DB.

Confirmaciones requeridas:

  • --confirm-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".

4. Validaciones modeladas

El gate documenta y valida por igualdad exacta:

  • DB permitida: openclaw_business_observer_dev;
  • tabla RAW: business_observer.raw_source_003_sales_items;
  • row_count RAW inicial esperado: 0;
  • CSV prepared historico y generated existentes/validados;
  • 1886 filas candidatas;
  • 84 columnas destino;
  • batch esperado: 1827f887-9499-4579-b4f3-234d54f41f7f;
  • fingerprint DB obligatorio;
  • postgres-sandbox prohibido;
  • transaccion futura preparada;
  • post-check esperado: 1886 filas;
  • rollback por batch separado y documentado.

5. Seguridad

Resultado esperado de esta etapa:

json { "db_write": false, "data_written": false, "sync_enabled": false }

Acciones bloqueadas:

  • INSERT;
  • COPY;
  • UPDATE;
  • DELETE;
  • TRUNCATE;
  • COMMIT;
  • runner;
  • rollback;
  • VPS, Docker, OpenClaw, NPM, Portainer, push y deploy.

6. Validaciones requeridas

text python -m py_compile scripts/source_003_importer.py python scripts/source_003_importer.py --help python scripts/source_003_importer.py load-raw python scripts/source_003_importer.py load-raw --execute python scripts/source_003_importer.py dry-run git diff --check .venv-portal\Scripts\mkdocs.exe build --strict

7. Decision

text LOAD-RAW EXECUTE LOCAL-DEV SOURCE-003 IMPLEMENTADO COMO GATE SIN CARGA REAL SIN ESCRITURA DB SIN SYNC

La futura ejecucion con escritura requiere una tarea separada, confirmaciones completas, fingerprint DB aprobado en la misma sesion y autorizacion explicita para habilitar la transaccion real.