Skip to content

CXP-1395 Make the event feed examples runnable and keep revokes consistent - #159

Merged
JavierCarnelli-ConductorOne merged 3 commits into
feat/CXH-1390from
fix/cxp-1395
Nov 23, 2026
Merged

JavierCarnelli-ConductorOne merged 3 commits into
feat/CXH-1390from
fix/cxp-1395

Conversation

@JavierCarnelli-ConductorOne

@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The shipped event feed examples read columns (updated_at, deleted_at, id) that none of the test databases create, so the first feed poll failed. Their grant handling was also inconsistent with soft deletes: full syncs restored grants the feed had revoked, and revokes made through ConductorOne hard-deleted rows, so the feed could never report them.

This PR targets feat/CXH-1390 and should be merged before that branch merges to main, because that is when the example starts advertising the event feed capability.

No Go code changes.

Changes

Test databases (test/*.sql)

  • Add updated_at to users and roles tables, and id, updated_at, deleted_at to role assignment tables (UserRoleID, UpdatedAt, IsDeleted, DeletedAt on SQL Server). Existing columns, keys and seed rows are unchanged; (user_id, role_id) stays unique.
  • Keep updated_at current on every update:
    • Postgres, Oracle: BEFORE UPDATE trigger.
    • MySQL: ON UPDATE CURRENT_TIMESTAMP(6).
    • SQL Server: AFTER UPDATE triggers with SET NOCOUNT ON, so the trigger's update doesn't count toward the provisioning rows-affected check.
    • Vertica: no triggers; the example documents that writers must set it.
  • Seed one soft-deleted assignment (disabled.user / reader, revoked 1h before load) in each engine with a grants feed, so the feed has a revoke to report. Live grant counts are unchanged.

Examples

  • Full-sync grants queries exclude soft-deleted rows (Postgres, MySQL, Vertica, SQL Server, example.yml, and postgres-test-exclusion-group.yml, which shares the Postgres database).
  • Revoke provisioning soft-deletes instead of DELETE (Postgres, SQL Server, example.yml). Revoking an already-revoked grant still reports "already revoked".
  • Grant provisioning revives a soft-deleted row instead of inserting a duplicate or doing nothing (Postgres ON CONFLICT ... DO UPDATE, SQL Server UPDATE + INSERT ... WHERE NOT EXISTS, example.yml). Granting an already-live grant still reports "already exists".
  • mysql-test.yml: skip_if now uses string(.role_name). MySQL returns text columns as bytes, and the bytes-vs-string comparison skipped every row, so full syncs returned zero role grants even before this change.
  • example.yml comments on revokes_query now state the soft-delete rules.

Docs

  • README "Event Feed": the cursor column must change on every insert and update, plus a new "Grant revokes and soft deletes" subsection.

CI

  • New test/event_feed_smoke.sh <engine>. It runs the feed and checks:
    • The seeded revoke and a changed user are reported.
    • A connector revoke soft-deletes, reports a revoke, and stays revoked after a full sync.
    • A connector grant revives the row, reports a grant, and shows up in the next full sync.
    • Repeating a grant or revoke succeeds.
  • The Postgres CI job runs the script after the existing steps, using the baton CLI that the sync-test action installs.
  • baton_capabilities.json regenerated; the diff comes from the event feed work already on the base branch.

Testing

go build ./... and go test ./... pass. All changed example configs load.

Smoke script results against freshly loaded fixtures (docker):

Engine Result
PostgreSQL 16 Pass, all steps; also passes after replaying the CI order (sync-test grant/revoke, update attributes action)
SQL Server 2022 Pass, all steps
MySQL 8.0 Pass (feed + full sync; no role provisioning in the example)
Oracle XE 21 Pass (user feed only)
Vertica Not run: vertica/vertica-ce is no longer publicly pullable

The Postgres CI job passes with the smoke test.

Known issues not addressed here

  • example.yml provisioning writes a level column while its grants queries read access_level.
  • sqlserver-test.yml full-sync grants query orders by RoleID but paginates on role_name.
  • test/oracle-init.sql: GRANT DBA TO baton; -- ... fails with ORA-00933 because of the trailing comment. Also, the XE 21 image ships a prebuilt database, so the setup script doesn't run automatically through docker-compose-oracle-test.yml.

🤖 Generated with Claude Code

Add cursor and soft-delete columns to the test databases, exclude
soft-deleted rows from full-sync grants, soft-delete on revoke and revive
on grant, and add an event feed smoke test to CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

CXP-1395

@JavierCarnelli-ConductorOne JavierCarnelli-ConductorOne changed the title fix: make the event feed examples runnable and keep revokes consistent CXP-1395 Make the event feed examples runnable and keep revokes consistent Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pinned standalone baton release cannot read current c1z files and
replaced the CLI the sync-test action installs. The script now fails
loudly when baton grants errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JavierCarnelli-ConductorOne
JavierCarnelli-ConductorOne merged commit ea155a9 into feat/CXH-1390 Nov 23, 2026
6 checks passed
@JavierCarnelli-ConductorOne
JavierCarnelli-ConductorOne deleted the fix/cxp-1395 branch November 23, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants