SOURCE-003 Load Raw Safe Mode Technical Review¶
Fecha local: 2026-06-15 09:38:00 -03:00
Estado: REVISION TECNICA LOAD-RAW SAFE MODE PASS / SIN CARGA
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-SAFE-MODE-TECHNICAL-REVIEW.md
1. Objetivo¶
Revisar tecnicamente el comando:
powershell
python scripts/source_003_importer.py load-raw
antes de cualquier ejecucion real de carga. Esta revision audita el safe mode implementado, sus bloqueos, sus salidas JSON y sus precondiciones.
No se cargo datos, no se desbloqueo --execute, no se escribio en DB, no se
modifico DDL, no se ejecuto runner, no se genero CSV y no se toco
VPS, Docker, OpenClaw, NPM ni Portainer.
2. Safe point¶
| Control | Resultado |
|---|---|
| workspace | C:\APV\openclawai |
| rama | main |
git status --short --branch inicial |
## main...origin/main |
git rev-parse HEAD inicial |
b8cf4b705cd94452197d8a0c8a4a291916ed7543 |
git rev-parse origin/main inicial |
b8cf4b705cd94452197d8a0c8a4a291916ed7543 |
| ultimo commit observado | b8cf4b7 tools: add source 003 load raw safe mode |
| decision | SAFE POINT PASS |
3. Archivos revisados¶
| Archivo | Lectura tecnica |
|---|---|
scripts/source_003_importer.py |
Implementa load-raw como DRY_RUN por defecto, bloquea --execute y limita DB a probes SELECT read-only. |
SOURCE-003-IMPORTER-LOAD-RAW-SAFE-MODE-001.md |
Evidencia el safe mode implementado, el bloqueo de escritura y los checks RAW esperados. |
SOURCE-003-IMPORTER-LOAD-RAW-PLAN.md |
Define los gates futuros y mantiene produccion, sync diaria y escritura bloqueadas. |
SOURCE-003-LOAD-RAW-TECHNICAL-REVIEW.md |
Revision documental previa: apto para disenar DDL RAW, no apto para implementar carga en ese momento. |
SOURCE-003-RAW-DDL-LOCAL-DEV-FORWARD-001.md |
Confirma tabla RAW local-dev creada vacia con 84 columnas y row_count = 0. |
4. Hallazgos¶
| Check | Resultado | Evidencia |
|---|---|---|
load-raw default |
PASS |
Devuelve result = DRY_RUN, dry_run_only = true, read_only = true. |
load-raw --execute |
PASS |
Devuelve result = BLOCKED, exit code bloqueante y no toca DB. |
| DML activo | PASS |
No se detecto INSERT, COPY, UPDATE, DELETE activo para load-raw; aparecen solo en blocked_actions. |
| escritura accidental | PASS |
load-raw no genera CSV, no llama runner, no ejecuta rollback y no usa APIs de escritura DB. |
| fingerprint DB obligatorio | PASS |
inspect_raw_db_read_only() bloquea si el fingerprint no esta en APPROVED_DB_FINGERPRINTS. |
| tabla RAW correcta | PASS |
Target: business_observer.raw_source_003_sales_items. |
row_count RAW |
PASS |
Observado 0, esperado 0. |
| batch esperado | PASS |
1827f887-9499-4579-b4f3-234d54f41f7f. |
| filas candidatas | PASS |
1886 historicas y 1886 generated. |
| columnas destino | PASS |
84 columnas RAW destino. |
| flags seguros | PASS |
db_write=false, data_written=false, sync_enabled=false. |
sql_executed=true |
PASS con nota |
Solo por SELECT read-only de fingerprint, catalogo, existencia de tabla, conteo y columnas. |
postgres-sandbox |
PASS |
No usado en codigo ni comandos ejecutados. |
| errores por precondicion | PASS |
Faltante de CSV, hash, batch, DB, fingerprint, tabla, row_count o columnas termina en FAIL; --execute termina en BLOCKED. |
5. Evidencia load-raw dry-run¶
Comando:
powershell
python scripts/source_003_importer.py load-raw
Resultado observado:
json
{
"command": "load-raw",
"result": "DRY_RUN",
"db_touched": true,
"db_write": false,
"sql_executed": true,
"sql_write": false,
"data_written": false,
"sync_enabled": false,
"dry_run_only": true,
"read_only": true,
"sync_batch_id": "1827f887-9499-4579-b4f3-234d54f41f7f",
"candidate_rows": 1886,
"expected_destination_columns": 84,
"target_database": "openclaw_business_observer_dev",
"target_table": "business_observer.raw_source_003_sales_items",
"problems": []
}
Detalle RAW observado:
| Control | Observado | Esperado | Resultado |
|---|---|---|---|
| fingerprint | ::1/128:5432|openclaw_business_observer_dev|postgres|PostgreSQL 15.15, compiled by Visual C++ build 1944, 64-bit |
fingerprint aprobado | PASS |
| database | openclaw_business_observer_dev |
openclaw_business_observer_dev |
PASS |
| tabla existe | true |
true |
PASS |
row_count |
0 |
0 |
PASS |
| columnas | 84 |
84 |
PASS |
6. Evidencia --execute bloqueado¶
Comando:
powershell
python scripts/source_003_importer.py load-raw --execute
Resultado observado:
json
{
"command": "load-raw",
"result": "BLOCKED",
"db_touched": false,
"db_write": false,
"sql_executed": false,
"sql_write": false,
"data_written": false,
"sync_enabled": false,
"problems": [
"--execute bloqueado en esta tarea: load-raw solo implementa plan/dry-run seguro y no puede escribir en DB."
]
}
7. Riesgos¶
- El
DRY_RUNtoca DB conSELECT; esto es correcto para el gate actual, pero debe seguir reportandose comodb_touched=trueysql_executed=true. --executeexiste como opcion visible de CLI, pero esta bloqueada. No debe interpretarse como permiso operativo.- La tabla RAW local-dev existe y esta vacia; eso habilita disenar un gate de ejecucion local-dev, no habilita carga real.
- Produccion y sync diaria siguen sin contrato de entorno, idempotencia, observabilidad, rollback y aprobacion humana.
8. Validaciones ejecutadas¶
| Validacion | Resultado |
|---|---|
python -m py_compile scripts/source_003_importer.py |
PASS |
python scripts/source_003_importer.py --help |
PASS |
python scripts/source_003_importer.py load-raw |
PASS, resultado DRY_RUN |
python scripts/source_003_importer.py load-raw --execute |
PASS, resultado esperado BLOCKED |
python scripts/source_003_importer.py dry-run |
PASS |
git diff --check |
PASS |
.venv-portal\Scripts\mkdocs.exe build --strict |
PASS |
9. Conclusion¶
text
APTO PARA DISENAR GATE DE EJECUCION LOAD-RAW LOCAL-DEV
NO APTO PARA PRODUCCION
NO APTO PARA SYNC DIARIA
El safe mode de load-raw queda tecnicamente apto como base para disenar un
gate de ejecucion local-dev en una tarea futura separada. No habilita carga de
datos, --execute, produccion, sync diaria, runner, rollback, DDL, push ni
deploy.