PDF-004F DDL Business Observer Staging Candidate Preflight¶
Fecha local: 2026-06-19
Estado:
CANDIDATE PREFLIGHT PREPARADO / NO DDL EJECUTADO / NO DML / NO SECRETS / GO PDF-004G SOLO CON AUTORIZACION EXPLICITA
portal_visible = yes
Scope: tenant
tenant_id: alpuntodeventa
Owner: Gabi / Carlos Canu
Fuente de verdad:
docs/tenants/alpuntodeventa/business-observer/production/PDF-004F-DDL-BUSINESS-OBSERVER-STAGING-CANDIDATE-PREFLIGHT.md
1. Objetivo¶
Preparar el paquete candidate y el preflight final para una futura ejecucion
controlada del DDL base de Business Observer sobre el PostgreSQL staging real
del VPS.
Esta tarea no ejecuta DDL, no crea DB, no crea roles, no crea schema, no crea
tablas, no ejecuta SOURCE-003, no toca produccion y no toca el sandbox.
2. Safe point¶
| Control | Valor |
|---|---|
| workspace | C:\APV\openclawai |
| rama | main |
HEAD/origin observado al iniciar |
d7cdadd552d2709c106b2a7831898dc43751ae89 |
| ultimo commit observado al iniciar | ops: execute business observer staging postgres restore drill |
| decision | SAFE POINT PASS / CANDIDATE ONLY |
3. Evidencia previa cerrada¶
| Documento | Estado |
|---|---|
PDF-004B |
stack PostgreSQL staging real provisionado, running healthy, sin host port binding |
PDF-004C |
target real validado read-only, DB/schema/roles de negocio ausentes |
PDF-004D |
backup baseline real creado fuera de Git |
PDF-004E |
restore drill real ejecutado en entorno temporal aislado y cleanup completo |
Backup baseline aceptado:
text
/opt/backups/openclaw/business-observer-staging/postgres/baseline/20260619T170037Z/
openclaw-bo-staging-postgres-baseline-20260619T170037Z.dump
sha256=402dce45fe93936b12f17a54ee437d637b3c573d02a3ff5c506d83e48a3860c4
Restore drill aceptado:
text
pg_restore_exit_code=0
cleanup=complete
temp_remnants=none
staging_principal=running healthy
sandbox=running healthy
4. Fingerprint no sensible del target¶
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
Validacion remota read-only de PDF-004F:
text
hostname=srv977009
staging_status=running
staging_health=healthy
HostConfig.PortBindings={}
sandbox_status=running
sandbox_health=healthy
backup_baseline=present
Catalogo validado con BEGIN TRANSACTION READ ONLY:
text
transaction_read_only=on
business_db_exists=false
business_schema_exists=false
business_role_matches=0
5. Estado actual DB/schema/roles¶
| Objeto | Estado |
|---|---|
DB openclaw_business_observer_staging |
ABSENT |
schema business_observer |
ABSENT |
role openclaw_bo_staging_owner |
ABSENT |
role openclaw_bo_staging_writer |
ABSENT |
role openclaw_bo_staging_reader |
ABSENT |
role openclaw_bo_staging_reporting_ro |
ABSENT |
6. Paquete SQL candidate generado¶
Directorio:
text
infra/business-observer/staging/postgres/ddl/PDF-004F/
Archivos:
| Archivo | Impacto futuro si se autoriza |
|---|---|
001-create-database-and-roles.candidate.sql |
crea roles de grupo NOLOGIN y DB staging |
002-create-schema-and-permissions.candidate.sql |
crea schema business_observer, revoca PUBLIC, aplica grants minimos y default privileges |
003-validation-readonly-after-ddl.candidate.sql |
valida estado posterior con transaccion read-only |
rollback-drop-staging-business-observer.candidate.sql |
rollback destructivo candidate para DB vacia y sin credential binding |
README.md |
checklist operativo del paquete |
Propiedades del candidate:
- sin passwords;
- sin connection strings;
- sin roles
LOGIN; - sin usuarios reales;
- sin tablas;
- sin
SOURCE-003; - sin tocar prod;
- sin tocar sandbox.
7. Orden de ejecucion futura¶
Orden propuesto para PDF-004G, si se autoriza explicitamente:
- Confirmar safe point Git limpio y HEAD esperado.
- Confirmar staging
running healthyyHostConfig.PortBindings = {}. - Confirmar backup baseline y restore drill aceptados.
- Ejecutar preflight read-only contra
postgres. - Ejecutar
001-create-database-and-roles.candidate.sqlconectado apostgres. - Conectar a
openclaw_business_observer_staging. - Ejecutar
002-create-schema-and-permissions.candidate.sql. - Ejecutar
003-validation-readonly-after-ddl.candidate.sqlen modo read-only. - Crear backup posterior al DDL y documentar evidencia.
- Mantener
SOURCE-003, sync diaria y produccion enNO-GO.
8. Validaciones previas obligatorias¶
git status -sblimpio.git rev-parse HEADdocumentado.git diff --checklimpio.- MkDocs strict
PASS. - Staging target es
openclaw-business-observer-postgres-staging, no sandbox. HostConfig.PortBindings = {}.- Backup baseline existe fuera de Git.
- Restore drill real sigue documentado como
PASS. - DB/schema/roles objetivo siguen ausentes antes de aplicar DDL.
- No hay secrets, dumps,
.envruntime ni connection strings reales en Git. - Autorizacion humana explicita para ejecutar DDL real.
9. Validaciones posteriores obligatorias¶
Tras una futura ejecucion autorizada:
transaction_read_only=onpara validaciones de catalogo.- DB
openclaw_business_observer_stagingexiste y no es prod. - schema
business_observerexiste y pertenece aopenclaw_bo_staging_owner. - roles staging existen y son
NOLOGIN. PUBLICno tiene privilegios sobre DB/schema objetivo.writerno tieneDELETEniTRUNCATEpor default.readeryreporting_rosolo tienen lectura.- no existen tablas hasta que un DDL de objetos sea autorizado.
- backup posterior al DDL creado y restaurable.
10. Rollback candidate¶
Rollback publicado:
text
infra/business-observer/staging/postgres/ddl/PDF-004F/rollback-drop-staging-business-observer.candidate.sql
Condiciones minimas antes de usarlo:
- autorizacion explicita separada;
- backup inmediatamente anterior al rollback;
- DB sin tablas ni datos de negocio;
- roles sin miembros
LOGIN; - ningun sync, scheduler, BI o consumidor conectado;
- confirmacion de que el target es staging y no prod ni sandbox.
El rollback no debe usarse si ya hubo cargas, tablas, credential binding o consumidores reales. En ese caso corresponde un plan nuevo.
11. Riesgos¶
- ejecutar el DDL sobre una DB incorrecta si se omite fingerprint;
- crear roles
LOGINo passwords fuera de un flujo gobernado; - mezclar staging y prod por nombres o membresias;
- dejar
PUBLICcon privilegios heredados; - aplicar rollback destructivo despues de que existan datos;
- avanzar a sync diaria sin backup posterior al DDL.
12. NO-GO explicito¶
En PDF-004F:
text
NO-GO = EJECUTAR DDL
NO-GO = EJECUTAR DML
NO-GO = CREAR DB/ROLES/SCHEMA/TABLAS
NO-GO = SOURCE-003
NO-GO = PRODUCCION
NO-GO = SYNC DIARIA / SCHEDULER
NO-GO = SANDBOX
13. Condiciones para autorizar PDF-004G¶
PDF-004G solo queda habilitable si:
- el usuario autoriza explicitamente ejecucion DDL real;
- el paquete candidate PDF-004F fue revisado;
- el preflight read-only real vuelve a pasar;
- backup baseline y restore drill siguen disponibles como evidencia;
- se acepta el rollback candidate o se publica uno revisado;
- se define que credential binding de roles
LOGINqueda fuera de Git; - se mantiene produccion y sync diaria en
NO-GO.
14. Validacion local de cierre¶
| Control | Resultado |
|---|---|
git diff --check |
PASS |
.\\.venv-portal\\Scripts\\mkdocs.exe build --strict |
PASS |
| busqueda simple de secretos en diff | PASS sin coincidencias sensibles reales |
| busqueda de dumps/backups/env versionados | PASS sin archivos agregados |
| SQL candidate | PASS revision estatica; no se ejecuto contra ninguna DB |
Nota sobre sintaxis SQL:
text
No se encontro parser PostgreSQL offline disponible en la workstation
(`pg_query=false`, `sqlparse=false`, `psql` local no disponible).
Por guardrail, no se uso el PostgreSQL staging ni ningun DB runtime para
parsear o ejecutar el candidate.
15. Conclusion¶
text
PDF-004F PASS CANDIDATE
DDL PACKAGE PREPARED
STAGING READ-ONLY PREFLIGHT = PASS
BUSINESS DB = ABSENT
BUSINESS SCHEMA = ABSENT
BUSINESS ROLES = ABSENT
BACKUP BASELINE = PRESENT
RESTORE DRILL = DOCUMENTED PASS
NO DDL EXECUTED
NO DML EXECUTED
NO SECRETS EXPOSED
GO = PDF-004G ONLY WITH EXPLICIT DDL AUTHORIZATION
NO-GO = PRODUCTION / DAILY SYNC / SANDBOX