Skip to content

Conversation

@mohsinm-dev
Copy link
Contributor

@mohsinm-dev mohsinm-dev commented Jul 27, 2025

Fix for GitHub Issue #3194 where releases collection was failing with psycopg2.errors.UniqueViolation on releases_pkey constraint.

Root cause: GitHub API returns release IDs with trailing spaces that don't match existing trimmed database records.

Changes:

  • Add str().strip() to release_id processing in get_release_inf()
  • Enhance duplicate detection in insert_release() with proper trimming
  • Add early duplicate detection to prevent unnecessary database operations

Description

  • Please include a summary of the change.

This PR fixes #

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Fix for GitHub Issue chaoss#3194 where releases collection was failing with
psycopg2.errors.UniqueViolation on releases_pkey constraint.

Root cause: GitHub API returns release IDs with trailing spaces that don't
match existing trimmed database records.

Changes:
- Add str().strip() to release_id processing in get_release_inf()
- Enhance duplicate detection in insert_release() with proper trimming
- Add early duplicate detection to prevent unnecessary database operations

Signed-off-by: mohsinm-dev <mohsin.mdev@gmail.com>
@mohsinm-dev mohsinm-dev force-pushed the fix-releases-uniqueviolation-3194 branch from 15e1c32 to c3b08cb Compare July 27, 2025 14:39
Copy link
Member

@sgoggins sgoggins left a comment

Choose a reason for hiding this comment

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

Looks like this will identify "false duplicates".


release_inf = {
'release_id': release['id'],
'release_id': str(release['id']).strip(),
Copy link
Member

Choose a reason for hiding this comment

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

I think this helps to ensure that strings are interpreted as strings, and spaces are removed. So, it should eliminate "false duplicates".

@sgoggins sgoggins requested a review from cdolfi July 29, 2025 20:36
@sgoggins
Copy link
Member

@cdolfi : I think this addresses false duplicate types of issues.

Copy link
Contributor

@cdolfi cdolfi left a comment

Choose a reason for hiding this comment

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

lgtm!

@MoralCode
Copy link
Contributor

Seems like this needs to be merged still? any reason it hasnt been?

@sgoggins sgoggins merged commit 05189aa into chaoss:main Oct 16, 2025
10 checks passed
@sgoggins sgoggins added the bug-fix Fixes a bug label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

augur.tasks.github.releases.tasks.collect_releases: psycopg2.errors.UniqueViolation

4 participants