Repository navigation
chore: Compile result session state uses a dedicated repository - #1532
Conversation
Move compile-result SessionState storage behind a dedicated domain repository port and infrastructure implementation. Keep UnityCliLoopEditorSessionStateService as a transitional delegate for this series while removing the raw compile-result KV methods from the broad session-state port.
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR extracts compile-result session persistence into a new ChangesCompile-result repository extraction
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Registration as UnityCliLoopApplicationRegistration
participant Service as UnityCliLoopEditorSessionStateService
participant CompileRepo as UnityCliLoopCompileResultSessionRepository
participant Session as SessionState
Registration->>CompileRepo: new UnityCliLoopCompileResultSessionRepository()
Registration->>Service: new UnityCliLoopEditorSessionStateService(sessionStateRepository, compileRepo)
Service->>CompileRepo: StoreCompileResult(requestId, forceRecompile, resultJson, completedAtUtc)
CompileRepo->>Session: write per-request keys + index
Service->>CompileRepo: GetStoredCompileResult()
CompileRepo->>Session: read index and per-request keys
CompileRepo-->>Service: UnityCliLoopStoredCompileResult
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs (1)
332-425: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicate index/ticks-parsing logic vs.
UnityCliLoopEditorSessionStateService.
ParseUtcTicks,ParseRequestIdIndex,FormatRequestIdIndex,AddRequestIdToIndex, andRemoveRequestIdFromIndexhere are identical to the private static helpers still inUnityCliLoopEditorSessionStateService.cs(used for pending-compile indexing). The split introduced this duplication; extracting a small shared utility (e.g. aRequestIdIndexCodecin Domain, referenced by both Domain and Infrastructure) would avoid future divergence between the two copies.🤖 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/UnityCliLoopCompileResultSessionRepository.cs` around lines 332 - 425, The helper methods for ticks/request-id index parsing are duplicated between this repository class and UnityCliLoopEditorSessionStateService, so move the shared logic into one reusable utility and have both call it. Extract ParseUtcTicks, ParseRequestIdIndex, FormatRequestIdIndex, AddRequestIdToIndex, and RemoveRequestIdFromIndex into a common helper such as RequestIdIndexCodec (or equivalent shared service), then update UnityCliLoopCompileResultSessionRepository to use that shared implementation instead of maintaining a second copy.
🤖 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
`@Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs`:
- Around line 332-425: The helper methods for ticks/request-id index parsing are
duplicated between this repository class and
UnityCliLoopEditorSessionStateService, so move the shared logic into one
reusable utility and have both call it. Extract ParseUtcTicks,
ParseRequestIdIndex, FormatRequestIdIndex, AddRequestIdToIndex, and
RemoveRequestIdFromIndex into a common helper such as RequestIdIndexCodec (or
equivalent shared service), then update
UnityCliLoopCompileResultSessionRepository to use that shared implementation
instead of maintaining a second copy.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f8d40ac3-d70e-4e85-aa71-a239094a3f7c
⛔ Files ignored due to path filters (2)
Packages/src/Editor/Domain/ICompileResultSessionRepository.cs.metais excluded by none and included by nonePackages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs.metais excluded by none and included by none
📒 Files selected for processing (8)
Assets/Tests/Editor/OnionAssemblyDependencyTests.csAssets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.csAssets/Tests/Editor/UnityCliLoopEditorSessionStateTestFactory.csPackages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.csPackages/src/Editor/Domain/ICompileResultSessionRepository.csPackages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.csPackages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.csPackages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs
There was a problem hiding this comment.
1 issue found across 10 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs">
<violation number="1" location="Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs:58">
P2: Compile status reads for unknown request IDs now mutate SessionState, because `GetCompileResult` clears storage on miss. This can create unnecessary persistent key churn from polling inputs; returning `None()` directly on miss avoids side effects.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| return legacyResult; | ||
| } | ||
|
|
||
| ClearCompileResultForRequestId(requestId); |
There was a problem hiding this comment.
P2: Compile status reads for unknown request IDs now mutate SessionState, because GetCompileResult clears storage on miss. This can create unnecessary persistent key churn from polling inputs; returning None() directly on miss avoids side effects.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Packages/src/Editor/Infrastructure/Settings/UnityCliLoopCompileResultSessionRepository.cs, line 58:
<comment>Compile status reads for unknown request IDs now mutate SessionState, because `GetCompileResult` clears storage on miss. This can create unnecessary persistent key churn from polling inputs; returning `None()` directly on miss avoids side effects.</comment>
<file context>
@@ -0,0 +1,452 @@
+ return legacyResult;
+ }
+
+ ClearCompileResultForRequestId(requestId);
+ return UnityCliLoopStoredCompileResult.None();
+ }
</file context>
There was a problem hiding this comment.
This clear-on-miss behavior is not introduced by this PR — it is a verbatim move of the pre-existing implementation. On the base branch, UnityCliLoopEditorSessionStateService.GetCompileResult (origin/v3-beta, lines 391-423) performs the identical ClearCompileResultForRequestId(requestId) on the same two miss paths (missing json and malformed ticks). That cleanup is the deliberate self-heal mechanism for partial or corrupt entries and their index bookkeeping. This PR is a behavior-preserving extraction of compile-result persistence into a dedicated repository; changing the miss semantics here would violate the PR's no-behavior-change scope. If the read-mutates-on-miss pattern should be revisited, that belongs in a separate behavior-change PR, not this mechanical split.
There was a problem hiding this comment.
The parent comment was wrong for this PR: the miss cleanup already existed in UnityCliLoopEditorSessionStateService.GetCompileResult, and this change just moved that behavior into UnityCliLoopCompileResultSessionRepository while keeping the no-behavior-change scope intact. If the read-mutate-on-miss semantics should change, that needs a separate behavior-change PR.
Route legacy compile-result migration through StoreCompileResult so the migration path stays aligned with normal aggregate persistence, and clear legacy keys through the same wrappers used elsewhere.
Summary
User Impact
Changes
Verification