You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(api): both /v1/profiles slug endpoints always 500 — org selects 5 nonexistent columns, core.employers does not exist #482
GET /v1/profiles/organizations/:slug and GET /v1/profiles/employers/:slug both return 500 for every request. These are the 10 failures #464 set aside as "missing from the local schema cache" — that diagnosis is wrong for the organizations half, and the employers half is worse than it sounds.
Actual causes
Organizations — 5 tests.core.organizations exists. The route selects columns it does not have:
column organizations.industry does not exist
packages/supabase/functions/api/routes/profiles.ts:913 selects industry, size, location, founded_year and filters .eq("is_public", true). The real table has:
So five referenced fields are absent: industry (there is an industry_id FK), size, location (there is address/geo), founded_year, and is_public (there is visibility). OrganizationProfileSchema promises all of them.
Employers — 5 tests.core.employers does not exist in any schema:
Could not find the table 'core.employers' in the schema cache
The route at profiles.ts:1030 queries it anyway, and the fixture inserts into it.
Reproduce
cd packages/supabase && deno test --allow-all --no-check \
--config=functions/api/deno.json functions/api/__tests__/routes/profiles.test.ts
10 failures, all in the organizations and employers groups. (The other 17 pass as of #479.)
Why this needs a decision first
Not mechanical:
Organizations: does industry resolve through industry_id, and where do size and founded_year come from — new columns, or dropped from the response schema? Is locationaddress, geo, or a formatted composite? is_public presumably becomes a visibility check, but the values matter.
Employers: is this a real concept that was never migrated, or dead code to delete along with its route, schema and tests? The legacy tRPC routers do not reference core.employers either.
Either answer is reasonable; picking one without product input risks freezing the wrong contract into a public endpoint.
The organizations half of this is fixed — #617 (merged). GET /v1/profiles/organizations/{slug} now selects the real columns, joins core.industries through industry_id, and filters on visibility; it returns 200 with a correct job_count (verified 4 against 4 open jobs). The two profiles.test.ts cases it was failing now pass.
That PR also fixed a second bug hiding behind this one: both job counts filtered status = "published", which core.jobs' CHECK constraint does not permit (draft|open|paused|closed), so every employer showed 0 open jobs. It was invisible because the route 500'd before reaching the count.
The employers half is #618 — it queries core.employers, a table in no schema, and has no UI consumer, so it needs a decision rather than a fix.
Both are now rolled up under #660, and #651 adds a test that fails on any new reference to a nonexistent table.
Activity
test(api): fail when a route reads a table that does not exist
thinkclay commentedon Aug 27, 2026
The organizations half of this is fixed — #617 (merged).
GET /v1/profiles/organizations/{slug}now selects the real columns, joinscore.industriesthroughindustry_id, and filters onvisibility; it returns 200 with a correctjob_count(verified 4 against 4 open jobs). The twoprofiles.test.tscases it was failing now pass.That PR also fixed a second bug hiding behind this one: both job counts filtered
status = "published", whichcore.jobs' CHECK constraint does not permit (draft|open|paused|closed), so every employer showed 0 open jobs. It was invisible because the route 500'd before reaching the count.The employers half is #618 — it queries
core.employers, a table in no schema, and has no UI consumer, so it needs a decision rather than a fix.Both are now rolled up under #660, and #651 adds a test that fails on any new reference to a nonexistent table.
test(api): fail when a route reads a table that does not exist (#651)
fix(profiles): OrganizationProfile described a response the API has n…
fix(api): the organization profile contract described a response it h…
test(api): the profiles suite asserted the contract #482 retired, and…