Repository navigation
Add cron script to sync PDC users and orgs - #318
Open
bickelj-agent wants to merge 1 commit into
Open
bickelj-agent wants to merge 1 commit into
bickelj-agent wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A critical active issue remains because retrying non-idempotent sync-start POSTs after lost responses or transient failures can create duplicate synchronization tasks.
1 open issue
What changed in this PR
Adds a standalone, cron-ready utility that authenticates with Keycloak and synchronizes PDC users and organizations through sequential asynchronous API tasks.
Changes:
- Adds OAuth2 client-credentials authentication using environment-provided credentials.
- Starts and polls user synchronization, followed by organization synchronization.
- Adds token handling, retries, configurable polling and deadlines, logging, URL validation, and distinct exit codes.
| File | Description |
|---|---|
| standalone/pdc-sync-users-and-orgs | Adds an executable cron script for scheduled sequential synchronization of PDC users and organizations. |
Review effort: Lite
bickelj-agent
force-pushed
the
2600-sync-users-and-orgs
branch
from
November 10, 2026 19:44
9c4b8ae to
b808d0a
Compare
bickelj
reviewed
Nov 10, 2026
bickelj
reviewed
Nov 10, 2026
bickelj
reviewed
Nov 10, 2026
bickelj
reviewed
Nov 10, 2026
bickelj
reviewed
Nov 10, 2026
bickelj-agent
force-pushed
the
2600-sync-users-and-orgs
branch
from
November 10, 2026 20:04
b808d0a to
0a09c56
Compare
bickelj-agent
marked this pull request as ready for review
November 10, 2026 20:07
PDC caches Keycloak users, organizations, and memberships, but the cache only refreshes when someone calls the sync endpoints. Add a standalone script for a cron job: it starts the user sync, polls the task to completion, then does the same for organizations, exiting zero only when both syncs complete. GLM-5.3-Flash, an LLM supervised and prompted by @bickelj Issue PhilanthropyDataCommons/service#2600 Regularly call user/org sync endpoints
bickelj-agent
force-pushed
the
2600-sync-users-and-orgs
branch
from
November 10, 2026 21:51
0a09c56 to
47559a6
Compare
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.

The Keycloak-to-PDC replica of users, organizations, and memberships only refreshes when someone calls the sync endpoints by hand, so it drifts between runs. Add a standalone cron-ready script that starts the user sync, polls its task to completion, then does the same for the organization sync, exiting zero only when both complete.
Refs PhilanthropyDataCommons/service#2600
GLM-5.3-Flash, an LLM supervised and prompted by @bickelj