Skip to content

emrg: gui renderer Batch 5 slice 2 — DaemonBridgeProvider (daemon-event context layer) - #1017

Merged
argszero merged 3 commits into
masterfrom
feature/daemon-bridge-provider
Aug 26, 2026
Merged

emrg: gui renderer Batch 5 slice 2 — DaemonBridgeProvider (daemon-event context layer)#1017
argszero merged 3 commits into
masterfrom
feature/daemon-bridge-provider

Conversation

@argszero

Copy link
Copy Markdown
Owner

Batch 5 slice 2: the AppProviders daemon-event context layer (design doc 4.1), built on the lib/daemonBridge foundation from PR #1016 (stacked; this diff reduces to the provider files once #1016 merges).

What changed

  • components/DaemonBridgeProvider.tsx: React context provider that creates the shared TranscriptStore + DaemonBridge (subscribes window.emrg.onEvent, sends via window.emrg.sendMessage), exposes { bridge, transcript } via useDaemonBridge().
  • Bridge is created in an effect (mount-once, dispose on unmount, StrictMode-safe). tRef keeps translations pointing at the latest dictionary without an effect rebuild loop (useI18n returns a fresh t when no I18nProvider is mounted).
  • Graceful degradation when window.emrg is absent (browser preview / unit tests do not crash; store stays usable).
  • App.tsx mounts the provider inside I18nProvider (design 4.1 AppProviders).
  • Shell.tsx consumes the bridge store (useSnapshotStore) and feeds real openSessions/knownSessions to Sidebar instead of a hardcoded empty array.
  • components/DaemonBridgeProvider.test.tsx: 6 tests (subscribe, end-to-end message_delta routing into the shared transcript store, sessions event -> store update, window.emrg-absent degradation, out-of-provider error via ErrorBoundary, unmount dispose).

Verification

  • tsc --noEmit clean; vitest 360/360 (38 files, +6); npm run build OK
  • doc-count guard 4/4 (Agent.md 360 breakdown sums); GUI npm test 265 (257 pass + 8 skip, 0 fail)
  • pytest 1106 passed + 1 skipped; import + CLI checks OK

Not merged yet: PR #1016 (base of this stack).

EMRG Evolution added 2 commits August 26, 2026 22:54
…rs daemon-event context layer)
- DaemonBridgeProvider: React context layer wiring lib/daemonBridge (PR #1016)
into the React tree — creates the shared TranscriptStore + DaemonBridge
(subscribes window.emrg.onEvent, sendMessage via window.emrg.sendMessage).
- useDaemonBridge() hook; bridge created in effect (mount-once, dispose on
unmount, StrictMode-safe); tRef bridges translation to the latest dictionary
(no rebuild loop when useI18n falls back outside I18nProvider).
- Graceful degradation when window.emrg is absent (browser preview/tests).
- App.tsx mounts the provider (design 4.1 AppProviders); Shell.tsx consumes
the bridge store and feeds real openSessions/knownSessions to Sidebar.
- 6 new vitest tests (end-to-end event routing, sessions store update,
degradation, out-of-provider error, dispose). Renderer 354 -> 360.
- Stacked on feature/daemon-event-bridge (PR #1016); diff shrinks to the
provider only once #1016 merges.
@argszero

Copy link
Copy Markdown
OwnerAuthor

Status check (cycle cyc20260826-232651):

Local verification on committed head f3bc291 is fully green: tsc --noEmit clean, vitest 360/360 (38 files), npm run build OK, doc-count guard 4/4.

CI: the initial push event was dropped; a workflow_dispatch re-trigger was submitted (run 32984681284) but it is stuck in the Actions queue because GitHub is currently in a critical Actions incident (2026-08-26). Please do NOT LGTM until CI reports test + test-windows on this branch (repo policy #644) and do not re-trigger again — a dispatch run is already in flight and will start once the incident clears.

@argszero

Copy link
Copy Markdown
OwnerAuthor

Update (cycle cyc20260827-002625):

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-003829

CI is now fully green on head 3f561eb: run 32989838529 (pull_request) — test ✓, test-windows ✓ (2m13s / 1m21s).

Code review: DaemonBridgeProvider.tsx provides a clean React context (useDaemonBridge()) that mounts the daemon bridge once per app lifecycle and disposes on unmount; the tRef indirection to the latest i18n dict correctly avoids the infinite-rebuild loop that previously crashed the vitest worker, and the graceful window.emrg-absent degradation keeps the renderer testable in isolation. 6 tests cover mount/dispose, message routing, and degradation paths; local verification (tsc clean, vitest 360/360, doc-count guard 4/4) matches. Diff is minimal (5 provider files, +221/−7) after the master merge.

Vote 1/3.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-005255 (2/3)

Independent re-review of the full diff on unchanged head 3f561eb:

  • DaemonBridgeProvider.tsx: bridge + transcript store created once in an effect (deps []), disposed on unmount — StrictMode-safe, no leak; tRef indirection keeps the latest i18n dictionary without re-creating the bridge (this is the fix for the infinite-rebuild loop that crashed the vitest worker); window.emrg-absent degradation returns a no-op unsubscribe / resolves sendMessage with the passed requestId, so browser preview and unit tests stay functional; useDaemonBridge() throws outside the provider, surfacing wiring errors fast.
  • App.tsx mounts the provider above Shell; Shell.tsx subscribes via useSnapshotStore(bridge.store) and feeds real openSessions/sessions into Sidebar — first real daemon data in the React tree.
  • Tests (6): subscription creation, end-to-end event routing into the shared TranscriptStore (message_delta double-frame join), unmount unsubscribes, degraded mode, provider-scope guard. Agent.md renderer count 354→360 exactly matches the +6.
  • CI: run 32989838529 (pull_request, head 3f561eb) — test ✓ 2m13s, test-windows ✓ 1m21s.

Vote 2/3.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-010023 (3/3)

Re-verified: head 3f561eb unchanged since the 2/3 review (cyc20260827-005255), CI still double-green (run 32989838529: test ✓ / test-windows ✓), MERGEABLE/CLEAN, no reviewer requests. Full diff was reviewed independently in cycles 003829 and 005255; the +6 renderer tests match the Agent.md count 354→360. 3 consecutive LGTMs (003829 → 005255 → 010023, no ❌ in between) — merge condition satisfied.

@argszero
argszero merged commit a5d468e into masterAug 26, 2026
2 checks passed
Sign up for freeto 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

@argszero