Skip to content

feat(frontend): upload, depth, thresholds and slices in Svelte - #11

Merged
provos merged 2 commits into
mainfrom
codex/svelte-pr2-first-workflow
Sep 25, 2026
Merged

provos merged 2 commits into
mainfrom
codex/svelte-pr2-first-workflow

Conversation

@provos

@provos provos commented Sep 25, 2026

Copy link
Copy Markdown
Owner

PR 2 of the Dash → Svelte 5 migration: the first usable Svelte workflow, served at /next/ next to the unchanged Dash UI.

What works in Svelte

  • The app shell matches the Dash layout (see docs/svelte-migration/reference/): header, theme toggle, 2D/3D and main tabs, log pane (last 3 lines) and footer.
  • Uploading an image creates a project and immediately starts a depth job, with a progress bar. The Mode tab has the depth map, the depth-model select (same options, default DINOv2), Regenerate, and the mode selector.
  • Segmentation tab: threshold sliders send the full interior values plus baseRevision and retry once on stale_revision. Generate runs the slices job; the slice strip shows the depth overlay and image_slice_N labels.
  • Configuration tab: slice count and legacy Load State (restore).
  • Controls are disabled while busy, and API errors appear in the log pane.

Tests

  • SvelteDriver plus a svelte Playwright project. The shared scenario 1 (upload → deterministic depth → three slices with exact pixel signatures) now passes on both UIs; scenarios the Svelte UI doesn't support yet are skipped via requireWorkflow.
  • pretest:e2e builds the frontend so Playwright always serves the current code.
  • vitest: 28 tests (workflow orchestration, stale-revision retry, busy state, slice strip).

Known differences (tracked for later PRs)

  • The theme doesn't switch on restore (the API doesn't project dark_mode yet; that's project-lifecycle work).
  • Threshold sliders show no value tooltips; the theme toggle is a switch rather than Dash's pill.
  • Actions other than Generate, and the Inpainting/Export tabs, are placeholders.

Verification (local, after rebasing onto #10)

  • svelte-check 0/0; vitest 28 passed; npm run check:e2e clean
  • pytest -o addopts='' -q: 296 passed
  • npm run test:e2e: 12 passed (Dash 11 + Svelte 1), 10 skipped (Svelte, not yet supported)
  • Visual comparison at 1440 and 1024 wide against the Dash reference screenshots

🤖 Generated with Claude Code

First usable Svelte workflow at /next/, matching the Dash layout:
- App shell (header, theme toggle, viewer/main tabs, log pane, footer).
- Upload starts a depth job; Mode tab with depth map, model selection,
  regenerate and progress; Segmentation tab with threshold sliders
  (baseRevision, one stale-revision retry), Generate and the slice strip;
  Configuration tab with slice count and legacy Load State.
- Busy-aware controls; API errors surface in the log pane.
- SvelteDriver + `svelte` Playwright project (supports
  upload-depth-slices); `pretest:e2e` builds the frontend first.
- Dash reference screenshots for layout parity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 25, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The current dark-mode implementation toggles dark on #app-container while theme tokens switch on :root.dark, so the theme toggle will not activate the dark theme as intended.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity

Open (3)
What changed in this PR

This PR advances the Dash → Svelte 5 migration by implementing the first end-to-end usable Svelte workflow (upload → depth → thresholds → slice generation) and wiring it into the existing shared E2E harness via a new Svelte UiDriver.

Changes:

  • Add a Svelte workflow orchestrator (workflow.ts) plus client-side stores for UI state, job/busy tracking, and log merging.
  • Implement Svelte UI tabs/components for upload, depth controls/progress, thresholds + slice strip, and basic configuration/restore.
  • Extend Playwright E2E to run the shared scenarios against Svelte by adding a svelte project and a SvelteDriver, plus new vitest coverage.
File Description
package.json Runs build:frontend automatically before test:e2e so Playwright serves current Svelte build.
frontend/​src/​lib/​workflow.ts Central orchestration layer for API calls + stores (busy, logs, revision-guarded project view).
frontend/​src/​lib/​workflow.test.ts Unit tests for workflow orchestration (upload→depth, slices polling, error logging).
frontend/​src/​lib/​state/​ui.svelte.ts Client-only UI state store (tabs, theme, depth model, pending slice count).
frontend/​src/​lib/​state/​logs.svelte.ts Log store merging server logs with client-side error entries.
frontend/​src/​lib/​state/​jobs.svelte.ts Local in-flight job tracker for immediate disabling/progress.
frontend/​src/​lib/​state/​busy.svelte.ts Combines local job activity + server ProjectView.busy to gate mutations.
frontend/​src/​lib/​components/​upload/​ViewerTabs.svelte 2D/3D viewer tab strip and 2D upload panel mounting.
frontend/​src/​lib/​components/​upload/​InputImagePanel.svelte Upload/drag-drop panel and file input wiring to workflow upload.
frontend/​src/​lib/​components/​shell/​MainTabs.svelte Workflow tab strip; keeps all tabs mounted to match Dash/E2E expectations.
frontend/​src/​lib/​components/​shell/​LogPanel.svelte Renders last 3 log entries with error styling.
frontend/​src/​lib/​components/​shell/​Header.svelte App header with theme toggle control.
frontend/​src/​lib/​components/​shell/​Footer.svelte Footer parity with Dash reference.
frontend/​src/​lib/​components/​shared/​TabPlaceholder.svelte Placeholder for not-yet-implemented tabs.
frontend/​src/​lib/​components/​segmentation/​SegmentationTab.test.ts Component tests for thumbnails, busy disabling, stale-revision retry behavior.
frontend/​src/​lib/​components/​segmentation/​SegmentationTab.svelte Threshold sliders, action buttons (Generate wired), and slice strip UI.
frontend/​src/​lib/​components/​depth/​ModeTab.svelte Depth view, model selector, regenerate button, and progress bar.
frontend/​src/​lib/​components/​config/​ConfigurationTab.svelte Slice-count control + legacy restore input.
frontend/​src/​App.test.ts App-level tests for shell rendering and upload→depth rendering.
frontend/​src/​App.svelte Composes the new shell (header/main/log/footer) for /next/ app.
frontend/​src/​app.css Adds shared “Dash look-alike” classes and depth-number theme token.
e2e/​playwright.config.ts Adds a svelte Playwright project to run shared scenarios against Svelte UI.
e2e/​fixtures.ts Wires uiTarget: 'svelte' to instantiate the new SvelteDriver.
e2e/​drivers/​svelte.ts Implements the Svelte-specific UiDriver adapter for the supported workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread e2e/drivers/svelte.ts
Comment on lines +114 to +119
const previousTab = await this.activeMainTab();
await this.openTab('Segmentation');
await expect(slices).toHaveCount(3);
if (previousTab && previousTab !== 'Segmentation') {
await this.openTab(previousTab);
}
Comment thread frontend/src/App.svelte
{/if}
</p>
</header>
<div id="app-container" class="app-root" class:dark={uiStore.theme === 'dark'}>
Comment on lines +51 to +56
<div
class="drop-zone panel"
class:dragging
role="button"
tabindex="0"
data-testid="input-image-panel"
… drop-zone label

Address review: theme tokens switch on :root.dark, so toggle the class on
document.documentElement (with a component test); SvelteDriver's restore
returns to the Mode tab too (MainTab now includes 'Mode'); the upload
drop zone has an accessible name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@provos
provos merged commit 5e35fe8 into main Sep 25, 2026
1 check passed
@provos
provos deleted the codex/svelte-pr2-first-workflow branch September 25, 2026 15:38
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.

2 participants