Skip to content

Multi-source Phase C2: onboarding wizard — populate-vs-empty + deep-history choice (#98)#101

Open
jozef2svrcek wants to merge 3 commits into
multi-source-c3-activity-autosyncfrom
multi-source-c2-onboarding-wizard
Open

Multi-source Phase C2: onboarding wizard — populate-vs-empty + deep-history choice (#98)#101
jozef2svrcek wants to merge 3 commits into
multi-source-c3-activity-autosyncfrom
multi-source-c2-onboarding-wizard

Conversation

@jozef2svrcek

Copy link
Copy Markdown
Contributor

Phase C2 of multi-source (#40). Redesigns the setup wizard's source step per the locked design: onboarding stays a simple binary, with all per-source detail deferred to Maintenance → Sources (C1, #97).

What changed (SetupWizard.tsx, client-only)

Replaces the inline "download + import TWIC with a progress bar" step with a Sources step:

  • Binary choicePopulate the reference database (recommended) vs Start with an empty database.
  • Populate path:
    • Currency: TWIC + Lichess Broadcasts auto-selected (the auto-updating feeds).
    • Deep history: Free (the bulk archive — currently Ajedrez OTB) · I own a commercial DB (reuses the existing AddGameDialog local PGN import path — no new backend) · None.
    • One acknowledgment list with a per-source credit checkbox (non-commercial licences flagged), reusing the C1 credit_acked gate (sources_set_enabled with credit_acked).
    • Enabling fires sources_sync jobs that run on the daemon in the background, so onboarding finishes immediately instead of blocking on a progress bar.
  • Express/Welcome/Done copy updated off TWIC; twic step + its TWIC-only helpers/imports removed.

Notes

Verification

  • npm run build (tsc + vite) passes clean on Node 22.

Relates to #40. Closes #98.

🤖 Generated with Claude Code

@jozef2svrcek

Copy link
Copy Markdown
Contributor Author

Code-review follow-ups (deferred from the #1#5 fixes in 161b5d6)

High-effort review surfaced these lower-severity findings on SourcesStep. Tracked here rather than fixed in this PR:

(Refuted by the verify pass and intentionally not listed: chooseEmpty wrapper, duplicate AckRow blocks, "free bundles all bulk", and a claimed stuck-enabling re-run state.)

jozef2svrcek and others added 3 commits June 24, 2026 19:38
…istory choice (#98)

Replace the wizard's inline "download + import TWIC with a progress bar" step
with a Sources step that keeps onboarding a simple binary and defers all detail
to Maintenance → Sources (C1):

- Populate the reference database (recommended) vs Start with an empty database.
- Populate path: currency feeds (TWIC + Lichess Broadcasts) auto-selected, plus
  a deep-history choice — Free (the bulk archive, currently Ajedrez OTB),
  I own a commercial DB (reuses the existing local PGN import via AddGameDialog),
  or None.
- One acknowledgment list with a per-source credit checkbox (non-commercial
  licences flagged), reusing the C1 credit_acked gate (sources_set_enabled with
  credit_acked). Enabling fires sources_sync jobs that run on the daemon in the
  background, so onboarding finishes immediately instead of blocking on a bar.

Client-only: the commercial route and background sync both reuse existing
backend job types; no new endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018gaUhu1KVkdxAjSJBLgbbk
…guards (#98)

Address the high-effort code review of the new SourcesStep:

- enableAndImport now catches a failing setSourceEnabled/submitJob, surfaces
  the error, and keeps the user on the step instead of silently dropping the
  failure (earlier sources may already be enabled; re-clicking is safe).
- getSources failures show a distinct error + Retry rather than collapsing into
  an empty catalog that looks like "zero sources".
- The primary button is gated on a non-empty selection, so an empty selection
  can no longer "complete" a no-op populate while reporting success.
- The step's busy state is reported as (enabling || importing) via one effect,
  so the brief enable loop no longer clears the close guard while a commercial
  PGN import is still running.
- Commercial mode: the embedded import now completes the step on success, and
  the primary button is relabelled "Enable live feeds & finish" with copy
  clarifying the commercial DB is imported separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018gaUhu1KVkdxAjSJBLgbbk
With Phase C3 (#99), enabling a source is enough — the daemon's scheduler picks
up enabled-but-not-yet-synced sources and imports them in the background. So the
onboarding wizard no longer submits a sources_sync per source; it just enables
them (with the credit acknowledgment) and finishes. This resolves the C2 review
follow-ups #6/#7 (no completion-before-data race from the wizard's side, and no
redundant/duplicate sync jobs). Stacked on the C3 branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018gaUhu1KVkdxAjSJBLgbbk
@jozef2svrcek jozef2svrcek force-pushed the multi-source-c2-onboarding-wizard branch from 161b5d6 to 64a54ca Compare June 24, 2026 17:39
@jozef2svrcek jozef2svrcek changed the base branch from main to multi-source-c3-activity-autosync June 24, 2026 17:39
@jozef2svrcek

Copy link
Copy Markdown
Contributor Author

Rebased onto #103 (Phase C3) and simplified. This PR is now stacked on the C3 branch, so its diff is just the wizard delta on top of C3.

The wizard's enableAndImport no longer submits a sources_sync per source — with C3's enable→auto-sync, enabling a source (with its credit acknowledgment) is enough; the daemon's scheduler imports it in the background. This removes the explicit sync submission and resolves the earlier review follow-ups #6 (no completion-before-data race driven by the wizard) and #7 (no redundant/duplicate sync jobs).

Merge order: merge #103 first; GitHub will then auto-retarget this PR's base to main.

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.

Multi-source Phase C2: onboarding wizard — populate-vs-empty + deep-history choice

1 participant