Repository navigation
chore: tighten typings across the app - #28
Merged
Merged
Conversation
thinkclay
added a commit
that referenced
this pull request
Sep 11, 2026
… hid an anonymous-viewer bug (#745) Closes #482. The organizations route was fixed in #617 and its schema in #743, but profiles.test.ts still asserted the phantom contract — industry as a string, size, location, founded_year, an is_public fixture flag — so the suite stayed red at 24/27 after the code was right. The three tests now assert what the table has: industry joined through industry_id to a real core.industries row, address as the jsonb object it was stored as, and an explicit check that none of the four phantom columns come back. The fixture seeds visibility, industry_id and address, and throws on insert errors instead of returning whatever the swallowed failure left behind. Two things the old tests could never have caught surfaced on the way: The job-count test inserted jobs with status "published", which core.jobs' CHECK (draft|open|paused|closed) rejects; the insert error was unawaited, so the count it expected (2) was unreachable. Now "open", and the error throws. The 27th test — a vanity slug resolving to a profile with a location — was red for a reason outside #482 and inside #732: GET /v1/profiles/slug/{slug} read core.profile with the request client, and every SELECT policy on that table is granted to `authenticated` (profile_public_read is `true`, so every signed-in viewer sees it). Anonymous viewers, the audience the public page exists for, got location: null. The read now goes through the service-role client alongside the preferences read that already did, after the user row is resolved, so nothing about who can find a profile changes. Verified against the running API: 27/27, with the edge runtime confirmed to be serving this worktree (it had been serving another one — the memory-noted gotcha — for the earlier runs). Fixed-name fixtures poisoned reruns: a run that died before cleanup left acme-corp / private-org behind and every later run hit organizations_slug_key. Slugs are now unique per run. tests/infrastructure/vitest/mocks/beyond-ui.tsx: Tabs was a bare div, so any screen using Tabs.Item / Tabs.Trigger / Tabs.Content threw "Element type is invalid". That is what kept two IPIPResultsPage tests skipped since #566 and what stopped the XP-award test from ever rendering the page it asserted on. Tabs is now a compound; both skips are lifted, and a regression test for #740 renders the page three times plus a tab switch and asserts the award fires once — with the hook mock returning a fresh object per call, as useMutation does, because a shared object cannot reproduce the loop. SDK pointer: 759b7ec -> sdk main (Scaffald/sdk#26 + #28). #743 recorded the bump to #26 in its description but main still pointed at sdk#25 — and #26 itself was red at 7: it moved the type, method and tests to the { data } envelope but not the msw handler. sdk#28 fixes the handler; 776/776. This is what `pnpm prepush` refused to stamp until it was fixed, which is the gate doing its job. profiles 27/27 · scf-core IPIPResultsPage 7/7 (was 4 + 2 skipped) and the three other Tabs-consuming suites 32/32 · scf-core:typecheck · sdk 776/776 · deno check profiles.ts unchanged at the 5 pre-existing errors · prepush stamped.
thinkclay
added a commit
that referenced
this pull request
Sep 11, 2026
…type can catch
Some routes wrap their success body in `{ data }` and some return it bare. The
http client returns the parsed body verbatim, so a method declaring
`Promise<UserProfile>` against a wrapping route actually resolves to
`{ data: UserProfile }`. TypeScript never notices, because the generic is
asserted — `this.get<UserProfile>(...)` — rather than inferred from the wire.
And the msw handlers are written from the declared types, so the suite agrees
with the type while the type disagrees with the API.
That combination has produced three wrong contracts a green suite certified:
Scaffald/sdk#21 (employers), #26 (organizations), #29 (getUser). The check has
to compare the route to the SDK, because comparing either to a fixture cannot
see it.
sdk-envelopes.test.ts parses both sides and fails on any pair that disagrees,
with a baseline enforced in both directions like its sibling — a new mismatch
fails, and so does a stale entry.
**11 genuine mismatches are baselined.** Which side moves is a public-API
decision (#744), not something to settle inside a test.
Getting that number right took three corrections, all of which are why the
guard looks the way it does:
* "has a top-level `data` key" is too loose. It classified
PrerequisitesCheckResponse as wrapped — that type has a `data` field among
a dozen domain fields — and a live probe of /v1/prerequisites/check
confirmed the body is bare. An envelope is `data` plus nothing but
pagination/metadata keys.
* 39 SDK methods across six resources unwrap the envelope themselves
(`const res = await this.get<X>(p); return res.data`). Their declared type
describes the inner payload and is correct *because* the route wraps.
Comparing their declared type to the route reported all of them as broken;
11 of my first 22 baseline entries were this false positive.
* `return c.json({ data }, 200)` is shorthand for `{ data: data }`. Requiring
a colon to read a key called two correct routes bare.
Verified by attacking it rather than trusting a green run: flipping
legal.getCurrent to an envelope fails with "sdk says wrapped, route says bare",
and adding a baseline entry for a pair that agrees fails with "now agrees;
remove it". Both pass again once reverted.
Also bumps the sdk pointer to pick up #28 and #29. #743 should have carried
`git submodule update --init --recursive` and reset the submodule back to the
recorded commit after I had checked out the merged one. So main has been
carrying the honest route schema from #743 with the SDK type that contradicts
it.
Refs #744
Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
that referenced
this pull request
Sep 11, 2026
…type can catch (#746) Some routes wrap their success body in `{ data }` and some return it bare. The http client returns the parsed body verbatim, so a method declaring `Promise<UserProfile>` against a wrapping route actually resolves to `{ data: UserProfile }`. TypeScript never notices, because the generic is asserted — `this.get<UserProfile>(...)` — rather than inferred from the wire. And the msw handlers are written from the declared types, so the suite agrees with the type while the type disagrees with the API. That combination has produced three wrong contracts a green suite certified: Scaffald/sdk#21 (employers), #26 (organizations), #29 (getUser). The check has to compare the route to the SDK, because comparing either to a fixture cannot see it. sdk-envelopes.test.ts parses both sides and fails on any pair that disagrees, with a baseline enforced in both directions like its sibling — a new mismatch fails, and so does a stale entry. **11 genuine mismatches are baselined.** Which side moves is a public-API decision (#744), not something to settle inside a test. Getting that number right took three corrections, all of which are why the guard looks the way it does: * "has a top-level `data` key" is too loose. It classified PrerequisitesCheckResponse as wrapped — that type has a `data` field among a dozen domain fields — and a live probe of /v1/prerequisites/check confirmed the body is bare. An envelope is `data` plus nothing but pagination/metadata keys. * 39 SDK methods across six resources unwrap the envelope themselves (`const res = await this.get<X>(p); return res.data`). Their declared type describes the inner payload and is correct *because* the route wraps. Comparing their declared type to the route reported all of them as broken; 11 of my first 22 baseline entries were this false positive. * `return c.json({ data }, 200)` is shorthand for `{ data: data }`. Requiring a colon to read a key called two correct routes bare. Verified by attacking it rather than trusting a green run: flipping legal.getCurrent to an envelope fails with "sdk says wrapped, route says bare", and adding a baseline entry for a pair that agrees fails with "now agrees; remove it". Both pass again once reverted. Also bumps the sdk pointer to pick up #28 and #29. #743 should have carried `git submodule update --init --recursive` and reset the submodule back to the recorded commit after I had checked out the merged one. So main has been carrying the honest route schema from #743 with the SDK type that contradicts it. Refs #744 Co-authored-by: Claude Opus 5 <[email protected]>
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.
Summary
anycasts and preserve font token handlinganyusages in theme utilities, providers, and scripts while addressing lint warningsTesting
https://chatgpt.com/codex/tasks/task_b_68d20667ce808331aa2614093b0325af