Skip to content

Fix flaky FK failure in Backend (api) demo upload counter integration test - #7

Merged
mudabs merged 2 commits into
mainfrom
copilot/fix-backend-api-job-another-one
Oct 6, 2026
Merged

mudabs merged 2 commits into
mainfrom
copilot/fix-backend-api-job-another-one

Conversation

Copilot AI commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

The Backend (api) GitHub Actions job was failing in DemoUploadCountIT due to a foreign key violation when inserting media via raw JDBC before the parent events row was flushed. This PR makes event persistence explicit in the test setup to remove transaction-flush timing sensitivity.

  • Root cause

    • rawInsertDefaultsToNotSeededSoItCounts performs a direct JdbcTemplate insert into media.
    • newEvent() used events.save(event), which can defer SQL flush, so media.event_id could reference a not-yet-persisted row at insert time.
  • Change

    • Updated test fixture persistence in DemoUploadCountIT:
      • events.save(event) → events.saveAndFlush(event)
  • Why this is the right scope

    • Keeps behavior and assertions unchanged.
    • Addresses only the persistence-ordering gap in this integration test path.
private Event newEvent() {
    // ...
    return events.saveAndFlush(event);
}

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2a68cd1f-abc4-4434-90b8-044b634f889f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: mudabs <92596644+mudabs@users.noreply.github.com>
@mudabs
mudabs marked this pull request as ready for review October 6, 2026 03:21
@mudabs
mudabs merged commit fb13b0c into main Oct 6, 2026
3 checks passed
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Backend (api) Fix flaky FK failure in Backend (api) demo upload counter integration test Oct 6, 2026
Copilot stopped work on behalf of mudabs due to an error October 6, 2026 03:21
Copilot AI requested a review from mudabs October 6, 2026 03:21
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