Skip to content

[tasks/github] Fix uncommitted UPDATE in update_issue_closed_cntrbs_by_repo_id - #483

Draft
MoralCode wants to merge 2 commits into
mainfrom
devs6186/fix/3457-events-update-transaction
Draft

MoralCode wants to merge 2 commits into
mainfrom
devs6186/fix/3457-events-update-transaction

Conversation

@MoralCode

Copy link
Copy Markdown
Contributor

Note

This PR was ported from augurlabs/augur#3716 filed by @devs6186 because the contribution was deemed to still be useful.

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

  • related to #3457
  • Related to #3192

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.

devs6186 and others added 2 commits September 15, 2026 08:32
…y_repo_id

Fixes #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>
""".format(repo_id, new_endpoint, new_field)
try:
with engine.connect() as conn:
with engine.begin() as conn:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'engine' (undefined-variable)

""".format(repo_id, new_endpoint, new_field)
try:
with engine.connect() as conn:
with engine.begin() as conn:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'engine' (undefined-variable)

""".format(record['repo_id'], record['ri_metric'], record['ri_field'])
try:
with engine.connect() as conn:
with engine.begin() as conn:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'engine' (undefined-variable)

""".format(insight['repo_id'], insight['ri_metric'])
try:
with engine.connect() as conn:
with engine.begin() as conn:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'engine' (undefined-variable)

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