Skip to content

refactor(t096): arch + reliability hardening sweep (15 verified fixes)#10

Merged
duongdev merged 11 commits into
mainfrom
refactor/t096-arch-refactor-sweep
Jun 20, 2026
Merged

refactor(t096): arch + reliability hardening sweep (15 verified fixes)#10
duongdev merged 11 commits into
mainfrom
refactor/t096-arch-refactor-sweep

Conversation

@duongdev

Copy link
Copy Markdown
Owner

Investigation + refactoring sweep from /predict-issues + /improve-codebase-architecture, then adversarial verification of every finding against the real code. Verification refuted 17/20 predicted issues and 4/7 deepening candidates as already-mitigated (existing caps, watchdogs, guards) — this PR lands the genuinely-actionable remainder: 15 fixes, all evidence-checked.

Task: docs/tasks/096-investigate-for-arch-and-refactoring-predict-issue.md
ADR: docs/adr/0015-prefer-thin-handlers-over-reducer-indirection.md

What's in it

Reliability hardening

  • Side-channel cdpCall timeout + reject-on-close; reap of hung CONNECTING sockets (P4/P3)
  • Settings writeFileSync guarded in both backends (P15)
  • Per-send push badge recomputed from a fresh list, not a stale snapshot (P7)
  • Adaptive paint-ack watchdog window (EWMA of paint latency, floor 1s/cap 5s) so a slow device isn't tripped early (P2)
  • Closed-tab stack capped at 50 (P18); Slack sweep triggers debounced per-workspace (A6)
  • Electron onSwipe now returns an unsubscribe — fixes a per-reconnect listener leak (P6)
  • find() rejection caught; command-palette run() guarded with a failure toast (P11/P19)

Architecture / locality

  • Extracted createWsChannel / createInputChannel / createReconnectDriver out of the 1419-line cdp-web-transport.ts (now 970) into own files — WS channel went from 0 to 8 isolated tests (A5)
  • Notification handlers route through one optimistic-mutate helper that reverts on a failed POST (A2)
  • applyNextActive dedupes the close/switch tail; phoneView + readerEntry folded into one discriminated union (A1/A7)
  • Settings dialog's dual getUiState load merged to one (A3); full useSettings consolidation spilled to t097 (needs visual review)

Per ADR-0015, the reducer/event-bus "deepening" proposals (A1/A2/A4/A6) were deliberately not built — the orchestration was already concentrated behind a seam, so small helpers were the right call.

Testing

Automated gates all green: pnpm typecheck, pnpm test (936), pnpm test:e2e (43), pnpm build, node --check on all 3 backends, pnpm check:changed (0 errors). New TDD coverage for closed-tabs cap, sweep-scheduler, paint-ack-pacer, side-channel reap/timeout, ws-channel, input-channel.

HITL pending (needs the iPad / live Remote Browser / Electron app)

  • Layer-2 smoke: P6 (swipe×reconnect), P15 (unwritable settings), P4 (stalled cred socket), P3 (hung side-channel reap), P7 (push-while-marking badge)
  • Layer-3 visual: A7 (phone reader nav), A3 (settings cards persist), P19 (palette toast)
  • App-boot check (preload.js / main.js)

Opening for the per-branch preview deploy to run these on-device.

@dokploy-2026-03-01-6ei3s7

dokploy-2026-03-01-6ei3s7 Bot commented Jun 20, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
cdp-browser-app ✅ Done Preview URL 2026-06-20T08:08:14.034Z

@duongdev duongdev merged commit f0a456a into main Jun 20, 2026
3 checks passed
@duongdev duongdev deleted the refactor/t096-arch-refactor-sweep branch June 20, 2026 08:24
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