Skip to content

Unify backend resolution + surface dropped stream frames#315

Merged
milanofthe merged 1 commit into
mainfrom
refactor/unify-backend-resolver
Jun 2, 2026
Merged

Unify backend resolution + surface dropped stream frames#315
milanofthe merged 1 commit into
mainfrom
refactor/unify-backend-resolver

Conversation

@milanofthe
Copy link
Copy Markdown
Member

Backend-layer cleanup (no behaviour change for the default Pyodide path).

  • One resolver. initBackendFromUrl() + autoDetectBackend() were both awaited at startup and could each independently switchBackend('flask') + init(). Replaced by a single resolveBackend() with clear precedence: URL ?backend=flask override → same-origin /api/health probe → Pyodide default. +page.svelte now calls the one function. The remote backend stub in the registry is kept (planned).
  • Surface dropped stream frames. Both backends silently swallowed JSON.parse failures on stream-data (// Ignore parse errors); now they emit a stderr note so a corrupt frame is visible instead of vanishing.
  • Drop dead isInitializing in PyodideBackend (set, never read).

svelte-check: 0 errors/0 warnings; production build (incl. worker) succeeds.

Note: deliberately did not lift the stream-message dispatch into AbstractBackend — the two implementations are subtly divergent (id-matching vs none; ordering of callback-vs-state-clear) in the streaming hot path, so the small dedup wasn't worth the regression risk.

@milanofthe milanofthe merged commit 446407c into main Jun 2, 2026
4 checks passed
@milanofthe milanofthe deleted the refactor/unify-backend-resolver branch June 2, 2026 14:12
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