Skip to content

feat(api)!: delete the employers route, and move user_feedback so /v1/feedback works - #712

Merged
thinkclay merged 2 commits into
mainfrom
claude/618-665-dead-routes
Sep 2, 2026
Merged

thinkclay merged 2 commits into
mainfrom
claude/618-665-dead-routes

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Replaces #708, which GitHub auto-closed when its base branch (#711) was deleted on merge. Same commits, now on main.

Both of these are routes that have never worked, for the same underlying reason as the rest of #660: the code addresses a schema that isn't there.


#618 — delete GET /v1/profiles/employers/{slug}

select table_schema||'.'||table_name from information_schema.tables
where table_name ilike '%employer%';
-- (0 rows)

select count(*) from information_schema.columns
where table_schema='core' and column_name='employer_id';
-- 0

No employers table in any schema, no employer_id column anywhere in core. The handler also counted jobs by employer_id. There was nothing to repair toward — this was written against a schema that does not exist, not one that drifted.

employer in this product is an organization: core.organizations carries owner_user_id, core.jobs.organization_id is the real FK, and GET /v1/profiles/organizations/{slug} already does the job (repaired in #617).

Deleted: the route; the SDK's EmployerProfile, profiles.getEmployer and useEmployerProfile (Scaffald/sdk#21, merged, 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.

Why nothing caught this. The SDK tests mocked /v1/profiles/employers/:slug in msw and asserted against the mock, so they were green for the entire life of an endpoint that 500s. A mock of an endpoint that cannot exist proves only that the client can parse an object someone made up.

core.employers is dropped from BASELINE_BROKEN — with the route gone the entry is stale, and the reference test fails on stale entries rather than letting them rot.

BREAKING CHANGE. The endpoint, profiles.getEmployer, useEmployerProfile and EmployerProfile are gone. Since it never returned a response, no working behaviour is removed.


#665 — move logs.user_feedback to core.user_feedback

Every feedback endpoint failed for any client, for two independent reasons:

  1. PostgREST does not serve the logs schema (config.toml exposes auth, public, core, storage, data, onet, engagement, community).
  2. The table granted only postgres — no service_role, no authenticated. Same class as fix(db): 8 core tables grant SELECT to authenticated but not service_role #481 and core.review_links grants only postgres — both review-link endpoints 500 #654.

Migration 350 takes the smaller of the two routes the issue offered: 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 migrates but the definition. SET SCHEMA carries indexes, constraints, the RLS setting and all three policies — which were already correct:

user_feedback_select_self          SELECT to authenticated  USING (user_id = auth.uid())
user_feedback_insert_self          INSERT to authenticated  WITH CHECK (user_id = auth.uid())
user_feedback_service_full_access  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 after
PostgREST, core.user_feedback "Could not find the table in the schema cache" resolves the table
as anon — 42501 permission denied — correct, feedback requires auth
as authenticated — query runs

CCPA

GET /v1/ccpa/data-summary counts platform feedback again. #663 deliberately left it out of the Communications category rather than report a silent zero in a statutory disclosure; with the table reachable, the category is now "Reviews, platform feedback" and its count includes both.

One consequence worth flagging

core.user_feedback is new, so types.ts does not have it, and the reference test flags the corrected route. It is recorded in BASELINE_BROKEN with that explanation rather than hand-edited into types.ts — regenerating from the drifted local database deletes an enum (#707). The entry goes stale the moment types are regenerated properly, and the test fails on stale entries, so it cannot rot.

Closes #618
Closes #665

…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]>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results


…le 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]>
@thinkclay
thinkclay force-pushed the claude/618-665-dead-routes branch from acc5fb2 to 53abf07 Compare September 2, 2026 06:44
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results


@thinkclay
thinkclay merged commit eb4f792 into main Sep 2, 2026
15 of 16 checks passed
@thinkclay
thinkclay deleted the claude/618-665-dead-routes branch September 2, 2026 06:57
thinkclay added a commit that referenced this pull request Sep 10, 2026
…rifted (#736)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant