Skip to content

release: fix reader privilege blockers and sample slot race - #181

Merged
NikolayS merged 5 commits into
mainfrom
agent/w2-b46
Jul 27, 2026
Merged

release: fix reader privilege blockers and sample slot race#181
NikolayS merged 5 commits into
mainfrom
agent/w2-b46

Conversation

@NikolayS

Copy link
Copy Markdown
Owner

Closes #164.
Closes #166.
Closes #169.

What changed

  • Preserve complete direct reader bundles, including the installer-default pg_monitor bundle, across ash.rebuild_partitions() by reusing the installer's _ash_install_reader_roles snapshot/replay mechanism.
  • Refuse ash.revoke_reader() when its target owns schema ash, is current_user, or is a superuser. Keep _admin_funcs() out of reader grants and scrub its legacy EXECUTE grant during installer re-apply.
  • Stamp each ash.sample row with the already captured v_current_slot, so packed query-map IDs and their slot cannot diverge during rotation.
  • Correct README/RELEASE_NOTES guidance around partition rebuilds and reader ACL preservation.

Regression coverage

Local validation

The N2 behavioral probe deterministically forces the slot transition. Its tagged one-active-backend fixture is controlled in CI, but—as with any pg_stat_activity fixture—could be perturbed by an unexpected concurrent client in a shared local database; the structural assertion remains fully deterministic.

This draft was rebased onto current origin/main immediately before push. It still needs a fresh rebase onto origin/main before merge.

@NikolayS

Copy link
Copy Markdown
Owner Author

Pre-merge verification complete after rebasing onto main (8eff377). codex review --base origin/main stood in for REV because REV is unavailable; its first pass found two real least-privilege gaps, both now fixed, regression-covered, and clean on a second independent review.

Conflict resolution:

RED / GREEN:

The rebuilt ACL logic remains dynamic: it derives the non-admin helper closure rather than freezing a function list. This is important for the upcoming #189 helper; after #189 lands I will explicitly verify ash._raw_oldest_sample() receives reader EXECUTE through this bundle.

Targeted PostgreSQL verification passed for all three scenarios, YAML parses, git diff --check is clean, and the second Codex review returned no findings.

@NikolayS
NikolayS marked this pull request as ready for review July 27, 2026 18:54
@NikolayS

Copy link
Copy Markdown
Owner Author

CI follow-up: the first rebased run exposed a stale v1.5 upgrade-test oracle, not a product regression. The upgrade correctly scrubbed the legacy reader grant on newly-admin _admin_funcs(), while the old equivalence sweep still required every historically reader-visible name to retain EXECUTE.

Fixed in 34671bb by filtering both upgrade/re-apply sweeps through the current dynamic ash._admin_funcs() exclusion and adding explicit assertions that _admin_funcs() is denied after both transitions. The full affected v1.5 → current → wrapper re-apply step now passes locally on PostgreSQL 17 with cron absent (matching the first failing matrix variant), including state preservation and reader-surface behavior.

@NikolayS
NikolayS merged commit 8540219 into main Jul 27, 2026
11 checks passed
@NikolayS
NikolayS deleted the agent/w2-b46 branch July 27, 2026 19:03
NikolayS pushed a commit that referenced this pull request Jul 27, 2026
Separate exact physical raw coverage from the reusable minute-aligned planning boundary, keep source attribution tied to physical evidence, and make tie-drill remediation preserve partial first minutes.

Rebase resolution retains #185's day-granular rotation contract and scales #189's synthetic retention fixtures instead of weakening validation. #181's dynamic reader grant bundle includes the new _raw_oldest_sample() helper (41 current non-admin functions). Fixes #163.
NikolayS added a commit that referenced this pull request Jul 27, 2026
Preserve honest retained grain across aas, timeline, top, compare, chart, summary, and v1.5 backfills; disclose effective plans and mark legacy/incomplete hourly detail as rollup_1h_flat.\n\nThe final rebase preserves #189's physical/logical raw-retention split and #181's dynamic reader grants. The Codex review's full-archive scan finding is fixed by keeping _rollup_1h_has_flat() indexable. Fixes #161, #168, #175, and #130; supersedes #131.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants