Repository navigation
fix(profile): the skills widget on another user's profile was broken three ways (#603) - #610
Merged
Merged
Conversation
…three ways (#603) SkillsWidget is rendered on every other-user profile via user-profile-right. It called useSkillsLegacy(), and three separate things were wrong with that. 1. The endpoint does not exist. GET /v1/profiles/skills/legacy returns 404 — the route has never been registered on the api function, so the widget could only ever render its "Failed to load skills" state. 2. It fetched the wrong person. useSkillsLegacy() takes no userId, so it reads the *authenticated* user's skills. The widget is passed userId and rendered on other people's profiles, so fixing (1) alone would have shipped a worse bug than the one it fixed: your own skills displayed as theirs. 3. The shape was a fiction. The response was cast `as unknown as EnrichedUserSkill[]`, a shape GetSkillsLegacyResponse has never had — LegacySkill is {skill_id, skill_name, proficiency, ...}, the widget renders {id, taxonomy, name, label, displayCode, ...}. Migrated to useSkillsWidget({ userId }) -> GET /v1/profiles/widgets/skills, which exists, is userId-aware, and whose SDK type (SkillWidgetEntry) is exactly the shape the widget renders — so the cast is gone too. That endpoint did not actually return that shape. It did `select("*")` on core.user_skills and returned the raw rows, which carry only a taxonomy discriminator and a foreign key: no name, no display code. Its own OpenAPI response schema declared name/label/displayCode. Anything rendering `label` got an empty string. It now resolves them. The resolution logic is extracted to lib/skill-lookups.ts rather than written a second time — /v1/profiles/skills/multi-taxonomy already resolves the same two foreign keys inline. The two endpoints shape their responses differently on purpose, so this shares the lookup, not the response; sharing the lookup is what stops them drifting on the part that matters, which table a taxonomy resolves against. #585 was two copies of one rule disagreeing, and that is worth not repeating. useSkillsLegacy and useUpdateSkillsLegacyMutation are removed — SkillsWidget was their only consumer. The matching SDK methods live in the @scaffald/sdk submodule and are now unreferenced; removing them needs its own PR there. Also corrects the other half of #603: I reported GET /v1/profiles/skills/user as 404 with live consumers. That path is not what the client calls — client.skills.getUserSkills() requests /v1/profiles/skills, which exists and returns data. I had inferred the path from the hook's query key (['scaffald','skills','user']) and probed a URL nothing uses. The work-log skill picker was never broken. Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #603. Part of #594.
SkillsWidgetis rendered on every other-user profile viauser-profile-right. It calleduseSkillsLegacy(), and three separate things were wrong with that.1. The endpoint does not exist.
GET /v1/profiles/skills/legacyreturns 404 — never registered on the api function — so the widget could only ever render "Failed to load skills".2. It fetched the wrong person.
useSkillsLegacy()takes nouserId, so it reads the authenticated user's skills. The widget is passeduserIdand rendered on other people's profiles. Fixing (1) alone would have shipped a worse bug than it fixed: your own skills displayed as theirs.3. The shape was a fiction. The response was cast
as unknown as EnrichedUserSkill[]— a shapeGetSkillsLegacyResponsehas never had.LegacySkillis{skill_id, skill_name, proficiency, …}; the widget renders{id, taxonomy, name, label, displayCode, …}.The fix
Migrated to
useSkillsWidget({ userId })→GET /v1/profiles/widgets/skills, which exists, is userId-aware, and whose SDK typeSkillWidgetEntryis exactly the shape the widget renders — so the cast goes too.Except that endpoint didn't return that shape either. It did
select("*")oncore.user_skillsand returned raw rows, which carry only a taxonomy discriminator and a foreign key — no name, no display code — while its own OpenAPI response schema declaredname/label/displayCode. Anything renderinglabelgot an empty string. It now resolves them.The resolution is extracted to
lib/skill-lookups.tsrather than written a second time:/v1/profiles/skills/multi-taxonomyalready resolves the same two foreign keys inline. The two endpoints shape their responses differently on purpose, so this shares the lookup, not the response — which is what stops them drifting on the part that matters, which table a taxonomy resolves against. #585 was two copies of one rule disagreeing; worth not repeating.useSkillsLegacy/useUpdateSkillsLegacyMutationare removed —SkillsWidgetwas their only consumer. The matching SDK methods live in the@scaffald/sdksubmodule and are now unreferenced; removing them needs its own PR there.Correcting the other half of #603
I reported
GET /v1/profiles/skills/useras 404 with live consumers in the work-log picker. That was wrong.client.skills.getUserSkills()requests/v1/profiles/skills, which exists and returns data — I had inferred the path from the hook's query key (['scaffald','skills','user']) and probed a URL nothing calls. The work-log skill picker was never broken. Only thelegacypair was real.Verification
__tests__/lib(11 for the lookup helper), 0 failures — including the trimmed-O*NET-code case, dedup, the no-ids short circuit, and unresolved skills still rendering a label rather than an empty row.deno checkon the changed route: 56 errors, identical to the HEAD baseline (all the pre-existing untyped-context issue, fix(api): authMiddleware context is untyped, so c.get() is never and test:deno:types cannot pass #477).scf-coretypechecks at 0 errors;pnpm prepushgreen.Not verified against a live database. Another session cycled the local Supabase stack and restored a pre-seed backup partway through this work (
data.masterformatwent 8,953 → 0), so I did not re-probe the endpoint rather than reset a database someone else is using.CI checks will show red without running — Actions billing block, #375.
🤖 Generated with Claude Code