Skip to content

fix(neo4j): assert background thread completion in OptimisticLockingSpec - #16072

Open
borinquenkid wants to merge 1 commit into
feat/gorm-registry-core-implfrom
fix/optimistic-locking-spec-join-assert
Open

fix(neo4j): assert background thread completion in OptimisticLockingSpec#16072
borinquenkid wants to merge 1 commit into
feat/gorm-registry-core-implfrom
fix/optimistic-locking-spec-join-assert

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

Summary

Test plan

  • CI run of grails.gorm.tests.OptimisticLockingSpec in grails-data-neo4j (could not execute this module's tests locally — it's pinned to grails-gradle-plugins:6.1.2, which 404s from repo.grails.org and isn't in local caches, a pre-existing environment gap unrelated to this change)

🤖 Generated with Claude Code

Follow-up to #16070. Copilot's review flagged that the second test's
Thread.start { ... }.join(2000) can return on timeout without the
background thread having actually finished, so the "same headroom
rationale" comment added in #16070 was inaccurate there: the sleep
could still be masking a race with thread completion, unlike the
first test where the unbounded join() guarantees it. Capture the
thread and assert !isAlive() after the bounded join so a slow runner
fails loudly instead of silently racing the assertions that follow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 22:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the OptimisticLockingSpec Neo4j test to avoid silently continuing after a timed Thread.join(timeout) that may return before the background write completes, making slow CI runners fail deterministically instead of racing subsequent assertions.

Changes:

  • Capture the background update thread in Test optimistic locking disabled with 'version false'.
  • Replace Thread.start { ... }.join(2000) with a stored thread, join(5000), and an explicit !isAlive() completion assertion.
  • Stop swallowing potential InterruptedException from the join path (now an interrupt will fail the test rather than masking it).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.1662%. Comparing base (184020c) to head (cd0502f).

Additional details and impacted files

Impacted file tree graph

@@                          Coverage Diff                           @@
##             feat/gorm-registry-core-impl     #16072        +/-   ##
======================================================================
+ Coverage                         52.1558%   52.1662%   +0.0104%     
- Complexity                          18408      18412         +4     
======================================================================
  Files                                2054       2054                
  Lines                               96622      96622                
  Branches                            16846      16846                
======================================================================
+ Hits                                50394      50404        +10     
+ Misses                              38835      38825        -10     
  Partials                             7393       7393                

see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

testlens-app Bot commented Jul 30, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: cd0502f
▶️ Tests: 40637 executed
⚪️ Checks: 55/55 completed


Learn more about TestLens at testlens.app.

@borinquenkid borinquenkid moved this to Todo in Apache Grails Jul 31, 2026
@borinquenkid borinquenkid added this to the grails:8.0.0-RC2 milestone Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants