Skip to content

Merge branch 'develop' into V13#3447

Merged
rwmcintosh merged 2 commits intoV13from
merge_dev
Mar 16, 2026
Merged

Merge branch 'develop' into V13#3447
rwmcintosh merged 2 commits intoV13from
merge_dev

Conversation

@rwmcintosh
Copy link
Member

@rwmcintosh rwmcintosh commented Mar 16, 2026

merge commit

Summary by CodeRabbit

  • Chores

    • Discontinued automatic nightly build schedule; builds now available on manual trigger only
    • Updated build infrastructure tooling
  • Tests

    • Expanded API integration test coverage for core factories and runner functionality

# Conflicts:
#	.github/workflows/build-nightly_v13.yml
#	src/PKSim.R/Bootstrap/ApplicationStartup.cs
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

This PR adds branch validation to the nightly build workflow, updates GitHub Actions checkout action to v6 in coverage workflow, refactors protocol item enumeration in EventBuildingBlockCreator, and introduces API integration tests verifying successful resolver initialization.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/build-nightly_v13.yml, .github/workflows/coverage.yml
Added branch-validation job (check-branch) that errors if workflow is not invoked from V13 branch; removed schedule trigger from nightly build. Updated checkout action from v4 to v6 in coverage workflow.
Core Service Refactoring
src/PKSim.Core/Services/EventBuildingBlockCreator.cs
Replaced ToList-based enumeration with direct Each iteration; removed computed width and zero-padding logic from applicationName construction; applicationName now uses template + (index + 1) format.
API Integration Tests
tests/PKSim.R.Tests/APISpecs.cs
New test file with base APISpecs class for API initialization and exception capture; concrete test suite When_resolving_tasks_after_initialization validates factories (IndividualFactory, PopulationFactory) and runners (Snapshot, Export, Json, Qualification, SimulationExport) do not throw ComponentActivatorException.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • msevestre
  • benjaperez1983
  • Yuri05

Poem

🐰 A branch guard stands tall, ensuring V13's call,
Tests bloom to verify runners won't fall,
Padding removed, enumeration streams free,
Actions upgraded—v6 brings harmony! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the PR as a merge of the develop branch into V13, reflecting the actual nature of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch merge_dev
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can approve the review once all CodeRabbit's comments are resolved.

Enable the reviews.request_changes_workflow setting to automatically approve the review once all CodeRabbit's comments are resolved.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Yuri05 do we want these changes in V13 also? I removed the schedule for now

Copy link
Member

Choose a reason for hiding this comment

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

Don't think it's required.
As long as the workflow build-nightly_v13.yml‎ exists only in develop and in V13 (and starting from develop is prevented by the check there) everything should be fine.

@rwmcintosh rwmcintosh requested a review from Yuri05 March 16, 2026 19:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build-nightly_v13.yml:
- Around line 15-23: The branch validation job check-branch is not set as a
prerequisite, so add a needs: check-branch dependency to the downstream jobs
that must be gated (for example get-latest-commit-timespan and/or build-nightly)
so they will fail fast when the branch check fails; locate the job definitions
named get-latest-commit-timespan and build-nightly in the workflow and insert
needs: check-branch under their job headers to enforce the dependency.

In `@tests/PKSim.R.Tests/APISpecs.cs`:
- Around line 36-40: The helper ActionShouldNotThrowAn<TException> incorrectly
treats any non-TException as passing; update it so that it fails when any
exception is thrown by asserting exceptionFromPerforming is null (or using the
test framework's Assert.Null/ShouldBeNull) instead of comparing types, e.g. in
ActionShouldNotThrowAn<TException> replace the (exceptionFromPerforming is
TException).ShouldBeFalse() check with a check that exceptionFromPerforming is
null (or explicitly fail with the exception message if not null), or if the
intent is to verify resolution succeeded call Api.ResolveTask<T>() directly from
your test rather than using the runner; use getExceptionFromPerforming to locate
the produced exception and include its message in the failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c884b34d-9fe7-4eca-9322-9811cbb72938

📥 Commits

Reviewing files that changed from the base of the PR and between bc9a56b and f887036.

📒 Files selected for processing (4)
  • .github/workflows/build-nightly_v13.yml
  • .github/workflows/coverage.yml
  • src/PKSim.Core/Services/EventBuildingBlockCreator.cs
  • tests/PKSim.R.Tests/APISpecs.cs

Comment on lines +15 to +23
check-branch:
runs-on: ubuntu-latest
steps:
- name: Validate source branch
run: |
if [ "${{ github.ref_name }}" != "V13" ]; then
echo "::error::Please call the workflow from the V13 branch"
exit 1
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Branch validation job is not wired as a prerequisite.

The check-branch job validates the branch but no other job depends on it. Without a needs: check-branch dependency on subsequent jobs, this validation runs in parallel and won't actually block the build if the branch check fails.

🔧 Proposed fix to wire the dependency

Add needs: check-branch to the get-latest-commit-timespan job:

   get-latest-commit-timespan:
     runs-on: ubuntu-latest
+    needs: check-branch
     outputs:
       LATEST_COMMIT_TIMESPAN: ${{ steps.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN}}

Alternatively, add it to build-nightly as well to ensure both paths are gated:

   build-nightly:
-    needs: get-latest-commit-timespan
+    needs: [check-branch, get-latest-commit-timespan]
     if: needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN < 86400
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-nightly_v13.yml around lines 15 - 23, The branch
validation job check-branch is not set as a prerequisite, so add a needs:
check-branch dependency to the downstream jobs that must be gated (for example
get-latest-commit-timespan and/or build-nightly) so they will fail fast when the
branch check fails; locate the job definitions named get-latest-commit-timespan
and build-nightly in the workflow and insert needs: check-branch under their job
headers to enforce the dependency.

Comment on lines +36 to +40
protected static void ActionShouldNotThrowAn<TException>(Action workToPerform) where TException : Exception
{
Exception exceptionFromPerforming = getExceptionFromPerforming(workToPerform);
(exceptionFromPerforming is TException).ShouldBeFalse();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Assertion helper silently passes when a different exception type is thrown.

If workToPerform throws an exception that is not of type TException, the assertion still passes because exceptionFromPerforming is TException evaluates to false. This masks actual failures.

For resolution tests, if a dependency throws ArgumentNullException instead of ComponentActivatorException, the test would pass incorrectly.

🔧 Proposed fix to fail on any exception or specifically check resolution succeeded

Option 1 - Fail on any exception:

 protected static void ActionShouldNotThrowAn<TException>(Action workToPerform) where TException : Exception
 {
    Exception exceptionFromPerforming = getExceptionFromPerforming(workToPerform);
-   (exceptionFromPerforming is TException).ShouldBeFalse();
+   if (exceptionFromPerforming != null)
+   {
+      (exceptionFromPerforming is TException).ShouldBeFalse(
+         $"Expected no {typeof(TException).Name} but got: {exceptionFromPerforming}");
+   }
 }

Option 2 - If the intent is purely to test resolution, consider calling Api.ResolveTask<T>() directly instead of invoking the full runner execution.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
protected static void ActionShouldNotThrowAn<TException>(Action workToPerform) where TException : Exception
{
Exception exceptionFromPerforming = getExceptionFromPerforming(workToPerform);
(exceptionFromPerforming is TException).ShouldBeFalse();
}
protected static void ActionShouldNotThrowAn<TException>(Action workToPerform) where TException : Exception
{
Exception exceptionFromPerforming = getExceptionFromPerforming(workToPerform);
if (exceptionFromPerforming != null)
{
(exceptionFromPerforming is TException).ShouldBeFalse(
$"Expected no {typeof(TException).Name} but got: {exceptionFromPerforming}");
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/PKSim.R.Tests/APISpecs.cs` around lines 36 - 40, The helper
ActionShouldNotThrowAn<TException> incorrectly treats any non-TException as
passing; update it so that it fails when any exception is thrown by asserting
exceptionFromPerforming is null (or using the test framework's
Assert.Null/ShouldBeNull) instead of comparing types, e.g. in
ActionShouldNotThrowAn<TException> replace the (exceptionFromPerforming is
TException).ShouldBeFalse() check with a check that exceptionFromPerforming is
null (or explicitly fail with the exception message if not null), or if the
intent is to verify resolution succeeded call Api.ResolveTask<T>() directly from
your test rather than using the runner; use getExceptionFromPerforming to locate
the produced exception and include its message in the failure.

@rwmcintosh rwmcintosh merged commit 870694e into V13 Mar 16, 2026
1 check passed
@rwmcintosh rwmcintosh deleted the merge_dev branch March 16, 2026 20:29
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