Skip to content

feat(profile): make the guided wizard reachable, and have it write a real profile (#584) - #605

Merged
thinkclay merged 1 commit into
mainfrom
claude/fix-584-wizard-wiring
Aug 12, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/fix-584-wizard-wiring

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #584. Part of #594. You chose "wire it up properly" over deleting it.

What was wrong

The Profile Wizard was 15 source files, 12 test files and a live /v1/profile-wizard router with no route anywhere that rendered it. Nothing imported it outside its own directory. It was unreachable in the shipped app — while carrying nearly half the passing test files in the profile feature, which is how it inflated the apparent health of a feature it was not part of.

Two things were missing, and fixing either alone would have been pointless.

Reachability

/profile/wizard renders it, declared in the profile layout, with ROUTES.PROFILE.WIZARD and a Guided setup button on the profile overview beside Request review and Share profile.

It is a peer of the section editors, not a replacement: the wizard is the guided path for a new worker; the editors are how anyone changes one thing later.

Persistence

POST /v1/profile-wizard/complete writes wizard progress into core.preferences and touches nothing else — so finishing all six steps left the actual profile empty.

The wizard now commits through the same endpoints the profile editors use:

step endpoint
general PATCH /v1/profiles/general
experience POST /v1/profiles/experience
education POST /v1/profiles/education
preferences PATCH /v1/profiles/employment

That is the acceptance criterion, and it is also the right shape: giving the server a second write path per section would mean two sets of validation rules and two places for the same bug.

Two deliberate ordering choices:

  • Commit before marking complete, so a failed write cannot leave a user with a finished wizard and an empty profile.
  • Sections written independently, one failure not aborting the rest — someone who filled in five steps should not lose all five because certifications 500'd. Failures are named in a toast that points at the profile.

What is deliberately left out

Skills and certifications are not committed yet. Both write paths key off catalog ids, and the wizard's pickers resolve those against endpoints that are currently broken: the CSI catalog was unseeded until #602, and two skills endpoints still 404 (#603). Writing half-resolved ids would put rows in core.user_skills that are harder to clean up than to skip. Marked inline with the issue references so it is a known gap rather than an oversight.

Why the mapping is a separate tested module

wizard-to-profile.ts exists because the wizard says bio where the profile says about, issuer where it says issuing_organization, and a single-value availability where it stores an array. Getting any of those wrong is silent — the request succeeds and the data lands nowhere visible. 18 assertions cover the renames, the trimming, the required-field rules the editors enforce, and the current-role end-date handling.

Verification

  • profile-wizard suite: 124 passed / 0 failed / 2 skipped.
  • scf-core typechecks at 0 errors; pnpm prepush green.
  • Not exercised end to end. Docker is unavailable in this environment, so the wizard has not been walked in a browser and no profile has been observed changing as a result. That is the gate before trusting it: pnpm supa start, pnpm web, visit /profile/wizard, complete it, confirm /profile reflects the answers.

CI checks will show red without running — Actions billing block, see #375.

🤖 Generated with Claude Code

…real profile (#584)

The Profile Wizard was 15 source files, 12 test files and a live
/v1/profile-wizard router with no route anywhere that rendered it. Nothing
imported it outside its own directory. It was unreachable in the shipped app,
while carrying nearly half the passing test files in the profile feature —
which is how it inflated the apparent health of a feature it was not part of.

Two things were missing, and both had to be fixed for either to be worth doing.

Reachability: /profile/wizard now renders it, declared in the profile layout,
with ROUTES.PROFILE.WIZARD and a "Guided setup" entry point on the profile
overview beside Request review and Share profile. It is a peer of the section
editors, not a replacement — the wizard is the guided path for a new worker, the
editors are how anyone changes one thing later.

Persistence: POST /v1/profile-wizard/complete writes wizard progress into
core.preferences and touches nothing else, so finishing all six steps left the
actual profile empty. The wizard now commits through the same endpoints the
profile editors use — PATCH /v1/profiles/general, POST /v1/profiles/experience,
POST /v1/profiles/education, PATCH /v1/profiles/employment — rather than giving
the server a second write path per section. One write path, one set of
validation rules, one place for a bug to live.

The commit runs before the wizard is marked complete, so a failed write cannot
leave a user with a finished wizard and an empty profile. Sections are written
independently and one failure does not abort the rest: someone who filled in
five steps should not lose all five because certifications 500'd. Failures are
named in a toast pointing at the profile.

Skills and certifications are deliberately NOT committed yet. Both write paths
key off catalog ids, and the wizard's pickers resolve those against endpoints
that are currently broken — the CSI catalog was unseeded until #602, and two
skills endpoints still 404 (#603). Writing half-resolved ids would put rows in
core.user_skills that are harder to clean up than to skip. Noted inline.

The field mapping is extracted to wizard-to-profile.ts and unit-tested rather
than inlined: the wizard says "bio" where the profile says "about", and getting
that wrong is silent — the PATCH succeeds and the text lands nowhere visible.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit 9db0638 into main Aug 12, 2026
5 of 7 checks passed
@thinkclay
thinkclay deleted the claude/fix-584-wizard-wiring branch August 12, 2026 04:39
thinkclay added a commit that referenced this pull request Aug 12, 2026
…it clean (#504, #593) (#606)

I un-excluded scf-core from test:unit in #604 on the strength of a JSON report
showing 957 passed / 0 failed. That was the wrong signal. `vitest run` exits 1
regardless, so `pnpm test` went red on main for anyone running it locally.

Two things were wrong with how I checked.

The OOM is real. I grepped the background task's output file for "heap out of
memory" and got nothing, because that file held only my own echo lines — vitest's
stderr went elsewhere and I never read it. #504 is not stale: at
--max-old-space-size=4096 the main process dies with "Ineffective mark-compacts
near heap limit" at ~4GB. Raising it to 8192 does not fix it either; with the two
collection failures below repaired, more files collect, more memory is retained,
and it OOMs again at 8GB. Every test passes and the report says success: true —
the failure is entirely the parent process at teardown, not the tests.

My pass/fail summary could not see a broken file. A file that fails to *collect*
contributes zero passed and zero failed, so it is invisible to a count of
assertions. Two files were failing that way and I shipped both:

  - ScaffaldLogo.test.tsx (mine, #599) — "Unexpected token 'typeof'".
    react-native-svg's untransformed source. A mock for it has existed at
    tests/infrastructure/vitest/mocks/react-native-svg.tsx since it was written
    but was never aliased in vitest.config.ts, unlike the react-native, lucide
    and expo-updates mocks. Now aliased, which fixes any test rendering an SVG.
  - ProfileWizard.test.tsx (mine, #605) — the commit hook I added pulled
    @scf/core/provider, and through it UniversalThemeProvider ->
    expo-router/react-navigation, which does not resolve under vitest. Mocked in
    the test; the commit path keeps its own unit tests.

The logo test also asserted something false: that two separate render() calls
produce byte-identical markup. They are two React roots, and useId is only
required to be deterministic by position within a root, so a correct
implementation fails that. It now asserts what actually regresses if the id goes
random again — not drawn from a random source, stable across re-renders, distinct
between two logos in one tree, and referenced by the url(#id) that fills the mark.

scf-core goes back in the exclude list. Making it runnable is #504's job and it
needs the parent-process retention fixed, not a bigger ceiling.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

decide(profile): the Profile Wizard is orphaned — no route renders it and it never writes to the profile

1 participant