Repository navigation
fix(types): regenerate types.ts — the local database was right, not drifted - #736
Merged
Merged
Conversation
…rifted Closes #707. First step on #660, because the schema guard cannot be trusted to measure the rest of that epic while three of its seven baseline entries are about a stale catalogue rather than broken routes. #707 said regenerating from a local database "silently deletes the application_status enum" and treated that as local migration drift, which is why it was left undone. The causality is backwards. Migration 344 DROPPED core.application_status on purpose, five migrations ago, and says why at length: the type was never used, and its vocabulary was not the one the app has. It declared draft / submitted / under_review / interviewing / offer_extended / hired / rejected / withdrawn, while the real vocabulary is the CHECK constraint on core.applications.status — new / screen / inquired / interview / offer / hired / rejected / withdrawn. Three labels overlap. So the local database is CORRECT and types.ts was stale in the other direction, still declaring a type that was deliberately removed. Regenerating is the fix, and the deletion is the point. Verified before overwriting anything: generated to a temp file and diffed. The only removal in 271 diff lines is application_status, with exactly the vestigial vocabulary migration 344 quotes. Nothing consumes the type — the `application_status` hits elsewhere in the tree are a notification category string, unrelated to the Postgres enum, and there is no Enums['application_status'] consumer anywhere. Three baseline entries go with it: core.content_reports and core.user_blocks (mine, #703) and core.user_feedback (#712). All three were real tables with correct routes, listed only because the catalogue had not caught up. before 7 entries, 3 of them not actually broken after 4 entries, all genuinely missing tables What remains in the baseline is now honest, and is the actual remaining surface of #660: core.soft_skills_ratings 8 #658 core.profile_import_data 5 #658 core.inquiries 2 #476 core.profile_completion_nudges 1 #658 Guard: 6/6, including "BASELINE_BROKEN has no stale entries", which is the assertion that would have caught this being left half-done. Typecheck 12/12.
Contributor
📊 Performance Benchmark Results |
This was referenced Sep 10, 2026
Closed
thinkclay
added a commit
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.
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 #707. First step on #660 — the schema guard cannot be trusted to measure the rest of that epic while three of its seven baseline entries describe a stale catalogue rather than broken routes.
The premise was backwards
#707 said regenerating from a local database "silently deletes the
application_statusenum", read that as local migration drift, and left the regeneration undone on that basis.Migration 344 dropped
core.application_statuson purpose, five migrations ago, and explains itself at length:draft, submitted, under_review, interviewing, offer_extended, hired, rejected, withdrawnnew, screen, inquired, interview, offer, hired, rejected, withdrawnThree labels overlap. So the local database is correct and
types.tswas stale in the other direction — still declaring a type deliberately removed. Regenerating is the fix, and the deletion is the point.Verified before overwriting
Generated to a temp file and diffed rather than writing in place. Across 271 diff lines the only removal is
application_status, with exactly the vestigial vocabulary migration 344 quotes.Nothing consumes it: the other
application_statushits in the tree are a notification category string, unrelated to the Postgres enum, and there is noEnums['application_status']consumer anywhere.Baseline
Three entries were never broken references — real tables, correct routes, a catalogue that hadn't caught up after #703 and #712:
What remains is honest, and is the real remaining surface of #660:
core.soft_skills_ratingscore.profile_import_datacore.inquiriescore.profile_completion_nudgesVerified
That stale-entry assertion is the one that would have caught this being left half-done, and it is why the baseline shrinks rather than being edited around.
🤖 Generated with Claude Code