movilba
MOVILBA-601
LLM-discoverable latest application logs view
Done low
dmdb04-mba-l-ca
Create public.v_app_logs_latest in PROD and DEV as a bounded read view over public.app_logs, ordered by created_at DESC, id DESC with LIMIT 100. Keep all log levels available for filtering; use security_invoker and grant only SELECT to principals that already have SELECT on app_logs in that same base. Audit migration before application; no app endpoint changes.
Activity
-
db04-mba-l-ca 2026-09-25: Read-only checks found app_logs in both bases and no v_app_logs_latest/v_applog_latest collision. PROD's current SELECT grantees are mirrored dynamically; DEV currently permits its owner only. Draft migration uses security_invoker and LIMIT 100; no DB DDL run. Sending the migration for static audit before applying.
-
audit pass: Static read only of 601 migration: preflight, security_invoker view, dynamic SELECT-grant mirror, postflight, PG15/17 syntax. NOT run: no psql rehearsal, no DB, no consumer. Untested: one-line psql \if/\else.
payload
{"scope":"Static read only of 601 migration: preflight, security_invoker view, dynamic SELECT-grant mirror, postflight, PG15/17 syntax. NOT run: no psql rehearsal, no DB, no consumer. Untested: one-line psql \\if/\\else.","outcome":"pass","evidence":"Non-broadening: security_invoker=true (PG15+) checks app_logs ACL as caller; grants mirror only existing SELECT grantees (PUBLIC=0 handled, owner excluded); postflight diffs reader sets both ways. Caveat: level filter applies after LIMIT 100.","reportRef":null} -
db04-mba-l-ca 2026-09-25: Clarified COMMENT and view-catalog wording: WHERE level='error' filters within the latest-100 window, not latest 100 errors. After audit static PASS, ran psql rollback rehearsals as table owner: PROD movilba/PostgreSQL 17.6 (SET ROLE postgres) and DEV movilba_dev/PG15.17 (SET ROLE movilba_user); both passed preflight, CREATE VIEW, grants, output/owner/options/grant postflights, and ended ROLLBACK. No persistent DB change. Sent output to audit for second look before apply.
-
audit pass: Revised COMMENT ON VIEW + view-catalog paragraph read in the working tree; db04's reported ROLLBACK rehearsals (PROD PG17.6, DEV PG15.17) taken from its message, not reproduced by me. No apply, no consumer.
payload
{"scope":"Revised COMMENT ON VIEW + view-catalog paragraph read in the working tree; db04's reported ROLLBACK rehearsals (PROD PG17.6, DEV PG15.17) taken from its message, not reproduced by me. No apply, no consumer.","outcome":"pass","evidence":"Wording now states level filter applies within the latest-100 window. Rehearsal logs are self-reported: no output artifact attached. Migration untracked, view-catalog.md and migrations/README.md modified, uncommitted.","reportRef":null} -
db04-mba-l-ca 2026-09-25 12:04 ART: Audit PASS in bwi; revision comment clarifies latest-100 filtering. Applied audited migration PROD first then DEV (both COMMIT). PROD: current_database/current_user movilba/postgres, SET ROLE postgres; script preflight, CREATE VIEW, grant and postflight checks passed. Runtime SELECT as svc_nextjs returned 100 rows, 0 level=error in window, timestamps 2026-09-24 07:53:40 to 2026-09-25 11:34:10 -03. DEV: current_database/current_user movilba_dev/movilba_user, SET ROLE movilba_user; same gates passed. Runtime SELECT as movilba_user returned 100 rows, 8 errors in window, timestamps 2026-09-25 10:32:20 to 11:52:08 -03. Regenerated drizzle/schema.ts from DEV; view appears with securityInvoker. Docs updated. Item remains inProgress pending coder commit/push; no app endpoint added.
-
db04-mba-l-ca 2026-09-25 12:06 ART: Done. Audit PASS recorded; migration applied PROD first then DEV with postconditions passed; normal-reader SELECT verified 100 rows in each (PROD svc_nextjs: 0 errors in the latest-100 window; DEV movilba_user: 8). Drizzle mirror regenerated from DEV. Coder committed/pushed all four paths as f53b3efc, v5.6.72; dev health OK. View returns latest 100 across all levels; filtering level='error' is within that window, not latest 100 errors.
feature
3w ago by db04-mba-l-ca
3w ago
2026-09-25 15:06