Skip to content

feat(repos): Track last_sync on OrganizationIntegration config#113686

Merged
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config
Apr 23, 2026
Merged

feat(repos): Track last_sync on OrganizationIntegration config#113686
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

Stamp OrganizationIntegration.config["last_sync"] after each run of
the SCM sync cron and each time the GitHub installation_repositories
webhook processes an OI. Stored as an ISO-8601 string so the existing
configData serializer exposes it to the frontend without schema
changes.

This will back a "Last synced X ago" indicator in the repository
settings UI.

@evanpurkhiser evanpurkhiser requested review from a team as code owners April 22, 2026 15:46
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 22, 2026
@evanpurkhiser evanpurkhiser requested review from a team and removed request for a team April 22, 2026 15:47
Comment thread src/sentry/integrations/source_code_management/sync_repos.py Outdated
Comment thread src/sentry/integrations/source_code_management/sync_repos.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config branch from a314b4c to 7f1f004 Compare April 22, 2026 15:58
repos_added=repos_added,
repos_removed=repos_removed,
)
bump_oi_last_sync(oi.id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call this bump_org_integration_last_sync

if dry_run:
return

bump_oi_last_sync(organization_integration_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only bump this if things actually change? Or do we want to know the last time we attempted a sync regardless?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's probably a good idea to just know the last time we synced. idk though maybe it is more useful to know the last time something actually "changed'. hmm, we could store both?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe both are useful. I don't feel too strongly either way though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added both here

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config branch from 7f1f004 to d023e5b Compare April 23, 2026 16:02
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d023e5b. Configure here.

Comment thread src/sentry/integrations/github/tasks/sync_repos_on_install_change.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config branch from d023e5b to 26d77b7 Compare April 23, 2026 19:17
Stamp `OrganizationIntegration.config["last_sync"]` after each run of
the SCM sync cron and each time the GitHub `installation_repositories`
webhook processes an OI. Stored as an ISO-8601 string so the existing
`configData` serializer exposes it to the frontend without schema
changes.

This will back a "Last synced X ago" indicator in the repository
settings UI.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config branch from 26d77b7 to 1577771 Compare April 23, 2026 19:18
@evanpurkhiser evanpurkhiser merged commit 5810573 into master Apr 23, 2026
56 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-repos-track-last-sync-on-organizationintegration-config branch April 23, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants