Skip to content

fix(lifecycle): serialize Gnirehtet start/stop and isolate stale child exits (#53) - #55

Draft
man612 wants to merge 6 commits into
mainfrom
fix/issue53-gnirehtet-lifecycle-20261024
Draft

man612 wants to merge 6 commits into
mainfrom
fix/issue53-gnirehtet-lifecycle-20261024

Conversation

@man612

@man612 man612 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

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

  • 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.
  • This lifecycle issue is not a proven cause of the unrelated 15–57-second startup anomaly Investigate intermittent blank renderer on local Windows Electron preview #44.

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.

man612 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

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.

man612 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

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.

man612 commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

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.

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