Saltar a contenido

SOURCE-003 Raw DDL Local Dev Forward 001

Fecha local: 2026-06-15 09:17:04 -03:00

Estado: DDL RAW FORWARD LOCAL-DEV PASS / TABLA RAW 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-RAW-DDL-LOCAL-DEV-FORWARD-001.md

1. Objetivo

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

text business_observer.raw_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, runner/importer load-raw, 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 b8f46304569277d65ac8e6d7b8cfb2fb60c99965
ultimo commit observado b8f4630 docs: record source 003 raw 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/004_source_003_raw_ddl_candidate_preflight.sql docs/tenants/alpuntodeventa/business-observer/design/sql/004_source_003_raw_ddl_candidate_forward.sql docs/tenants/alpuntodeventa/business-observer/design/sql/004_source_003_raw_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\004_source_003_raw_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\004_source_003_raw_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\004_source_003_raw_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 variables locales no versionadas; secretos no impresos
postgres-sandbox NO USADO
rollback ejecutado NO
DML ejecutado NO
carga de datos 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_candidate_table_absent_before_forward true true PASS
pilot_table_is_not_raw_final business_observer.source_003_sales_items tabla piloto, no RAW final PASS
public_schema_privileges_absent 0 0 PASS
preflight_catalog_read_only_no_data_load SELECT-only catalog checks; no INSERT/UPDATE/DELETE/COPY/DDL sin carga ni cambios de objetos 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.raw_source_003_sales_items
  • ALTER TABLE ... OWNER TO openclaw_bo_admin
  • CREATE INDEX para 9 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
raw_candidate_table_created true true PASS
raw_candidate_table_owner openclaw_bo_admin openclaw_bo_admin PASS
raw_candidate_column_count 84 84 PASS
raw_candidate_row_count_zero 0 0 PASS
raw_candidate_required_constraints 21 21 PASS
raw_candidate_required_indexes 9 9 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
pilot_table_is_not_raw_final business_observer.source_003_sales_items tabla piloto, no RAW final PASS

Resultado general:

text POST-CHECKS PASS

7. Tabla creada

Control Resultado
tabla business_observer.raw_source_003_sales_items
database openclaw_business_observer_dev
schema business_observer
owner openclaw_bo_admin
columnas 84
constraints requeridas 21
indices secundarios requeridos 9
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. Tabla piloto no tocada

La tabla piloto:

text business_observer.source_003_sales_items

fue observada por los checks solo para confirmar que sigue clasificada como PILOTO, no RAW final. El SQL ejecutado no contiene operaciones de escritura contra esa tabla.

10. Bloqueos preservados

Siguen bloqueados:

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

11. 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.
  • Git emitio warnings de conversion futura LF -> CRLF en archivos Markdown/YAML modificados, sin bloquear la validacion.

12. Decision

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

La tabla RAW candidata de SOURCE-003 queda creada vacia en local-dev con owner, grants, constraints e indices esperados. Esto no habilita carga de datos, load-raw, sync diaria, carga masiva ni produccion final.