You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(lifecycle): serialize Gnirehtet start/stop and isolate stale child exits (#53) - #55
Fixes three source-level Gnirehtet lifecycle races tracked in issue #53, separate from UX #50, startup diagnostics #51, Tauri #52, and documentation-only audit #54.
Changes
Single-flight startPromise ensures concurrent Start calls share one launch instead of creating untracked duplicate child processes.
Stop invalidates the generation of a pending Start; the ADB readiness await is followed by a cancellation check immediately before native spawn.
Single-flight stopPromise ensures concurrent Stop callers await the real cleanup outcome, not premature success.
An old child close/error cannot trigger cleanup or status transitions for the new relay. Unexpected-exit cleanup must finish before a replacement autorun relay spawns.
Fail-closed native process timeout: if the child does not confirm exit after the existing 2s wait, the service reports failure, retains its child reference, and blocks replacement until the old process eventually closes.
5 deterministic Vitest cases added to gnirehtetService.scenario.test.ts; agent handoff and validation checkpoint added. No ADB/Gnirehtet binary updates, package changes, global ADB actions, Windows user profile changes, or merges.
Evidence vs unverified
Offline logical validation:5/5 PASS, exercising actual freshly fetched source method bodies (with TS method signatures stripped) against mock child events and manually controlled ADB promises. Verifies schedules for two Start calls, Stop-during-Start, Stop timeout, cleanup awaiting and concurrent Stop.
NOT RUN ON THIS NEW BRANCH: native npm run typecheck, Vitest, lint, build, Windows Electron/NSIS launch, physical Android USB/VPN/Gnirehtet/RX/TX checks. The Windows device is expected offline until roughly Tuesday 2026-10-27 09:00 WIB; actual availability unknown. These tests are mandatory before recommending merge or release.
Review state: Keep DRAFT. Do not merge, publish, change dependencies, stress the user's machine, or infer hardware parity from mock results. Stop timeout now intentionally changes error semantics; validate exact native child-exit behavior in isolation before this can be approved.
Related but separate ADB-service remediation: issue #56 / Draft PR #57. It masks relevant device IDs in ADB warnings and changes stopAllClients()'s numeric result to count acknowledged force-stop command successes rather than attempted clients. This does not confirm the Android VPN ended and does not solve lifecycle issue #53. The PR #57 diff has no gnirehtetService.ts edits; source/behaviour integration and native Windows/USB tests remain required after any authorized combination. No merge has been performed.
2026-10-25 cross-PR integration warning: issue #58 / Draft PR #59 now proposes masked Gnirehtet native stdout/stderr logs with per-child/per-stream line buffering and redacted per-device IPC error responses. Same-file overlap with this lifecycle PR in src/main/services/gnirehtetService.ts, especially attachProcessEvents(), startDevice(), stopDevice() and log status/error methods. If integration is later approved, preserve PR #55 lifecycle generation and old-child cleanup protections and PR #59 buffering/redaction; do not take either entire file. Only isolated JS checks exist for #59 (16 helper + 9 method), no native test/hardware QA yet. Both remain Draft. No branch merge occurred.
2026-10-28 cross-branch CI integration now available: Draft PR #63, based on current main d282ed6, explicitly combines this PR #55's generation/single-flight/fail-closed native process lifecycle with PR #59's per-child stdout/stderr buffers and device ID redaction. Exact integration head 62d0a8003f62244467eb123e70cb00a8ef01a470 passed hosted Windows CI run 40624716806: lint, typecheck, 62/62 Vitest (including 14 Gnirehtet scenarios + six privacy helper tests), build and package smoke. Both original PR #55 and #59 remain Draft and UNMERGED. No genuine native Gnirehtet child timeout/retry or physical Android VPN/TUN RX/TX validation; the integrated PR #63 is intentionally Draft and not release-ready. Do not replace the entire gnirehtetService.ts from either source branch during later integration.
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
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.
Scope
Fixes three source-level Gnirehtet lifecycle races tracked in issue #53, separate from UX #50, startup diagnostics #51, Tauri #52, and documentation-only audit #54.
Changes
startPromiseensures concurrent Start calls share one launch instead of creating untracked duplicate child processes.stopPromiseensures concurrent Stop callers await the real cleanup outcome, not premature success.gnirehtetService.scenario.test.ts; agent handoff and validation checkpoint added. No ADB/Gnirehtet binary updates, package changes, global ADB actions, Windows user profile changes, or merges.Evidence vs unverified
npm run typecheck, Vitest, lint, build, Windows Electron/NSIS launch, physical Android USB/VPN/Gnirehtet/RX/TX checks. The Windows device is expected offline until roughly Tuesday 2026-10-27 09:00 WIB; actual availability unknown. These tests are mandatory before recommending merge or release.Full issue53 fix QA and safety checkpoint and original independent audit.
Review state: Keep DRAFT. Do not merge, publish, change dependencies, stress the user's machine, or infer hardware parity from mock results. Stop timeout now intentionally changes error semantics; validate exact native child-exit behavior in isolation before this can be approved.