Repository navigation
feat(profiles)!: drop getEmployer — it targeted a table that exists in no schema - #21
Merged
Merged
Conversation
…n no schema
`GET /v1/profiles/employers/{slug}` has never returned a response. It queried
`core.employers`, and there is no `employers` table in any schema, nor an
`employer_id` column anywhere in `core`. The route was written against a schema
that does not exist rather than one that drifted.
`employer` in this product is an organization: `core.organizations` carries
`owner_user_id` and `core.jobs.organization_id` is the real FK.
`profiles.getOrganization(slug)` already does what this method appears to want,
and its endpoint works.
Removed: the `EmployerProfile` type, `profiles.getEmployer`, the
`useEmployerProfile` hook, and their re-exports.
The tests went with them, and they are the reason this survived: they mocked
`/v1/profiles/employers/:slug` in msw and asserted against the mock, so the
suite was green the entire time the endpoint was 500ing. A mock of an endpoint
that cannot exist proves only that the client can parse an object someone made
up.
BREAKING CHANGE: `profiles.getEmployer`, `useEmployerProfile` and the
`EmployerProfile` type are gone. Nothing consumed them outside the wrapper hook
in scf-core, which is removed alongside. Use `profiles.getOrganization` and
`useOrganizationProfile`.
Refs Scaffald/SaaS#618
Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 2, 2026
…in no schema
`GET /v1/profiles/employers/{slug}` has never returned a response. It queried
`core.employers`, and information_schema has no `employers` table in any schema
and no `employer_id` column anywhere in `core` — the route was written against
a schema that does not exist, not one that drifted. The handler also counted
jobs by `employer_id`, so there was nothing to repair toward.
`employer` in this product is an organization: `core.organizations` carries
`owner_user_id`, and `core.jobs.organization_id` is the real FK.
`GET /v1/profiles/organizations/{slug}` already does what this route appears to
want, and works (#617).
Deleted: the route, the SDK's `EmployerProfile` / `profiles.getEmployer` /
`useEmployerProfile` (Scaffald/sdk#21, pointer bumped here), the scf-core
wrapper hook and its re-export, and the five Deno tests plus the
`createTestEmployerProfile` helper that inserted into `core.employers`.
`core.employers` is dropped from BASELINE_BROKEN — with the route gone the
entry is stale, and the reference test fails on a stale entry rather than
letting it rot.
BREAKING CHANGE: `GET /v1/profiles/employers/{slug}` is gone, along with
`profiles.getEmployer`, `useEmployerProfile` and `EmployerProfile`. It never
returned a response, so no working behaviour is removed. Use
`GET /v1/profiles/organizations/{slug}` and `useOrganizationProfile`.
Closes #618
Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 2, 2026
…in no schema
`GET /v1/profiles/employers/{slug}` has never returned a response. It queried
`core.employers`, and information_schema has no `employers` table in any schema
and no `employer_id` column anywhere in `core` — the route was written against
a schema that does not exist, not one that drifted. The handler also counted
jobs by `employer_id`, so there was nothing to repair toward.
`employer` in this product is an organization: `core.organizations` carries
`owner_user_id`, and `core.jobs.organization_id` is the real FK.
`GET /v1/profiles/organizations/{slug}` already does what this route appears to
want, and works (#617).
Deleted: the route, the SDK's `EmployerProfile` / `profiles.getEmployer` /
`useEmployerProfile` (Scaffald/sdk#21, pointer bumped here), the scf-core
wrapper hook and its re-export, and the five Deno tests plus the
`createTestEmployerProfile` helper that inserted into `core.employers`.
`core.employers` is dropped from BASELINE_BROKEN — with the route gone the
entry is stale, and the reference test fails on a stale entry rather than
letting it rot.
BREAKING CHANGE: `GET /v1/profiles/employers/{slug}` is gone, along with
`profiles.getEmployer`, `useEmployerProfile` and `EmployerProfile`. It never
returned a response, so no working behaviour is removed. Use
`GET /v1/profiles/organizations/{slug}` and `useOrganizationProfile`.
Closes #618
Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 2, 2026
…/feedback works (#712) * feat(profiles)!: delete the employers route, which addressed a table in no schema `GET /v1/profiles/employers/{slug}` has never returned a response. It queried `core.employers`, and information_schema has no `employers` table in any schema and no `employer_id` column anywhere in `core` — the route was written against a schema that does not exist, not one that drifted. The handler also counted jobs by `employer_id`, so there was nothing to repair toward. `employer` in this product is an organization: `core.organizations` carries `owner_user_id`, and `core.jobs.organization_id` is the real FK. `GET /v1/profiles/organizations/{slug}` already does what this route appears to want, and works (#617). Deleted: the route, the SDK's `EmployerProfile` / `profiles.getEmployer` / `useEmployerProfile` (Scaffald/sdk#21, pointer bumped here), the scf-core wrapper hook and its re-export, and the five Deno tests plus the `createTestEmployerProfile` helper that inserted into `core.employers`. `core.employers` is dropped from BASELINE_BROKEN — with the route gone the entry is stale, and the reference test fails on a stale entry rather than letting it rot. BREAKING CHANGE: `GET /v1/profiles/employers/{slug}` is gone, along with `profiles.getEmployer`, `useEmployerProfile` and `EmployerProfile`. It never returned a response, so no working behaviour is removed. Use `GET /v1/profiles/organizations/{slug}` and `useOrganizationProfile`. Closes #618 Co-Authored-By: Claude Opus 5 <[email protected]> * fix(feedback): move user_feedback into core, so the router is reachable at all Every /v1/feedback endpoint failed for any client, for two independent reasons (#665): 1. PostgREST does not serve the `logs` schema. config.toml exposes auth, public, core, storage, data, onet, engagement and community. 2. logs.user_feedback granted only `postgres` — no service_role, no authenticated. Same class as #481 and #654. Migration 350 takes the smaller of the two routes offered in the issue: move the table rather than expose a ninth schema. That keeps the exposed-schema list stable across all three environments, and core is already the convention for user-scoped data. `logs` held nothing else. The table is empty, so nothing is migrated but the definition. SET SCHEMA carries its indexes, constraints, RLS setting and all three policies, which were already correct and role-scoped — select/insert to authenticated on `user_id = auth.uid()`, ALL to service_role. What was missing was never the policies but the grants beneath them: a policy cannot widen access past an absent GRANT, which is why even service_role could not read it. Verified against the running stack. Before, PostgREST answered "Could not find the table in the schema cache". Now it resolves the table and answers 42501 for `anon` — which is the correct outcome, since feedback requires auth and only authenticated and service_role are granted. As `authenticated`, the count runs. The CCPA data summary counts platform feedback again. #663 left it out of the Communications category rather than reporting a silent zero in a statutory disclosure; with the table reachable, the category is "Reviews, platform feedback" and its count includes both. Closes #665 Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
thinkclay
added a commit
that referenced
this pull request
Sep 10, 2026
…ever sent (#26) `GET /v1/profiles/organizations/{slug}` was repaired in Scaffald/SaaS#617 — the select used to ask for columns core.organizations does not have — but the type above it was left alone. Checked against a live response rather than reasoned about: field declared actually returned description string object (rich-text document) industry string object { id, name, slug } size string ABSENT location string ABSENT founded_year number ABSENT address - returned, undeclared And one more at the top level: the route wraps its payload in `{ data }`, and the http client returns the body verbatim, so `getOrganization` resolves to `{ data: OrganizationProfile }` while declaring the profile bare. size, location and founded_year are dropped rather than added. They exist in no table in any schema, so keeping them would mean inventing product surface to satisfy a type that was only ever aspirational. **Why the suite never noticed.** The msw handler hand-wrote the declared shape — `industry: 'Technology'`, `size: '1000-5000'`, `location: 'San Francisco, CA'` — and returned it bare. Every assertion was `toHaveProperty`, which passes against any shape at all. So the tests agreed with the type, the type disagreed with the API, and nothing connected the two. Same failure as the employers mock in #21: mocking an endpoint into the shape you wish it had proves only that the client can parse an object you wrote yourself. The handler now mirrors a real response, and four assertions check the things that were wrong — description is a document, industry is the embedded row, address is structured, and size/location/founded_year are absent. Verified they bite: reverting `industry` to a string in the mock turns one red. `useOrganizationProfile`'s generic follows the envelope, which is what caught the top-level mismatch — tsc rejected the old `UseQueryOptions<OrganizationProfile>` as soon as the method stopped lying. `getUser` has the same envelope defect and `getProfileBySlug` does not wrap at all; that inconsistency spans the public profiles surface and is filed separately rather than half-fixed here. tsc clean; 776 tests across 36 files pass. Refs Scaffald/SaaS#482 Co-authored-by: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
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
to Scaffald/SaaS
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.
GET /v1/profiles/employers/{slug}has never returned a response. It queriedcore.employers:There is no
employerstable in any schema, and noemployer_idcolumn anywhere incore. The route was written against a schema that does not exist, not one that drifted.employerin this product is an organization:core.organizationscarriesowner_user_id, andcore.jobs.organization_idis the real FK.profiles.getOrganization(slug)already does what this method appears to want, and its endpoint works (repaired in Scaffald/SaaS#617).Removed
EmployerProfiletypeprofiles.getEmployer()useEmployerProfilehooksrc/index.tsandsrc/react/index.tsWhy the tests never caught it
They went too — and they are the reason this survived.
src/__tests__/mocks/server.tsregistered an msw handler for/v1/profiles/employers/:slugreturning a hand-writtenTech Startup Inc, and both the resource test and the hook test asserted against that. The suite was green for the entire life of an endpoint that 500s in production.A mock of an endpoint that cannot exist proves only that the client can parse an object someone made up.
Verified
tsc --noEmitclean; 780 tests pass across 36 files after removal.BREAKING CHANGE
profiles.getEmployer,useEmployerProfileandEmployerProfileare gone. Nothing consumed them outside the wrapper hook inscf-core, which is removed in the companion PR. Useprofiles.getOrganization/useOrganizationProfile.Refs Scaffald/SaaS#618