Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds shared app-version parsing, SemVer comparison, skew evaluation, and user-facing descriptions. The server runtime payload now includes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/shared/app-version-skew.test.ts (1)
93-98: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression cases for malformed version components.
Extend the malformed-version test with cases such as
01.4.147,1.4.147-rc..1, and1.4.147-rc.01, assertingnull. This locks down the “unparseable versions remain unflagged” behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 94923ae1-1e4a-4f7b-a841-031dc164e104
📥 Commits
Reviewing files that changed from the base of the PR and between 94d3db4 and 1341408eaae76f4bd2dcbf028e8a15c38f66612e.
📒 Files selected for processing (6)
src/main/runtime/orca-runtime.tssrc/renderer/src/runtime/client-app-version.tssrc/renderer/src/store/slices/runtime-status.tssrc/shared/app-version-skew.test.tssrc/shared/app-version-skew.tssrc/shared/runtime-types.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 01b3072e-856e-4256-8ef5-d2816297a931
📥 Commits
Reviewing files that changed from the base of the PR and between 1341408eaae76f4bd2dcbf028e8a15c38f66612e and fb64fe2719ab3435ce20e8ab2bdce45cb13e76b9.
📒 Files selected for processing (4)
src/main/runtime/orca-runtime.tssrc/renderer/src/runtime/client-app-version.tssrc/shared/app-version-skew.test.tssrc/shared/app-version-skew.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/runtime/orca-runtime.ts
- src/renderer/src/runtime/client-app-version.ts
- src/shared/app-version-skew.test.ts
6922295 to
86d048b
Compare
| export async function buildRuntimeEnvironmentStatusEntry( | ||
| status: RuntimeStatus | null | ||
| ): Promise<RuntimeEnvironmentStatus> { | ||
| if (!status) { | ||
| return { status: null, checkedAt: Date.now() } | ||
| } | ||
| const clientAppVersion = await getClientAppVersion() | ||
| return { | ||
| status, | ||
| appVersion: status.appVersion ?? null, | ||
| versionSkew: evaluateAppVersionSkew({ | ||
| clientAppVersion, | ||
| serverAppVersion: status.appVersion ?? null | ||
| }), | ||
| checkedAt: Date.now() | ||
| } | ||
| } |
There was a problem hiding this comment.
checkedAt captured after async gap
Date.now() is called after await getClientAppVersion(), so on the very first probe (before the IPC version is cached) the recorded timestamp lags behind when the server status was actually received. Subsequent probes are near-instant (resolved promise microtask), but the first one can be off by the full IPC round-trip. Capturing checkedAt before the await — or at the top of the function — would faithfully represent when the status was fetched.
There was a problem hiding this comment.
Fixed in 1bf320f — checkedAt is now stamped at the top of buildRuntimeEnvironmentStatusEntry, before the version lookup, with a fake-timer test pinning it.
| export type AppVersionSkew = { | ||
| direction: AppVersionSkewDirection | ||
| clientAppVersion: string | ||
| /** null when the server predates app-version reporting in status.get. */ | ||
| serverAppVersion: string | null | ||
| } |
There was a problem hiding this comment.
serverAppVersion nullability not encoded in the type for server-newer
AppVersionSkew.serverAppVersion is string | null regardless of direction, but evaluateAppVersionSkew only produces direction: 'server-newer' when a parsed (non-null) server version string is available. describeAppVersionSkew relies on this invariant without a null check — if a caller constructs an AppVersionSkew with direction: 'server-newer' and serverAppVersion: null, the message will read "This Orca server (null) is newer…". A discriminated union makes the contract machine-checkable.
| export type AppVersionSkew = { | |
| direction: AppVersionSkewDirection | |
| clientAppVersion: string | |
| /** null when the server predates app-version reporting in status.get. */ | |
| serverAppVersion: string | null | |
| } | |
| export type AppVersionSkew = | |
| | { | |
| direction: 'server-older' | |
| clientAppVersion: string | |
| /** null when the server predates app-version reporting in status.get. */ | |
| serverAppVersion: string | null | |
| } | |
| | { | |
| direction: 'server-newer' | |
| clientAppVersion: string | |
| serverAppVersion: string | |
| } |
There was a problem hiding this comment.
Adopted in 1bf320f — AppVersionSkew is now a discriminated union; 'server-newer' requires a non-null serverAppVersion.
| return { | ||
| direction: diff < 0 ? 'server-older' : 'server-newer', | ||
| clientAppVersion: input.clientAppVersion!.trim(), | ||
| serverAppVersion: input.serverAppVersion!.trim() | ||
| } |
There was a problem hiding this comment.
Minor:
reportedServerVersion (already trimmed) is available in scope but the return statement re-trims input.serverAppVersion instead of reusing the local variable. These evaluate to the same string, but using reportedServerVersion removes the redundant operation and makes the relationship between the earlier guard and the returned value explicit.
| return { | |
| direction: diff < 0 ? 'server-older' : 'server-newer', | |
| clientAppVersion: input.clientAppVersion!.trim(), | |
| serverAppVersion: input.serverAppVersion!.trim() | |
| } | |
| return { | |
| direction: diff < 0 ? 'server-older' : 'server-newer', | |
| clientAppVersion: input.clientAppVersion!.trim(), | |
| serverAppVersion: reportedServerVersion | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Adopted in 1bf320f — both return arms reuse the trimmed locals.
Greptile SummaryAdds non-blocking client/server app-version skew detection to
Confidence Score: 4/5Safe to merge; the skew verdict is non-blocking and detection-only, so any edge-case misbehaviour is silent rather than user-facing. The core semver logic is sound and well-tested. Two small gaps: the AppVersionSkew type does not discriminate serverAppVersion nullability by direction, so describeAppVersionSkew on server-newer relies on an invariant the type system does not enforce. And checkedAt is stamped after the getClientAppVersion await, slightly misrepresenting when the server status was fetched on the first probe. Neither affects the skew verdict itself. Files Needing Attention: src/shared/app-version-skew.ts for the discriminated-union type gap and the redundant re-trim; src/renderer/src/store/slices/runtime-status.ts for the checkedAt timing.
|
| Filename | Overview |
|---|---|
| src/shared/app-version-skew.ts | New hand-rolled semver evaluator: parsing, comparison, and skew detection logic are correct; two minor issues — the AppVersionSkew type lacks a discriminated union that would make the server-newer/serverAppVersion non-null invariant machine-checkable, and the return block re-trims a variable already held as reportedServerVersion. |
| src/renderer/src/store/slices/runtime-status.ts | Adds buildRuntimeEnvironmentStatusEntry to centralize skew derivation on status ingestion; the one call site updated is refreshRuntimeEnvironmentStatus. Minor timing issue: checkedAt is stamped after await getClientAppVersion(), slightly overestimating the real check time on the first probe. |
| src/renderer/src/runtime/client-app-version.ts | New IPC wrapper that caches the client app version promise and correctly clears the cache on rejection so the next probe retries rather than skipping skew detection for the entire session. |
| src/shared/app-version-skew.test.ts | 14-case test suite covering skew directions, rc ordering, numeric prerelease magnitude, missing/unparseable versions, and build-metadata stripping. Comprehensive for the pure functions. |
| src/main/runtime/orca-runtime.ts | Adds appVersion field to the status response, reading from ORCA_APP_VERSION env var. The |
| src/shared/runtime-types.ts | Updates RuntimeStatus.appVersion from string |
Sequence Diagram
sequenceDiagram
participant Probe as refreshRuntimeEnvironmentStatus
participant Server as orca serve (main)
participant Builder as buildRuntimeEnvironmentStatusEntry
participant IPC as getClientAppVersion (IPC cache)
participant Eval as evaluateAppVersionSkew
participant Store as setRuntimeEnvironmentStatus
Probe->>Server: getStatus(environmentId)
Server-->>Probe: "RuntimeStatus { appVersion: string | null }"
Probe->>Builder: buildRuntimeEnvironmentStatusEntry(status)
Builder->>IPC: getClientAppVersion()
IPC-->>Builder: "clientAppVersion (string | null)"
Builder->>Eval: "evaluateAppVersionSkew({ clientAppVersion, serverAppVersion })"
Eval-->>Builder: "AppVersionSkew | null"
Builder-->>Probe: "RuntimeEnvironmentStatus { status, versionSkew, checkedAt }"
Probe->>Store: setRuntimeEnvironmentStatus(environmentId, entry)
Reviews (1): Last reviewed commit: "Reject unsafe-integer release segments a..." | Re-trigger Greptile
86d048b to
fb917d5
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/shared/app-version-skew.ts (1)
1-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCondense the implementation comments.
Several comments span multiple lines and restate adjacent code behavior. Keep only the non-obvious rationale, using one concise line per comment.
As per coding guidelines, comments must be concise, non-obvious, and brief.
Also applies to: 22-23, 29-30, 45-46, 57-58, 110-111, 120-121
Source: Coding guidelines
src/renderer/src/store/slices/runtime-status.ts (1)
23-25: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winMake the no-verdict value consistent.
The field comment documents
versionSkewasnullwhen the server is unreachable.buildRuntimeEnvironmentStatusEntry(null)omits the property at Line 37, and the refresh catch path does the same. This exposesundefined, notnull, for the same state. AddversionSkew: nullto failed-probe entries, or documentundefinedin the type and comment.Also applies to: 36-37
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9c18e373-7426-4136-a83b-bf79d9905cbb
📥 Commits
Reviewing files that changed from the base of the PR and between 1f86f98 and fb917d55e65f180c3e7ed369a49194350a4f2e3b.
📒 Files selected for processing (6)
src/main/runtime/orca-runtime.tssrc/renderer/src/runtime/client-app-version.tssrc/renderer/src/store/slices/runtime-status.tssrc/shared/app-version-skew.test.tssrc/shared/app-version-skew.tssrc/shared/runtime-types.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/shared/runtime-types.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/runtime/client-app-version.ts
- src/shared/app-version-skew.test.ts
Servers report appVersion in status.get; the renderer derives a non-blocking AppVersionSkew verdict when ingesting runtime status. UI surfacing stays in stablyai#9614. Split out of stablyai#9614.
…robe commits - Stamp checkedAt before the client-version lookup so it reflects when the server answered (greptile) - Bound the client-version IPC with a 2s race so a stalled preload can never delay or block publishing a live server status (coderabbit) - Drop probe results whose environment was removed or re-paired while the probe was in flight, keyed on tombstones + connection generation (coderabbit) - Make AppVersionSkew a discriminated union so 'server-newer' cannot carry a null serverAppVersion (greptile) - Reuse the already-trimmed reportedServerVersion in the skew result (greptile) - Split runtime-environment-status-entry.ts and runtime-disconnected-toast.ts out of runtime-status.ts to stay under the max-lines budget after the rebase Co-Authored-By: Claude Fable 5 <[email protected]>
fb917d5 to
1bf320f
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased onto current main and pushed review follow-ups: checkedAt stamped before the version lookup, the client-version IPC bounded by a 2s race so it can never delay publishing a live status, stale probe commits dropped via tombstone + connection-generation guards, AppVersionSkew converted to a discriminated union, and the trimmed locals reused. runtime-status.ts was split (status-entry construction and the disconnect toast moved to their own modules) to stay under the max-lines budget after the rebase. 47 focused tests pass; typecheck and lint clean. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1c018493-c431-4ab7-a954-362bb140aeab
📒 Files selected for processing (9)
src/main/runtime/orca-runtime.tssrc/renderer/src/runtime/client-app-version.tssrc/renderer/src/store/slices/runtime-disconnected-toast.tssrc/renderer/src/store/slices/runtime-environment-status-entry.tssrc/renderer/src/store/slices/runtime-status.test.tssrc/renderer/src/store/slices/runtime-status.tssrc/shared/app-version-skew.test.tssrc/shared/app-version-skew.tssrc/shared/runtime-types.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/shared/runtime-types.ts
- src/shared/app-version-skew.test.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/runtime/client-app-version.ts
…tatus A first probe can be in flight before any status entry exists; removal then tombstoned the id without advancing the generation, so a same-id re-add (which clears the tombstone) let the stale probe commit to the new pairing. Co-Authored-By: Claude Fable 5 <[email protected]>
Summary
Adds non-blocking client/server app-version skew detection.
orca servenow reports itsappVersioninstatus.get(read fromORCA_APP_VERSION, already stamped at startup inmain/index.ts), and the renderer derives anAppVersionSkewverdict (server-older/server-newer) whenever it ingests a runtime status, via a new shared, dependency-free semver-ish evaluator (src/shared/app-version-skew.ts). A reachable server that reports no version is provably older than any client evaluating it and is flagged as such; an unparseable version (custom build) stays silent. Before, protocol-compat only blocked truly incompatible pairs and mere app-version skew was invisible — a client that auto-updated ahead of its server hit missing-RPC failures with misleading downstream errors.The verdict is computed centrally in
buildRuntimeEnvironmentStatusEntry(store slice) so every status-ingestion path gets it for free. This PR is detection + plumbing only; the UI surfacing (sidebar host-header warning, proactive toast nudge, i18n strings) stays in #9614, which will be rebased down to that layer once this and #10235 land.Split out of #9614.
Tests: new
app-version-skew.test.ts(14 cases: skew directions, rc ordering, missing/unparseable versions, build metadata).pnpm typecheckand the test file green locally.Review starting point:
evaluateAppVersionSkewinsrc/shared/app-version-skew.ts, thenbuildRuntimeEnvironmentStatusEntryinsrc/renderer/src/store/slices/runtime-status.ts.cc @OrcaWin
ELI5
Detects when the desktop app version and orca serve version do not match and surfaces a non-blocking skew signal (server older or newer) so you know when to upgrade one side.