Skip to content

Conversation

@JasonXuDeveloper
Copy link
Owner

@JasonXuDeveloper JasonXuDeveloper commented Jan 30, 2026

Summary

This PR adds parallel execution capabilities to JAction and improves test coverage for JEngine.Util and JEngine.UI packages.

Key Features

JAction Parallel Execution Mode

  • Parallel() method: Enable concurrent execution of the same JAction
  • JActionExecutionHandle: Awaitable handle for per-execution control with Cancel() method
  • JActionExecution: Result struct with per-execution Cancelled state
  • Task Snapshot Isolation: Modifications after ExecuteAsync() don't affect running executions

New Types

  • JActionExecutionContext: Internal per-execution state for concurrent execution isolation
  • JActionExecution: Lightweight result struct returned when awaiting execution
  • JActionExecutionHandle: Handle for controlling individual executions

Test Coverage Improvements

JEngine.Util

  • JObjectPool tests: Shared instance, Prewarm, capacity limits, null handling
  • JAction edge cases: Task capacity limits, Reset behavior, negative delays
  • JAction async: Func overloads, state-passing patterns
  • JAction parallel: Concurrent execution, per-handle cancellation

JEngine.UI

  • MessageBox test hooks for pool state verification
  • Button visibility tests (empty text handling)
  • Pool behavior validation via internal hooks

Plugin Documentation

Updated .claude-plugin/skills/jaction/SKILL.md with:

  • Task Snapshot Isolation documentation
  • JActionExecution and JActionExecutionHandle API reference
  • Zero-allocation patterns using this as state
  • Complete parallel execution examples

Test plan

  • All existing tests pass
  • New parallel execution tests verify concurrent behavior
  • Per-execution cancellation tests verify isolation
  • Edge case tests verify boundary conditions

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 30, 2026 06:22
@github-actions github-actions bot added documentation Improvements or additions to documentation tests editor util labels Jan 30, 2026
- Add JActionExecutionContext for per-execution state isolation
- Add JActionExecution result struct with per-execution Cancelled state
- Add JActionExecutionHandle for per-execution cancellation control
- Execute/ExecuteAsync now snapshot tasks enabling safe parallel execution
- Switch from ValueTask to UniTask for better Unity integration
- Add comprehensive tests for parallel execution, timeouts, and edge cases
- Add MessageBox test hooks for pool state inspection
- Update jaction skill documentation with new API and patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
@JasonXuDeveloper JasonXuDeveloper force-pushed the feat/jaction-parallel-and-test-coverage branch from 4306e9f to a0eb188 Compare January 30, 2026 06:24
@github-actions
Copy link

github-actions bot commented Jan 30, 2026

Unity Test Results

EditMode: All tests passed
PlayMode: All tests passed

Unity Version: 2022.3.55f1
Project Path: UnityProject

✅ All tests passed! The PR is ready for review.

View workflow run

Click here to view the full workflow run

Copy link

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 adds parallel execution support to JAction with per-execution state isolation, switches from ValueTask to UniTask for better Unity integration, and significantly improves test coverage across JEngine.Util and JEngine.UI packages.

Changes:

  • Introduces parallel execution mode with JActionExecutionContext for per-execution state isolation
  • Adds JActionExecution result struct and JActionExecutionHandle for fine-grained execution control
  • Switches async return types from ValueTask to UniTask for Unity-native async patterns
  • Adds comprehensive test coverage for parallel execution, object pooling, edge cases, and timeout scenarios
  • Updates jaction skill documentation with new API patterns and parallel execution examples

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
JActionExecutionContext.cs New internal class holding per-execution state for parallel execution support
JActionExecution.cs New result struct capturing per-execution cancellation state
JActionExecutionHandle.cs New awaitable handle with Cancel() for specific execution control
JAction.cs Refactored to use execution contexts instead of instance-level state
JActionAwaitable.cs Updated to work with execution contexts instead of JAction instances
JActionRunner.cs Updated to process execution contexts instead of JAction instances
JEngine.Util.asmdef Added UniTask dependency reference
JActionTests.cs Added JObjectPool tests and improved edge case coverage
JActionRuntimeTests.cs Added parallel execution, async function, and cancellation tests
MessageBox.cs Added test hooks for pool state inspection (UNITY_INCLUDE_TESTS only)
MessageBoxTests.cs Added comprehensive tests for button visibility, null handling, and concurrency
SKILL.md Updated with parallel execution patterns, return types, and troubleshooting guide

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

Address CodeQL warnings about potential missed Dispose() calls
by wrapping test code in try-finally blocks.

Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
- Fix Task.CompletedTask -> UniTask.CompletedTask
- Fix AsUniTask to delegate to awaiter (prevent double pool return)
- Fix Reset to return execution contexts to pool before clearing
- Fix MessageBox test hooks to use direct index access (avoid foreach)
- Add comment explaining PlayerLoop single-threading in parallel test

Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Copilot AI review requested due to automatic review settings January 30, 2026 06:34
github-actions[bot]
github-actions bot previously approved these changes Jan 30, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Copilot review found no issues and Unity Tests passed (or were skipped for non-code changes).

Convert try-finally patterns to 'using' declarations for cleaner
resource management as suggested by CodeQL static analysis.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
github-actions[bot]
github-actions bot previously approved these changes Jan 30, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Copilot review found no issues and Unity Tests passed (or were skipped for non-code changes).

@JasonXuDeveloper JasonXuDeveloper changed the title feat(util): add parallel execution support to JAction feat(util): add JAction parallel execution and improve test coverage Jan 30, 2026
Copy link

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 17 out of 17 changed files in this pull request and generated 11 comments.


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

HashSet does not support array indexing. Use LINQ First() method
to get the first element from the collection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Copilot review found no issues and Unity Tests passed (or were skipped for non-code changes).

@JasonXuDeveloper JasonXuDeveloper enabled auto-merge (squash) January 30, 2026 06:49
@JasonXuDeveloper JasonXuDeveloper merged commit 6be82f2 into master Jan 30, 2026
20 checks passed
@JasonXuDeveloper JasonXuDeveloper deleted the feat/jaction-parallel-and-test-coverage branch January 30, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation editor tests util

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants