Skip to content

chore: Pending compile session state uses a dedicated repository - #1533

Merged
hatayama merged 2 commits into
v3-betafrom
codex/c4-5d-pending-compile-session-repository
Jul 6, 2026
Merged

hatayama merged 2 commits into
v3-betafrom
codex/c4-5d-pending-compile-session-repository

Conversation

@hatayama

@hatayama hatayama commented Jul 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Pending compile recovery state is now stored behind a dedicated Domain repository port.
  • Compile-result and pending-compile repositories share the SessionState key/index/ticks helper instead of duplicating a third persistence helper copy.

Changes

  • Added IPendingCompileSessionRepository and UnityCliLoopPendingCompileSessionRepository.
  • Kept UnityCliLoopEditorSessionStateService public API stable by delegating pending compile methods to the new repository; service delegation is transitional and will be removed in the final PR of this C4-5d series.
  • Moved shared SessionState key prefix, request-id index formatting, ticks parsing, and primitive access into an internal Infrastructure helper used by both compile-result and pending-compile repositories.
  • Removed pending compile raw KV methods from IUnityCliLoopEditorSessionStatePort and UnityCliLoopEditorSessionStateRepository.
  • Kept reloadObserved in the PendingCompile aggregate because it records whether a specific pending compile request has crossed Domain Reload, not an independent session flag.

Verification

  • dist/darwin-arm64/uloop compile --project-path <PROJECT_ROOT> => 0 errors / 0 warnings
  • dist/darwin-arm64/uloop run-tests --project-path <PROJECT_ROOT> --test-mode EditMode --filter-type regex --filter-value "(UnityCliLoopEditorSessionStateRepositoryTests|CompileStatusBridgeCommandTests|CompileSessionResultServiceTests|OnionAssemblyDependencyTests|StaticFacadeStateGuardTests)" => 128 passed

Add a pending compile session repository behind a Domain port and share SessionState key/index helpers with the compile-result repository so the transition avoids a third persistence helper copy.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74dabd42-ce57-4ed4-88df-158057c932ed

📥 Commits

Reviewing files that changed from the base of the PR and between fde413b and 6140b63.

📒 Files selected for processing (5)
  • Assets/Tests/Editor/UnityCliLoopEditorSessionStateTestFactory.cs
  • Packages/src/Editor/Domain/IPendingCompileSessionRepository.cs
  • Packages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPendingCompileSessionRepository.cs
📝 Walkthrough

Walkthrough

Pending compile request persistence is extracted from UnityCliLoopEditorSessionStateRepository/service port into a new IPendingCompileSessionRepository interface and its UnityCliLoopPendingCompileSessionRepository implementation. A new UnityCliLoopEditorSessionStateStorage utility centralizes SessionState key/parsing helpers, adopted by both the new repository and the existing compile-result repository. Composition root, service constructor, factory, and tests updated accordingly.

Changes

Pending Compile Session Repository Extraction

Layer / File(s) Summary
Pending compile contract
Packages/src/Editor/Domain/IPendingCompileSessionRepository.cs
New interface defines store/get/mark/clear operations for pending compile requests.
Shared SessionState storage utility
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateStorage.cs
New utility centralizes key formatting, UTC tick parsing, request-id index parsing/mutation, and typed SessionState get/set wrappers.
Pending compile repository implementation
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPendingCompileSessionRepository.cs
New repository persists pending compile requests per-request, retrieves/clears them, marks reload-observed, and migrates legacy fields, using the storage utility.
Session state service refactor
Packages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.cs
Service gains a pending-compile repository dependency and delegates all pending compile APIs to it; the port interface drops pending-compile members entirely.
Session state repository cleanup
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs
Pending-compile accessor/mutator methods and their key helper are removed; class doc scoped to runtime flags.
Compile-result repository migration
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs
Compile-result storage switches to using the shared storage utility for keys, index handling, tick parsing, and get/set, removing local duplicate helpers.
Wiring and tests
Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs, Assets/Tests/Editor/UnityCliLoopEditorSessionStateTestFactory.cs, Assets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.cs, Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
Composition root and test factory construct services with the new pending-compile repository; existing tests updated to use it; a new onion-assembly test asserts the interface lives in the domain assembly.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Registration as UnityCliLoopApplicationRegistration
  participant Service as UnityCliLoopEditorSessionStateService
  participant PendingRepo as UnityCliLoopPendingCompileSessionRepository
  participant Storage as UnityCliLoopEditorSessionStateStorage

  Registration->>PendingRepo: new UnityCliLoopPendingCompileSessionRepository()
  Registration->>Service: new UnityCliLoopEditorSessionStateService(sessionStatePort, compileResultRepo, pendingRepo)
  Service->>PendingRepo: StorePendingCompileRequest(requestId, forceRecompile, expiresAtUtcTicks, reloadObserved)
  PendingRepo->>Storage: AddRequestIdToIndex / SetString / SetBool
  Service->>PendingRepo: GetPendingCompileRequestForRequestId(requestId)
  PendingRepo->>Storage: ParseUtcTicks / GetString / GetBool
  Storage-->>PendingRepo: parsed values
  PendingRepo-->>Service: UnityCliLoopPendingCompileRequest
  Service->>PendingRepo: ClearExpiredPendingCompileRequest(utcNow)
  PendingRepo->>Storage: RemoveRequestIdFromIndex
Loading

Possibly related PRs

  • hatayama/unity-cli-loop#1166: Both PRs modify UnityCliLoopEditorSessionStateService/port and UnityCliLoopApplicationRegistration wiring, related to the same service construction chain.
  • hatayama/unity-cli-loop#1240: Both PRs refactor pending-compile-request SessionState persistence and recovery logic in the editor-domain layer.
  • hatayama/unity-cli-loop#1512: Both PRs change composition-root wiring around UnityCliLoopEditorSessionStateService construction/registration.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving pending compile session state to a dedicated repository.
Description check ✅ Passed The description accurately describes the repository extraction, shared helper refactor, and transitional delegation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/c4-5d-pending-compile-session-repository

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
Assets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.cs (1)

218-222: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the test factory instead of manual construction.

Every other test in this file recreates the service via UnityCliLoopEditorSessionStateTestFactory.CreateService(); this test constructs it manually with all three repositories, duplicating the factory's logic and risking drift if the constructor signature changes again.

♻️ Proposed refactor
-            UnityCliLoopEditorSessionStateService recreatedService =
-                new UnityCliLoopEditorSessionStateService(
-                    new UnityCliLoopEditorSessionStateRepository(),
-                    new UnityCliLoopCompileResultSessionRepository(),
-                    new UnityCliLoopPendingCompileSessionRepository());
+            UnityCliLoopEditorSessionStateService recreatedService =
+                UnityCliLoopEditorSessionStateTestFactory.CreateService();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Assets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.cs` around
lines 218 - 222, Replace the manual recreation of
UnityCliLoopEditorSessionStateService in this test with
UnityCliLoopEditorSessionStateTestFactory.CreateService() so it matches the rest
of the file and centralizes construction logic. Update the test to use the
existing factory instead of directly instantiating
UnityCliLoopEditorSessionStateRepository,
UnityCliLoopCompileResultSessionRepository, and
UnityCliLoopPendingCompileSessionRepository, keeping the setup consistent if the
service constructor changes.
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs (1)

112-120: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the unused GetString/SetString helpers. UnityCliLoopEditorSessionStateRepository no longer uses them, so they’re dead code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs`
around lines 112 - 120, Remove the dead helper methods GetString and SetString
from UnityCliLoopEditorSessionStateRepository since they are no longer
referenced anywhere in the class. Update the repository implementation to rely
only on the remaining SessionState usage, and make sure no callers depend on
these private helpers before deleting them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Assets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.cs`:
- Around line 218-222: Replace the manual recreation of
UnityCliLoopEditorSessionStateService in this test with
UnityCliLoopEditorSessionStateTestFactory.CreateService() so it matches the rest
of the file and centralizes construction logic. Update the test to use the
existing factory instead of directly instantiating
UnityCliLoopEditorSessionStateRepository,
UnityCliLoopCompileResultSessionRepository, and
UnityCliLoopPendingCompileSessionRepository, keeping the setup consistent if the
service constructor changes.

In
`@Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs`:
- Around line 112-120: Remove the dead helper methods GetString and SetString
from UnityCliLoopEditorSessionStateRepository since they are no longer
referenced anywhere in the class. Update the repository implementation to rely
only on the remaining SessionState usage, and make sure no callers depend on
these private helpers before deleting them.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 63d90568-0e28-4f88-baf5-5d0bba127959

📥 Commits

Reviewing files that changed from the base of the PR and between 1ac55d6 and fde413b.

⛔ Files ignored due to path filters (3)
  • Packages/src/Editor/Domain/IPendingCompileSessionRepository.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateStorage.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPendingCompileSessionRepository.cs.meta is excluded by none and included by none
📒 Files selected for processing (10)
  • Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
  • Assets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.cs
  • Assets/Tests/Editor/UnityCliLoopEditorSessionStateTestFactory.cs
  • Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs
  • Packages/src/Editor/Domain/IPendingCompileSessionRepository.cs
  • Packages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateStorage.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPendingCompileSessionRepository.cs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 13 files

Re-trigger cubic

@hatayama
hatayama merged commit 4f55cdc into v3-beta Jul 6, 2026
10 checks passed
@hatayama
hatayama deleted the codex/c4-5d-pending-compile-session-repository branch July 6, 2026 01:55
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.

1 participant