Skip to content

[tasks/github] Fix uncommitted UPDATE in update_issue_closed_cntrbs_by_repo_id#3716

Open
devs6186 wants to merge 2 commits intoaugurlabs:mainfrom
devs6186:fix/3457-events-update-transaction
Open

[tasks/github] Fix uncommitted UPDATE in update_issue_closed_cntrbs_by_repo_id#3716
devs6186 wants to merge 2 commits intoaugurlabs:mainfrom
devs6186:fix/3457-events-update-transaction

Conversation

@devs6186
Copy link
Copy Markdown

@devs6186 devs6186 commented Feb 18, 2026

Changeset

  • Replace engine.connect() with engine.begin() in update_issue_closed_cntrbs_by_repo_id so the UPDATE on issues.cntrb_id is committed rather than silently rolled back
  • Wrap the call site in events.py with try/except so a DB error here does not abort the whole batch of event collection

Notes

In SQLAlchemy 2.0 engine.connect() uses autobegin but NOT autocommit. Every call to update_issue_closed_cntrbs_by_repo_id was rolling back at context-manager exit, leaving cntrb_id stale. Switching to engine.begin() makes the transaction commit on success and roll back only on exception, which is the correct behavior. The try/except guard in _process_events means a transient failure here logs an error rather than killing the Celery task mid-batch.

Related issues/PRs

Description

  • Fixed silent transaction rollback in update_issue_closed_cntrbs_by_repo_id

Notes for Reviewers
The engine.connect() -> engine.begin() change is the core fix. Confirm the UPDATE path in lib.py and the error-handling wrapper in events.py look correct.

Signed commits

  • Yes, I signed my commits.

@MoralCode
Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

Can you clarify how this PR relates to the two issues you linked?

sgoggins
sgoggins previously approved these changes Feb 19, 2026

if update_data:
with engine.connect() as connection:
# engine.begin() auto-commits (or rolls back on exception).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Holy moly. This comment is right. Nice catch.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Holy moly. This comment is right. Nice catch.

Thanks! Took me a while to trace why the field was always null — the engine.connect() vs engine.begin()
distinction in 2.0 is easy to miss.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this comment also tracks with a fix that caio identified in 8Knot.

@devs6186
Copy link
Copy Markdown
Author

Thanks for the contribution!

Can you clarify how this PR relates to the two issues you linked?

Sure. The traceback in #3457 shows the crash path going through _process_events to update_issue_closed_cntrbs_by_repo_id. The root cause is that engine.connect() in SQLAlchemy 2.0 uses autobegin but not autocommit — so the UPDATE on cntrb_id was being silently rolled back on every single call, leaving the field perpetually stale. The try/except wrapper means a failure there no longer kills the entire event collection batch for that repo.

The link to #3192 is more indirect — the original reporter of #3457 noted the bug pattern looks similar (data
consistency errors in the collection pipeline caused by incomplete transactions). #3192 is specifically about PRs, not events, so this PR doesn't close it, just touches the same kind of problem in a different
path. I kept it as "Related to" rather than "Fixes" for that reason.

@MoralCode MoralCode added the stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing label Feb 19, 2026
@MoralCode
Copy link
Copy Markdown
Collaborator

Taking over this PR since the contributor has abandoned it and the changes it makes are fairly minimal and seemingly salvage-able

@MoralCode MoralCode self-assigned this Mar 16, 2026
devs6186 and others added 2 commits March 16, 2026 16:41
…y_repo_id

Fixes augurlabs#3457

- Replace engine.connect() with engine.begin() so the UPDATE on
  issues.cntrb_id is actually committed; previously every call was
  silently rolled back at context-manager exit in SQLAlchemy 2.0
- Wrap the call site in events.py with try/except so a transient DB
  error here does not abort the entire batch of event collection

Signed-off-by: devs6186 <devyanshsomvanshi@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
…tually perform updates to data

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Copilot AI review requested due to automatic review settings March 16, 2026 20:41
@MoralCode MoralCode force-pushed the fix/3457-events-update-transaction branch from 0fa2f49 to b9eb8de Compare March 16, 2026 20:41

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants