Skip to content

polish(desktop): tutorial completion card with stats and achievements - #3387

Merged
janicduplessis merged 2 commits into
mainfrom
feat/3376-tutorial-card
Oct 10, 2026
Merged

janicduplessis merged 2 commits into
mainfrom
feat/3376-tutorial-card

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The last part of #3376. The tutorial ended on a plain "Tutorial Complete" label. This PR replaces it with a completion card built from the stats #3384 now keeps, plus achievements for the optional steps.

Solution

TutorialCompletionCard replaces the label at the top of the finished panel and keeps the archive note and Open Archived.

  • Header: the time from clone to archive: the end of Finish and Archive (stepTimes["delete"], or stepTimes["done"] without it) minus startedAt. It doesn't grow while Delete waits.
  • Tiles, each shown only when its data exists:
    • the first build's time;
    • the second build's time, labelled "cache hit" when it came from a cache, with the time saved;
    • the two worktrees, "building at once" when the builds overlapped;
    • the agent actions to replay;
    • after Delete, the space freed: the summed worktreeBytes of the two worktrees and the clone.
  • Badges: one per optional step: Hands on, Replay, Logs, Pocket Stim (only when the phone app is enabled), Shared, Clean slate. A badge is solid when the step is in record.done and dashed when it was skipped. A step that hasn't been reached yet, such as Delete while it is current, has no badge. Next records a step as done only when its checkpoint saw the evidence, and as skipped otherwise, so a solid badge means Stim saw the evidence.

It reads only the TutorialSnapshot the panel already has. The done screenshot fixture now carries sample stats and skips Logs and Phone, so the render shows the full card. The Desktop docs describe the card.

Light and dark, from the done fixture:
Completion card

Test plan

  • STIM_TUTORIAL_SHOTS=<dir> swift test --filter TutorialScreenshotTests renders the card in both schemes (above).
  • swift test -Xswiftc -warnings-as-errors passes, and scripts/format.sh --check and check-ascii.mjs are clean.
  • stim macos from apps/desktop builds and launches, and stim logs --errors is empty.

Refs #3376

@janicduplessis

Copy link
Copy Markdown
Collaborator Author

Review:

  1. apps/desktop/Sources/StimDesktop/Views/TutorialCompletionCard.swift:~85 (total): the header says "from clone to archive", but once the tutorial is done it uses stepTimes["done"], which is when the Delete step ended (Next or a successful delete). While Delete is still current it uses stepTimes["delete"], the end of Finish and Archive. The same tutorial therefore shows a longer time after Delete, and the time grows with how long the user sits on that step. Use stepTimes["delete"] (the Delete step start, i.e. archive time) whenever present, falling back to done only if it is missing.

  2. TutorialCompletionCard.swift:~100 (achievements): the card also shows while currentStep == "delete" (isFinished). Then "Clean slate" is neither done nor skipped but still renders dashed with the accessibility label "skipped". Delete is pending there and the user can still complete it. Give pending its own look and label (or omit the badge until Delete is done or skipped), and base earned on record.skipped vs record.done so only a real skip reads as skipped.

  3. PR description and docs/desktop.md: "a badge means Stim saw the evidence" is overstated, since markDone can complete a step manually after 120 s without evidence. Reword.

Minor, no change needed: "freed" sums worktreeBytes only for folders that were measured, so it can understate if the clone was never measured. Build with -warnings-as-errors passes, ASCII check clean, no new data reads (the card only uses the snapshot), both commits fit the polish definition.

@janicduplessis
janicduplessis force-pushed the feat/3376-tutorial-card branch from 9989045 to 94a2781 Compare October 10, 2026 20:34
@janicduplessis

Copy link
Copy Markdown
Collaborator Author

Addressed in 1c4f42a: the header now uses the end of Finish and Archive, and only done or skipped optional steps get a badge (none for Delete while it is current). On the evidence claim: markDone no longer exists on main (#3380 replaced it with Next), and next(now:) records a step as done only when its checkpoint finished it, otherwise as skipped, so the wording stays.

@janicduplessis

Copy link
Copy Markdown
Collaborator Author

Review: clear

Re-reviewed the whole diff at 1c4f42a.

  • Finding 1 resolved: the header uses stepTimes["delete"] (the start of Delete, set in advance/update), falling back to done, so it no longer grows while Delete waits.
  • Finding 2 resolved: badges render only for optional steps in record.done or record.skipped; Delete while current has none, and the phone step auto-skipped without the phone app (advance without a skip entry) has none either.
  • Finding 3 correctly rebutted: next(now:) appends to done only when the step was finished by its checkpoint, otherwise to skipped. Narrow caveat, no change needed: the launch-time resume path marks every non-skipped pre-Delete step done without evidence.
  • Tiles are each hidden when data is missing; "cache hit" vs "second build" keys on cache == "none"; freed needs done to contain delete and measured bytes above 0. Panel wiring, the fixture change, docs and PR description match the code. Both commits fit the polish definition (look and copy only, snapshot data already read). swift build -Xswiftc -warnings-as-errors passes. Desktop CI was still pending when I checked.

@janicduplessis janicduplessis added the review: ai-approved A fresh AI review found nothing left to fix label Oct 10, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review October 10, 2026 20:35
@janicduplessis
janicduplessis merged commit 08333ce into main Oct 10, 2026
5 checks passed
@janicduplessis
janicduplessis deleted the feat/3376-tutorial-card branch October 10, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: desktop apps/desktop area: website website/ review: ai-approved A fresh AI review found nothing left to fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant