Repository navigation
fix(main): harden window readiness and offline startup handling - #515
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR hardens Electron renderer-readiness tracking and service-worker failure handling while keeping the native title bar aligned with the renderer’s light-only palette.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains in the eligible follow-up review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| main/window-readiness.ts | Adds full-document main-frame navigation classification while retaining epoch, nonce, stale-frame, and fail-safe protections. |
| main/ipc.ts | Adds narrowly scoped early document registration with main-window, current-frame, origin, epoch, and nonce validation. |
| main/index.ts | Moves readiness resets to qualified navigation events, wires main-window lookup into IPC registration, and pins overlay creation to the light palette. |
| frontend/public/sw.js | Makes network and cache failure paths return valid responses, avoids caching failed startup responses, and advances the cache generation. |
| tests/window-readiness.test.ts | Extends regression coverage for navigation classification, stale readiness reports, reload invalidation, and fail-safe behavior. |
| tests/service-worker.test.cjs | Adds behavioral coverage for failed subresources, offline navigation, startup errors, cache cleanup, and API bypass behavior. |
Sequence Diagram
sequenceDiagram
participant Main as Electron main
participant Nav as WebContents navigation
participant Preload as Current preload
participant Renderer as Renderer UI
Main->>Main: beginRendererDocument()
Nav->>Main: did-start-navigation
alt full-document main-frame navigation
Main->>Main: advance epoch and clear nonce/readiness
else same-document or subframe navigation
Main->>Main: preserve current readiness
end
Preload->>Main: window-document(documentNonce)
Main->>Main: validate window, frame, origin, and nonce
Renderer->>Main: window-ready(epoch, documentNonce)
Main->>Main: validate current frame, epoch, and nonce
Main->>Renderer: show window
Reviews (2): Last reviewed commit: "no-mistakes(lint): Remove IPC any lint w..." | Re-trigger Greptile
…esetting readiness
khaira777
force-pushed
the
fm/flocafe-514-window-readiness-review-fix
branch
from
August 24, 2026 22:40
a7cf5fa to
5e370ce
Compare
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Synchronize and rebase green PR #515 onto the current main using the supported no-mistakes pipeline, rerun review, tests, documentation, lint, push, PR, and CI handling, and merge PR 515 only after it is green and mergeable. Preserve all corrected PR 514 scope and original changes, do not merge or close PR 514 until PR 515 is confirmed merged, then verify PR 515 contains all original PR 514 changes before closing PR 514 as superseded through the guarded project workflow. Do not use raw git push/merge/force operations or a competing validation run.
What Changed
Risk Assessment
Testing
Focused automated tests, real macOS Electron control/fullscreen behavior, browser/LAN Playwright checks, and reviewer-visible screenshots all succeeded. Generated build/dependency/test outputs were removed from the worktree. Native Windows/Linux runtime behavior was not rerun on this macOS host.
Evidence: macOS Electron runtime probe
SUMMARY | 14/14 checks passed PASS | minimize/maximize IPC round-trip PASS | fullscreen enter/exitEvidence: Live Electron renderer readiness observation
{"url":"http://localhost:3001/setup/","readySurface":true,"fallbackControls":true,"titleBarMode":"html-fallback","titleBarEpoch":2}~/.no-mistakes/evidence/01M0TW5PHCG093X5Y6GYNMJCRH/browser-pos-titlebar-boundary.png)~/.no-mistakes/evidence/01M0TW5PHCG093X5Y6GYNMJCRH/flocafe-runtime-ready.png)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
main/index.ts:464- The listener treats its first callback argument as navigation details, but Electron 43.4.1 emitsdid-start-navigationwith positional arguments(event, url, isSameDocument, isMainFrame, ...)(runtime source). ThereforeisFullDocumentMainFrameNavigation(details)receives the event object, returns false for every navigation, and never resets readiness on reloads. Bind the actual positional arguments or normalize the payload before calling the helper.🔧 Fix: Normalize Electron navigation arguments before resetting readiness
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
main/window-readiness.ts:60- One cold Electron launch logged the 10-second renderer readiness fail-safe for epoch 2. A subsequent instrumented launch mounted controls successfully and reload invalidation passed, so this appears transient but should be repeated on a clean first-run environment before claiming cold-start readiness is fully deterministic.npm ci --ignore-scriptsnpm run test:window-readinessnpm run test:service-workernpm run test:kds-window-hardeningnpm run test:titlebar-window-optionsnpm run test:electron-api-contractnpm run buildnpm run build:frontendnpx electron tests/platform-titlebar-runtime-probe.cjsLive Electron launch with CDP inspection of setup UI, readiness controls, epoch/nonce state, andpage.reload()invalidationscreencapturedesktop evidence capture🔧 Fix: Restored locked dependencies; readiness test now passes
✅ Re-checked - no issues remain.
npm run test:window-readinessnpm run test:titlebar-window-optionsnpm run test:electron-api-contractnpm run test:service-workernpm run test:kds-window-hardeningnpm run build./node_modules/.bin/electron tests/platform-titlebar-runtime-probe.cjs --fullscreen-checknpm run build:frontendnpm run test:e2e -- e2e/title-bar-platform.spec.tsInline Playwright authenticated POS capture and Electron-only DOM boundary checkscreencapture -x -T 1against the live Electron probeFinal clean-worktree and transient-output verification✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
main/ipc.ts:92- Focused ESLint passes with 0 errors, but main/ipc.ts retains 15 no-explicit-any warnings; this matches the base commit and needs broader IPC typing cleanup.🔧 Fix: Remove IPC any lint warnings
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.