Skip to content

test(sapere): resolve master merge conflicts and split LsaNode concurrency test into focused helpers#5325

Merged
DanySK merged 13 commits into
masterfrom
test/incarnation-sapere/hardenlsanodecon
May 21, 2026
Merged

test(sapere): resolve master merge conflicts and split LsaNode concurrency test into focused helpers#5325
DanySK merged 13 commits into
masterfrom
test/incarnation-sapere/hardenlsanodecon

Conversation

@DanySK
Copy link
Copy Markdown
Member

@DanySK DanySK commented Apr 29, 2026

This PR addresses two issues in the SAPERE concurrency test branch: rebasing/merging against master with cache-related conflicts, and excessive complexity in LsaNodeConcurrencyTest.testConcurrentGetContentsAndModification (reported complexity: 20).
The test behavior is preserved, but its control flow is decomposed to reduce method-level complexity and improve diagnosability.

  • Merge conflict resolution with master

    • Reconciles branch state with upstream changes where dokka-cache files were renamed/updated on master while removed in the branch.
    • Produces a clean merged baseline so subsequent test changes apply on top of current master state.
  • Concurrency test complexity reduction

    • Refactors testConcurrentGetContentsAndModification into smaller units:
      • task body execution (runConcurrentTask)
      • writer mutation step (runWriterIteration)
      • task completion orchestration + executor shutdown handling (awaitTaskCompletion)
      • per-future wait/error translation (waitForTask)
    • Keeps existing timeout/cancellation semantics and preserved-failure behavior (primary assertion + suppressed termination errors).
  • Resulting structure (example)

    tasks.add(executor.submit(() -> runConcurrentTask(node, threadId, latch)));
    awaitTaskCompletion(latch, tasks, executor);
    
    private static void waitForTask(final Future<?> task) {
        try {
            task.get(TIMEOUT_SECONDS, TimeUnit.SECONDS);
        } catch (final TimeoutException e) {
            task.cancel(true);
            throw new AssertionError("Task timed out after " + TIMEOUT_SECONDS + SECONDS, e);
        }
    }

Copilot AI review requested due to automatic review settings April 29, 2026 21:03
@DanySK DanySK enabled auto-merge (squash) April 29, 2026 21:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 strengthens the SAPERE incarnation’s LsaNode concurrency test by explicitly tracking submitted tasks and waiting on their completion via Future#get, aiming to make concurrency failures more reliably detectable.

Changes:

  • Track submitted executor tasks via List<Future<?>> and wait for completion with a timeout.
  • Convert previously in-task exception handling into main-thread handling via Future#get.
  • Adjust writer-thread molecule naming used during concurrent modifications.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.53%. Comparing base (4d1ea4c) to head (eaa3f8e).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5325   +/-   ##
=========================================
  Coverage     61.53%   61.53%           
  Complexity       14       14           
=========================================
  Files             2        2           
  Lines            78       78           
  Branches          4        4           
=========================================
  Hits             48       48           
  Misses           24       24           
  Partials          6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@DanySK DanySK force-pushed the test/incarnation-sapere/hardenlsanodecon branch 6 times, most recently from 6690be6 to c78d86a Compare April 30, 2026 06:11
auto-merge was automatically disabled April 30, 2026 07:13

Head branch was pushed to by a user without write access

@DanySK DanySK requested a review from Copilot April 30, 2026 07:25
@DanySK
Copy link
Copy Markdown
Member Author

DanySK commented Apr 30, 2026

@codex review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanySK DanySK force-pushed the test/incarnation-sapere/hardenlsanodecon branch 2 times, most recently from 8c4b6f9 to 39cdeac Compare April 30, 2026 09:16
@DanySK DanySK requested a review from Copilot April 30, 2026 09:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@DanySK DanySK force-pushed the test/incarnation-sapere/hardenlsanodecon branch 2 times, most recently from 22643a8 to caa5285 Compare April 30, 2026 21:20
@DanySK DanySK force-pushed the test/incarnation-sapere/hardenlsanodecon branch 12 times, most recently from bc27de4 to ff02424 Compare May 14, 2026 11:08
@DanySK
Copy link
Copy Markdown
Member Author

DanySK commented May 19, 2026

@copilot, Checkstyle rule violations were found. Fix them, and confirm that this PR works with ./gradlew build

DanySK and others added 10 commits May 19, 2026 20:06
…model/sapere/nodes/LsaNodeConcurrencyTest.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…model/sapere/nodes/LsaNodeConcurrencyTest.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…List import, ensure executor shutdown in finally

Agent-Logs-Url: https://github.com/AlchemistSimulator/Alchemist/sessions/6651c551-7d20-4a2c-aebc-a2f43f4054f8

Co-authored-by: DanySK <1991673+DanySK@users.noreply.github.com>
…model/sapere/nodes/LsaNodeConcurrencyTest.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nation also fails

If the try block (latch.await or task.get) throws an AssertionError, it is
captured as primaryFailure. In the finally block, shutdownNow + awaitTermination
runs unconditionally; any termination error is added as a suppressed exception on
primaryFailure (preserving its stack trace) rather than replacing it. If there
was no prior failure, the termination error is thrown directly as before.

Agent-Logs-Url: https://github.com/AlchemistSimulator/Alchemist/sessions/5a82b660-ae48-43f3-a76d-95df9ff49832

Co-authored-by: DanySK <1991673+DanySK@users.noreply.github.com>
Sort java.util.concurrent imports alphabetically: ExecutionException
must precede ExecutorService and Executors. Fixes CodeFactor warning.

Agent-Logs-Url: https://github.com/AlchemistSimulator/Alchemist/sessions/5eb06f04-3691-430c-80ba-6a5d3f60fd08

Co-authored-by: DanySK <1991673+DanySK@users.noreply.github.com>
…rencyTest

- Extract SECONDS constant to fix MultipleStringLiterals violation
- Break long line 96 into multiline assertTrue call (LineLength violation)

Agent-Logs-Url: https://github.com/AlchemistSimulator/Alchemist/sessions/7df0fdf1-93b9-493f-b6a6-07a3678bf857

Co-authored-by: DanySK <1991673+DanySK@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

@copilot, Checkstyle rule violations were found. Fix them, and confirm that this PR works with ./gradlew build

Fixed in c2e2ebb (and the preceding commit d35357e). Two Checkstyle violations were resolved:

  • MultipleStringLiterals: extracted private static final String SECONDS = " seconds"; and replaced all three occurrences of the literal.
  • LineLength: split the assertTrue(latch.await(...), ...) call across multiple lines.

The dokka-cache/ build artifact directory was also removed from the PR and added to .gitignore.

@DanySK
Copy link
Copy Markdown
Member Author

DanySK commented May 21, 2026

@copilot remove all changes to dokka-cache

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

@copilot remove all changes to dokka-cache

Done in eaa3f8e. All dokka-cache changes are removed from the PR diff, and the branch is rebased with origin/master.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants