Saltar a contenido

PDF-004G DDL Business Observer Staging Execution

Fecha local: 2026-06-19

Estado: DDL STAGING REAL EJECUTADO / VALIDACION POST-DDL PASS / NO SECRETS / SANDBOX INTACTO / PRODUCCION NO-GO

portal_visible = yes

Scope: tenant

tenant_id: alpuntodeventa

Owner: Gabi / Carlos Canu

Fuente de verdad: docs/tenants/alpuntodeventa/business-observer/production/PDF-004G-DDL-BUSINESS-OBSERVER-STAGING-EXECUTION.md

1. Autorizacion explicita

El usuario autorizo PDF-004G: ejecutar el DDL real de Business Observer sobre el PostgreSQL staging real del VPS, usando exclusivamente los SQL candidates publicados en PDF-004F, creando la DB staging, roles logicos, schema business_observer y permisos minimos definidos, sin tocar produccion, sin tocar openclaw-postgres-sandbox, sin ejecutar SOURCE-003, sin sync/scheduler, sin tocar La Directa ni SGC productivo, sin exponer secretos, con validacion post-DDL, rollback candidate documentado y evidencia completa.

2. Safe point

Control Valor
workspace C:\APV\openclawai
rama main
HEAD/origin observado al iniciar 170d6520dfff967155d7c1879d03e7246ff9bb02
ultimo commit observado al iniciar docs: prepare business observer staging ddl candidate preflight
git status -sb ## main...origin/main
git diff --check inicial PASS
MkDocs strict inicial PASS con .\\.venv-portal\\Scripts\\mkdocs.exe build --strict

Nota operativa local: la ruta literal ..\\.venv-portal\\Scripts\\mkdocs.exe no existe desde C:\APV\openclawai; la venv real disponible en el repo es .\\.venv-portal.

3. Objetivo

Ejecutar el DDL base autorizado para Business Observer sobre el PostgreSQL staging real del VPS, limitado a:

  • crear DB openclaw_business_observer_staging;
  • crear roles logicos staging NOLOGIN;
  • crear schema business_observer;
  • aplicar permisos minimos y default privileges definidos;
  • ejecutar validacion read-only posterior.

No se crearon tablas de ventas, clientes, productos, RAW, CORE ni MART.

4. Target fingerprint no sensible

text srv977009|openclaw-business-observer-postgres-staging|openclaw-bo-staging-internal|openclaw_bo_postgres_staging_data|no-host-port-binding|postgres|postgres|PostgreSQL 16.14

Control Resultado
hostname srv977009
container openclaw-business-observer-postgres-staging running healthy
image postgres:16.14-alpine
network openclaw-bo-staging-internal
volume openclaw_bo_postgres_staging_data
HostConfig.PortBindings {}
sandbox guardrail openclaw-postgres-sandbox running healthy

5. Evidencia previa aceptada

Backup baseline:

text /opt/backups/openclaw/business-observer-staging/postgres/baseline/20260619T170037Z/ openclaw-bo-staging-postgres-baseline-20260619T170037Z.dump sha256=402dce45fe93936b12f17a54ee437d637b3c573d02a3ff5c506d83e48a3860c4

Restore drill previo:

text PDF-004E publicado pg_restore_exit_code=0 cleanup=complete temp_remnants=none staging_principal=running healthy sandbox=running healthy

Recursos temporales del restore drill confirmados ausentes antes del DDL: container, volume, network y work dir temporal.

6. Preflight pre-DDL

SQL candidates autorizados confirmados presentes:

Archivo Estado
infra/business-observer/staging/postgres/ddl/PDF-004F/001-create-database-and-roles.candidate.sql CANDIDATE / NOT EXECUTED antes de esta tarea
infra/business-observer/staging/postgres/ddl/PDF-004F/002-create-schema-and-permissions.candidate.sql CANDIDATE / NOT EXECUTED antes de esta tarea
infra/business-observer/staging/postgres/ddl/PDF-004F/003-validation-readonly-after-ddl.candidate.sql CANDIDATE / NOT EXECUTED antes de esta tarea
infra/business-observer/staging/postgres/ddl/PDF-004F/rollback-drop-staging-business-observer.candidate.sql existe, documentado, no ejecutado

Revision estatica:

  • sin passwords reales;
  • sin connection strings reales;
  • sin usuarios LOGIN sensibles reales;
  • sin placeholders sin resolver (TODO, REPLACE_ME, <PASSWORD>, <USER>, <SECRET>, PLACEHOLDER);
  • rollback candidate existe y no fue ejecutado.

Catalogo pre-DDL en transaccion read-only:

text transaction_read_only=on business_db_exists=false prod_db_exists=false business_role_matches=0

Interpretacion:

  • openclaw_business_observer_staging = ABSENT;
  • openclaw_business_observer_prod = ABSENT;
  • roles staging negocio = ABSENT;
  • schema business_observer = ABSENT por ausencia de DB staging antes del DDL.

7. SQL candidates ejecutados

Ejecucion estricta con ON_ERROR_STOP=1, usando docker exec -i -u postgres dentro del contenedor staging y sin passwords inline.

Orden Script DB destino Resultado
1 001-create-database-and-roles.candidate.sql postgres PASS
2 002-create-schema-and-permissions.candidate.sql openclaw_business_observer_staging PASS
3 003-validation-readonly-after-ddl.candidate.sql openclaw_business_observer_staging PASS

Resultado del validation candidate:

text transaction_read_only=on current_database=openclaw_business_observer_staging current_user=postgres schema_business_observer_exists=true schema_business_observer_owner=openclaw_bo_staging_owner staging_role_count=4 staging_login_role_count=0 public_business_schema_acl_rows=0 business_schema_table_count=0

8. Validacion post-DDL

Control Resultado
staging health openclaw-business-observer-postgres-staging running healthy
staging host port binding {}
sandbox health openclaw-postgres-sandbox running healthy
DB staging business_db_exists=true
DB owner openclaw_bo_staging_owner
DB prod prod_db_exists=false
schema schema_exists=true
schema owner openclaw_bo_staging_owner
roles staging staging_role_count=4
roles LOGIN staging staging_login_role_count=0
tablas en business_observer business_schema_table_count=0
PUBLIC schema ACL public_schema_acl_rows=0

Roles creados:

text openclaw_bo_staging_owner=NOLOGIN,super=false,createdb=false,createrole=false,inherit=false openclaw_bo_staging_reader=NOLOGIN,super=false,createdb=false,createrole=false,inherit=false openclaw_bo_staging_reporting_ro=NOLOGIN,super=false,createdb=false,createrole=false,inherit=false openclaw_bo_staging_writer=NOLOGIN,super=false,createdb=false,createrole=false,inherit=false

Permisos visibles sobre la DB:

text db_public_acl_rows=0 openclaw_bo_staging_owner:CONNECT openclaw_bo_staging_owner:CREATE openclaw_bo_staging_owner:TEMPORARY openclaw_bo_staging_reader:CONNECT openclaw_bo_staging_reporting_ro:CONNECT openclaw_bo_staging_writer:CONNECT

Permisos visibles sobre schema:

text schema_usage_writer=true schema_usage_reader=true schema_usage_reporting_ro=true schema_create_writer=false schema_create_reader=false schema_create_reporting_ro=false

Default privileges validados:

text default_acl=r:openclaw_bo_staging_reader:SELECT default_acl=r:openclaw_bo_staging_reporting_ro:SELECT default_acl=r:openclaw_bo_staging_writer:INSERT default_acl=r:openclaw_bo_staging_writer:SELECT default_acl=r:openclaw_bo_staging_writer:UPDATE

9. Confirmaciones de alcance

  • No existe openclaw_business_observer_prod.
  • No se crearon tablas de negocio inesperadas.
  • No se ejecuto SOURCE-003.
  • No se ejecuto sync ni scheduler.
  • No se tocaron La Directa ni SGC productivo.
  • No se reinicio PostgreSQL staging.
  • No se recreo stack staging.
  • No se ejecuto docker compose up.
  • No se leyo ni imprimio ningun secret file.
  • No se imprimieron passwords.
  • No se guardaron connection strings reales en Git.
  • No se agregaron dumps, backups, .env runtime ni archivos con secretos a Git.
  • No hubo push ni deploy portal.

10. Rollback candidate

Rollback candidate publicado:

text infra/business-observer/staging/postgres/ddl/PDF-004F/rollback-drop-staging-business-observer.candidate.sql

No fue ejecutado.

Si se autorizara en una tarea separada, se ejecutaria contra la DB bootstrap postgres del mismo contenedor staging con ON_ERROR_STOP=1, despues de confirmar:

  • autorizacion humana explicita separada;
  • backup inmediatamente anterior al rollback;
  • DB staging sin tablas ni datos de negocio;
  • roles sin miembros LOGIN;
  • ningun sync, scheduler, BI o consumidor conectado;
  • target staging confirmado y produccion/sandbox excluidos.

No corresponde rollback automatico porque el DDL fue exitoso.

11. GO / NO-GO

text GO = preparar carga controlada inicial de SOURCE-003 en staging, solo candidate/preflight NO-GO = produccion NO-GO = sync diaria NO-GO = ejecucion de pipelines sin autorizacion separada NO-GO = rollback sin autorizacion separada

12. Riesgos pendientes

  • Falta backup posterior al DDL antes de cualquier carga real.
  • Falta credential binding de roles LOGIN fuera de Git, si se aprueba.
  • Falta candidate/preflight para cualquier carga SOURCE-003 en staging.
  • Falta observabilidad especifica posterior a datos reales.
  • Produccion y sync diaria siguen bloqueadas.

13. Proximos safe points

  1. Backup post-DDL de openclaw_business_observer_staging.
  2. Candidate/preflight para carga inicial controlada de SOURCE-003 en staging.
  3. Autorizacion separada para cualquier carga real en staging.
  4. Restore drill actualizado despues de que existan objetos/datos.
  5. Produccion y sync diaria solo con gates posteriores separados.

14. Conclusion

text PDF-004G PASS DDL REAL STAGING EXECUTED DB openclaw_business_observer_staging = PRESENT SCHEMA business_observer = PRESENT ROLES STAGING = PRESENT / NOLOGIN TABLES CREATED = 0 STAGING = RUNNING HEALTHY / PORTS {} SANDBOX = RUNNING HEALTHY / INTACT PROD DB = ABSENT NO SECRETS EXPOSED ROLLBACK CANDIDATE = DOCUMENTED / NOT EXECUTED GO = SOURCE-003 STAGING CANDIDATE/PREFLIGHT ONLY NO-GO = PRODUCTION / DAILY SYNC / PIPELINES WITHOUT SEPARATE AUTHORIZATION