Grant cora_app SELECT+INSERT on five entries_ tables missing it - #644
Merged
Conversation
Five entries_* tables (entries_run_readings/entries_run_observations, entries_operation_procedure_steps/...activities, entries_run_feed_heartbeats, entries_operation_procedure_diagnostics, entries_operation_procedure_outcomes) carried a header comment claiming cora_app gets SELECT+INSERT via the role-init migration's ALTER DEFAULT PRIVILEGES clause. That clause covers sequences only, never tables, so none of the five ever had a working grant. Dormant today because the 2-BM pilot's DATABASE_URL still connects as the owner role, but every write would fail the day anything switches to the restricted cora_app role. Two of the five were renamed after creation, so the fix migration targets their current identifiers (entries_run_observations, entries_operation_procedure_activities) rather than the names in the original bug report - an earlier draft using the old names failed atlas migrate validate with a 42P01, confirming the point. Also hardened the test_entries_table_grants fitness test that encoded this finding: it now follows ALTER TABLE ... RENAME TO across ALL tables' history (not just ones already named entries_/events), closing a blind spot where a table renamed INTO the prefix from a differently named origin (entries_conduit_verdicts, originally observations_conduit_traversals) was invisible to the check. Added a parametrized integration test that inserts into all five tables as a real cora_app-credentialed connection against a live Postgres container, since a regex match against migration text proves a GRANT statement exists, not that Postgres honors it. Gate review (4 agents: architecture, test coverage, cross-BC consistency, migration-safety specialist): migration-safety LOCK, no P0s; two independently-converged P1s (the rename-lineage blind spot, and the missing positive integration test) both fixed and verified against a live Postgres testcontainer in this same commit. Cosmetic P2 (GRANT column alignment) not addressed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
entries_*tables carried a header comment falsely claimingcora_appgets SELECT+INSERT via the role-init migration'sALTER DEFAULT PRIVILEGESclause, which covers sequences only, never tables. Adds a purely additive migration granting the five tables their missing privileges, targeting each table's current (post-rename) name.DATABASE_URLstill connects as the owner rolecora, notcora_app.test_entries_table_grants.py's rename-lineage tracking (a table renamed into theentries_prefix from a differently-named origin was previously invisible to the check) and adds a live-Postgres integration test provingcora_appcan actually INSERT into all five tables, not just that a GRANT statement exists in migration text.Test plan
atlas migrate validate --env localcleantests/integration/test_cora_app_role_revoke_postgres.py: 12 passed (5 new, against a live Postgres testcontainer)🤖 Generated with Claude Code