Saltar a contenido

SOURCE-003 Build Mart Idempotency Execution 001

Fecha local: 2026-06-18

Estado: BLOCKED / SIN ESCRITURAS NUEVAS / IDEMPOTENCIA VALIDADA EN LOCAL-DEV

Scope: tenant

tenant_id: alpuntodeventa

batch autorizado: 1827f887-9499-4579-b4f3-234d54f41f7f

1. Autorizacion explicita recibida

Se recibio autorizacion explicita del usuario para ejecutar una sola vez:

text python scripts/source_003_importer.py build-mart --execute --confirm-local-dev-write SOURCE003_MART_LOCAL_DEV_1886 --commit-local-dev-write SOURCE003_MART_LOCAL_DEV_COMMIT_1886

Restricciones preservadas durante esta ejecucion:

  • sin reintentar el comando
  • sin rollback manual
  • sin DELETE, TRUNCATE, UPDATE
  • sin modificar RAW, CORE ni MART manualmente
  • sin produccion, sync diaria, runner ni scheduler
  • sin tocar La Directa, runtime O4, VPS, Docker, NPM, Portainer
  • sin push ni deploy

2. Safe point

Control Valor
workspace C:\APV\openclawai
rama main
git status -sb ## main...origin/main
git rev-parse HEAD 3f491d80f9d633aaf8ed835c54e1a4fcf2d06dab
ultimo commit docs: preflight source 003 mart idempotency
decision SAFE POINT PASS

3. Preflight obligatorio

3.1 Repo

Comando Resultado
python -m py_compile scripts/source_003_importer.py PASS
python scripts/source_003_importer.py build-mart FAIL esperado post-write; detecta MART = 1/25/173/180

3.2 DB read-only confirmada antes del intento real

Fingerprint aprobado:

text ::1/128:5432|openclaw_business_observer_dev|postgres|PostgreSQL 15.15, compiled by Visual C++ build 1944, 64-bit

Controles:

  • postgres-sandbox: ausente
  • database observada: openclaw_business_observer_dev
  • RAW = 1886
  • CORE = 1886
  • MART daily/seller/customer/sku = 1/25/173/180
  • duplicados por grain daily/seller/customer/sku = 0/0/0/0
  • filas fuera del batch autorizado daily/seller/customer/sku = 0/0/0/0
  • filas existentes del batch autorizado en MART = 1/25/173/180
  • estimates desde CORE = 1/25/173/180
  • missing keys seller/customer/sku = 0/0/0
  • source_query_versions = 1

4. Comando ejecutado una sola vez

Comando real ejecutado exactamente una vez:

text python scripts/source_003_importer.py build-mart --execute --confirm-local-dev-write SOURCE003_MART_LOCAL_DEV_1886 --commit-local-dev-write SOURCE003_MART_LOCAL_DEV_COMMIT_1886

Resultado estructurado observado:

  • result = BLOCKED
  • execution_mode = commit-local-dev
  • confirmation_gate.status = PASS
  • db_touched = true
  • db_write = false
  • sql_executed = true
  • sql_write = false
  • db_write_attempted = false
  • data_persisted = false
  • transaction_committed = false
  • rollback_rehearsal = false

Motivo exacto reportado por la ejecucion real:

text MART daily row_count 1 != 0 MART seller row_count 25 != 0 MART customer row_count 173 != 0 MART sku row_count 180 != 0

Interpretacion operativa:

  • el doble gate fue aceptado
  • el bloqueo ocurrio en el preflight read-only de build_mart_execute()
  • no se entro al write path transaccional
  • por eso el mensaje runtime fue el bloqueo previo por row_count != 0
  • el motivo transaccional esperado sigue siendo consistente con el estado real: MART inicial no esta vacia: daily=1 seller=25 customer=173 sku=180 y, si ese control se relajara, tambien batch duplicado bloqueado en MART: daily=1 seller=25 customer=173 sku=180

5. Rowcounts before/after

Control Before After Resultado
RAW total 1886 1886 PASS
RAW batch 1886 1886 PASS
CORE total 1886 1886 PASS
CORE batch 1886 1886 PASS
MART daily total 1 1 PASS
MART seller total 25 25 PASS
MART customer total 173 173 PASS
MART sku total 180 180 PASS
MART daily batch 1 1 PASS
MART seller batch 25 25 PASS
MART customer batch 173 173 PASS
MART sku batch 180 180 PASS
MART daily outside 0 0 PASS
MART seller outside 0 0 PASS
MART customer outside 0 0 PASS
MART sku outside 0 0 PASS
duplicados daily 0 0 PASS
duplicados seller 0 0 PASS
duplicados customer 0 0 PASS
duplicados sku 0 0 PASS

6. Confirmacion sin cambios persistentes

Conclusiones verificadas despues del unico intento real:

  • el comando termino BLOCKED
  • no hubo transaction_committed
  • data_persisted = false
  • RAW sigue 1886
  • CORE sigue 1886
  • MART sigue 1/25/173/180
  • duplicados por grain siguen 0/0/0/0
  • filas fuera del batch autorizado siguen 0/0/0/0
  • no hubo nuevas escrituras

7. Alcance bloqueado preservado

Siguen bloqueados y no fueron tocados:

  • produccion
  • sync diaria
  • runner
  • scheduler
  • La Directa
  • runtime O4
  • VPS
  • Docker
  • NPM
  • Portainer
  • push
  • deploy portal

8. Conclusion

text SOURCE-003 MART IDEMPOTENCY EXECUTION PASS SAFE POINT = 3f491d80f9d633aaf8ed835c54e1a4fcf2d06dab AUTHORIZED COMMAND EXECUTED EXACTLY ONCE RESULT = BLOCKED RUNTIME BLOCK MESSAGE = MART daily row_count 1 != 0 / seller 25 != 0 / customer 173 != 0 / sku 180 != 0 EXPECTED TRANSACTIONAL BLOCK MESSAGE REMAINS = MART inicial no esta vacia: daily=1 seller=25 customer=173 sku=180 RAW = 1886 CORE = 1886 MART = 1 / 25 / 173 / 180 NO DUPLICATES BY GRAIN NO ROWS OUTSIDE AUTHORIZED BATCH NO TRANSACTION COMMITTED NO DATA PERSISTED PRODUCTION AND DAILY SYNC REMAIN BLOCKED