Saltar a contenido

SOURCE-003 Core DDL Local Dev Forward 001

Fecha local: 2026-06-15 12:07:13 -03:00

Estado: DDL CORE FORWARD LOCAL-DEV PASS / TABLA CORE CREADA VACIA

portal_visible = yes

Scope: tenant

tenant_id: alpuntodeventa

Owner: Gabi / Carlos Canu

Fuente de verdad: docs/tenants/alpuntodeventa/business-observer/design/SOURCE-003-CORE-DDL-LOCAL-DEV-FORWARD-001.md

1. Objetivo

Ejecutar el DDL CORE candidato de SOURCE-003 contra PostgreSQL local-dev para crear vacia la tabla:

text business_observer.core_source_003_sales_items

Destino autorizado:

text database: openclaw_business_observer_dev schema: business_observer

Esta tarea no cargo datos, no ejecuto INSERT, COPY, UPDATE, DELETE, rollback, promote-core, runner/importer, Python, CSV, postgres-sandbox, VPS, Docker, OpenClaw, NPM, Portainer, push ni deploy.

2. Safe point

Control Resultado
workspace C:\APV\openclawai
rama main
git status --short --branch ## main...origin/main
git rev-parse HEAD f15c81655d15ea020d625545718dd747404c8353
git rev-parse origin/main f15c81655d15ea020d625545718dd747404c8353
ultimo commit observado f15c816 docs: record source 003 core ddl local dev preflight
decision SAFE POINT PASS

3. SQL autorizado ejecutado

Se ejecutaron solo estos archivos, en este orden:

text docs/tenants/alpuntodeventa/business-observer/design/sql/005_source_003_core_ddl_candidate_preflight.sql docs/tenants/alpuntodeventa/business-observer/design/sql/005_source_003_core_ddl_candidate_forward.sql docs/tenants/alpuntodeventa/business-observer/design/sql/005_source_003_core_ddl_candidate_post_checks.sql

Comandos operativos sin secretos:

powershell C:\Program Files\PostgreSQL\15\bin\psql.exe -X -v ON_ERROR_STOP=1 -P pager=off -h <APV_LOCAL_POSTGRES_ADMIN_HOST> -p <APV_LOCAL_POSTGRES_ADMIN_PORT> -U <APV_LOCAL_POSTGRES_ADMIN_USER> -d openclaw_business_observer_dev -f docs\tenants\alpuntodeventa\business-observer\design\sql\005_source_003_core_ddl_candidate_preflight.sql C:\Program Files\PostgreSQL\15\bin\psql.exe -X -v ON_ERROR_STOP=1 -P pager=off -h <APV_LOCAL_POSTGRES_ADMIN_HOST> -p <APV_LOCAL_POSTGRES_ADMIN_PORT> -U <APV_LOCAL_POSTGRES_ADMIN_USER> -d openclaw_business_observer_dev -f docs\tenants\alpuntodeventa\business-observer\design\sql\005_source_003_core_ddl_candidate_forward.sql C:\Program Files\PostgreSQL\15\bin\psql.exe -X -v ON_ERROR_STOP=1 -P pager=off -h <APV_LOCAL_POSTGRES_ADMIN_HOST> -p <APV_LOCAL_POSTGRES_ADMIN_PORT> -U <APV_LOCAL_POSTGRES_ADMIN_USER> -d openclaw_business_observer_dev -f docs\tenants\alpuntodeventa\business-observer\design\sql\005_source_003_core_ddl_candidate_post_checks.sql

Notas:

Control Resultado
binario psql C:\Program Files\PostgreSQL\15\bin\psql.exe
ON_ERROR_STOP SI
DB indicada en comandos openclaw_business_observer_dev
credenciales .env local no versionado; secretos no impresos
primer intento directo sin host/user TIMEOUT sin salida util, antes de forward
postgres-sandbox NO USADO
rollback ejecutado NO
DML ejecutado NO
carga de datos NO
Python / runner / promote-core NO

4. Resultado del preflight

Check Observado Esperado Resultado
current_database openclaw_business_observer_dev openclaw_business_observer_dev PASS
schema_business_observer_exists true true PASS
schema_business_observer_owner openclaw_bo_admin openclaw_bo_admin PASS
required_roles_exist 3 3 PASS
required_roles_nologin/openclaw_bo_admin false false PASS
required_roles_nologin/openclaw_bo_reader false false PASS
required_roles_nologin/openclaw_bo_writer false false PASS
raw_source_table_exists true true PASS
core_candidate_table_absent_before_forward true true PASS
raw_authorized_batch_row_count 1886 1886 PASS
raw_authorized_batch_critical_fields 0 0 PASS
raw_authorized_batch_duplicates 0 0 PASS
public_schema_privileges_absent 0 0 PASS
preflight_read_only_no_raw_modification SELECT-only checks; no INSERT/UPDATE/DELETE/COPY/DDL against RAW RAW not modified and CORE not created by preflight PASS

Resultado general:

text PREFLIGHT PASS

5. Resultado del forward

Resultado general:

text FORWARD OK

Operaciones observadas:

  • BEGIN
  • validacion de current_database()
  • CREATE SCHEMA IF NOT EXISTS business_observer AUTHORIZATION openclaw_bo_admin
  • ALTER SCHEMA business_observer OWNER TO openclaw_bo_admin
  • CREATE TABLE business_observer.core_source_003_sales_items
  • ALTER TABLE ... OWNER TO openclaw_bo_admin
  • CREATE INDEX para 10 indices secundarios
  • ALTER INDEX ... OWNER TO openclaw_bo_admin
  • COMMENT sobre tabla y columnas sensibles/relevantes
  • REVOKE / GRANT de schema y tabla
  • COMMIT

Aviso no bloqueante:

text NOTICE: schema "business_observer" already exists, skipping

No hubo rollback.

6. Resultado de post-checks

Check Observado Esperado Resultado
current_database openclaw_business_observer_dev openclaw_business_observer_dev PASS
schema_exists true true PASS
schema_owner openclaw_bo_admin openclaw_bo_admin PASS
core_candidate_table_created true true PASS
core_candidate_table_owner openclaw_bo_admin openclaw_bo_admin PASS
core_candidate_column_count 66 66 PASS
core_candidate_row_count_zero 0 0 PASS
core_candidate_required_constraints 22 22 PASS
core_candidate_required_indexes 10 10 PASS
writer_table_privileges_no_delete SELECT=true, INSERT=true, UPDATE=true, DELETE=false writer sin DELETE PASS
reader_table_privileges_read_only SELECT=true, INSERT=false, UPDATE=false, DELETE=false reader read-only PASS
public_schema_privileges 0 0 PASS
public_table_privileges 0 0 PASS
raw_source_table_still_exists true true PASS

Resultado general:

text POST-CHECKS PASS

7. Tabla creada

Control Resultado
tabla business_observer.core_source_003_sales_items
database openclaw_business_observer_dev
schema business_observer
owner openclaw_bo_admin
columnas 66
constraints requeridas 22
indices secundarios requeridos 10
row_count 0
estado CREADA VACIA

8. Grants confirmados

Rol Privilegios confirmados
openclaw_bo_writer SELECT, INSERT, UPDATE; sin DELETE
openclaw_bo_reader SELECT; sin INSERT, UPDATE, DELETE
PUBLIC sobre schema sin USAGE, sin CREATE
PUBLIC sobre tabla sin privilegios

9. RAW intacta

La tabla RAW:

text business_observer.raw_source_003_sales_items

fue observada por el preflight con 1886 filas para el batch autorizado 1827f887-9499-4579-b4f3-234d54f41f7f y por los post-checks como existente.

El forward ejecutado no contiene operaciones contra RAW. La afirmacion de que RAW sigue intacta se basa en:

  • preflight: raw_authorized_batch_row_count = 1886
  • preflight: campos criticos malos 0
  • preflight: duplicados 0
  • post-checks: raw_source_table_still_exists = true
  • alcance del SQL ejecutado: sin INSERT, COPY, UPDATE, DELETE ni DDL contra business_observer.raw_source_003_sales_items

10. Tabla piloto no tocada

La tabla piloto:

text business_observer.source_003_sales_items

no fue referenciada por escritura ni por DDL en los tres SQL autorizados. No se ejecutaron sentencias adicionales de carga, runner, rollback ni promote-core.

11. Bloqueos preservados

Siguen bloqueados:

  • carga de datos a business_observer.core_source_003_sales_items
  • INSERT, COPY, UPDATE, DELETE
  • rollback salvo fallo explicito y documentado
  • modificaciones Python
  • promote-core
  • runner/importer
  • generacion de CSV
  • postgres-sandbox
  • VPS, Docker, OpenClaw, NPM, Portainer
  • push y deploy

12. Validaciones del repo

Validacion Resultado
git diff --check PASS
.venv-portal\Scripts\mkdocs.exe build --strict PASS

Notas:

  • git diff --check no reporto errores de whitespace.
  • mkdocs build --strict genero el sitio correctamente en C:\APV\openclawai\site.

13. Decision

text DDL CORE FORWARD LOCAL-DEV PASS / TABLA CORE CREADA VACIA

La tabla CORE candidata de SOURCE-003 queda creada vacia en local-dev con owner, grants, constraints e indices esperados. Esto no carga datos, no promueve RAW hacia CORE, no habilita promote-core, no habilita sync diaria, no habilita carga masiva y no habilita produccion final.