Repository navigation
fix(profile-completion): retire dismissNudge(), which wrote to a table that never existed - #25
Merged
Merged
Conversation
…e that never existed It posted to /v1/profiles/completion/nudges/dismiss, which upserted into core.profile_completion_nudges — a table that does not exist and never has (Scaffald/SaaS#658). Retired rather than given a table, for two reasons. No component ever rendered it: useDismissNudgeMutation wrapped this method and nothing imported the hook. And the route was not a working upsert even in principle — it named no onConflict target, so with a UUID primary key every "dismiss" would have inserted a fresh row rather than recording one. The test suite for it goes too. It passed against the mock server for as long as it existed while the real endpoint 500'd; a fixture that invents the endpoint cannot fail when the endpoint is missing. DismissNudgeParams and DismissNudgeResponse are removed from the public exports with it. 772 remaining tests pass.
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 10, 2026
…tire the third route (#741) Closes #658, and with it the schema half of #660: BASELINE_BROKEN is empty. Three routers read tables that never existed. The issue said each needed a decision, not a rename, and the deciding evidence was the same question for all three — does anything reach this? **core.soft_skills_ratings — created.** Four routes, four SDK methods, four hooks, and THIRTEEN components: the profile radar, comparison and history widgets, the rating form, the skills-analytics widgets, the office job-form section, and both discover-jobs panes. A whole feature written against a table that was designed and never migrated. The shape is read off the router, not invented: versioned self-assessments where each PATCH writes max(version)+1, /history reads every version, /comparison reads the latest. Append-only by design, so no UPDATE or DELETE for the user — a corrected assessment is a new version and the old one stays in the timeline. UNIQUE (user_id, skill_id, version), rating CHECK 1..5 to match the route's zod, FK to core.soft_skills RESTRICT because the taxonomy retires by is_active, not by delete. lib/skill-snapshots.ts, which the issue worried was a second half-built version of the same idea, is not: it is pure arithmetic over core.skill_snapshots, a different and existing table. **core.profile_import_data — created.** GET/POST/DELETE, three hooks, ImportReviewScreen at /profile/resume/review, linked from the drawer. One staged import per user awaiting review, with the 24h expiry the route already enforces. UNIQUE (user_id): the route does delete-then-insert to keep one row, but that pair is not atomic, so the invariant is now the database's — a concurrent second save fails with 23505 instead of leaving two rows for GET's .limit(1).single() to pick between. **core.profile_completion_nudges — NOT created; the route is retired.** One route, one SDK method, one hook, and nothing behind the hook: no component imported useDismissNudgeMutation, and the three other "nudge" hits in the tree are prose about application next-steps. The upsert also named no onConflict target, so with a UUID primary key every "dismiss" would have inserted a fresh row — it was never a working upsert. Per #660's method, an endpoint no screen can reach does not get a table built for it. Scaffald/sdk#25 retires the method, types and mock-backed test. RLS follows the house rule for each kind of data. Ratings copy skill_snapshots_select: own rows, or anyone's when that profile's skills are visible — GET /soft takes ?userId= precisely so an employer can view a candidate's, through the request client. (user_skills_select_public has the same intent and compares prefs.user_id to itself, a tautology; the form here is the correct one.) Staging is own-rows-only for every operation; it is never public. Verified rather than trusted, all against the local stack: constraints every CHECK, UNIQUE and FK tried and rejected (verify354) live routes 14/14 — scripts/audit/test-658.mjs GET /soft 500 -> 200; PATCH writes v1 then v2 as a new version; history returns both; comparison 200; rating 9 rejected; import GET null -> POST 201 -> GET with expiry -> second POST replaces, exactly one row -> DELETE; nudges/dismiss 404; /completion/status still 200 RLS 5/5 — scripts/audit/test-658-rls.mjs, through PostgREST with two real sessions, not emulated JWT claims schema guard 6/6, BASELINE_BROKEN empty deno check profile-completion.ts 4 errors -> 3 (remainder pre-existing) typecheck 12/12 test:unit 8/8 lint 10/10 types.ts regenerated: only additions, application_status still correctly absent (#736). SDK pointer: e28fa9c..759b7ec.
3 tasks
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.
It posted to
/v1/profiles/completion/nudges/dismiss, which upserted intocore.profile_completion_nudges— a table that does not exist and never has (Scaffald/SaaS#658).Retired rather than given a table, for two reasons:
useDismissNudgeMutationwrapped this method and nothing imported the hook. The only other "nudge" in the app is prose about application next-steps — a different concept.onConflicttarget, so with a UUID primary key every "dismiss" would have inserted a fresh row rather than recording one.The test suite goes too. It passed against the mock server for as long as it existed while the real endpoint 500'd — a fixture that invents the endpoint cannot fail when the endpoint is missing.
DismissNudgeParamsandDismissNudgeResponseleave the public exports with it. 772 remaining tests pass.🤖 Generated with Claude Code