Skip to content

feat(jobs): make /jobs public, and stop the listing answering with 95 columns - #760

Merged
thinkclay merged 2 commits into
mainfrom
feat/756-public-jobs-list
Sep 15, 2026
Merged

thinkclay merged 2 commits into
mainfrom
feat/756-public-jobs-list

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

sitemap-pages.xml has listed /jobs at priority 0.8 while the route lived under
app/(protected). An anonymous visitor — a crawler included — got a signed-in
shell, a spinner, and a redirect to /auth about forty seconds later. #734 had
already made the /jobs/ detail pages public and crawlable; the list they
are reached from was the half still behind the gate.

Nothing in the backend needed opening. GET /v1/jobs answers anonymous callers
in production today (verified against auth.scaffald.com with the anon key), and
the SDK provider already falls back to that key when there is no session. Only
the layout above the screen ever stopped it, so the listing moves to
app/(public)/jobs/index.tsx and signed-in and signed-out visitors get the same
DiscoverJobsScreen.

Being reachable made the payload worth reading. The handler was select("*") —
all ~95 columns of core.jobs to anyone who asked, including auto_reject_criteria,
min_reputation, minimum_score, internal_job_code, cost_center, hiring_manager_id,
recruiter_id, utm_parameters and search_tsv. The route's own response schema has
said "simplified public fields" since it was written, so the * was contradicting
the declared contract, not extending it. PUBLIC_JOB_COLUMNS is the union of that
schema, what the SDK's Job type promises, and what InternalJobCard renders: 30
columns, all verified present on the table, 70 dropped. Confidential rows are
excluded too, via is_confidential rather than visibility — production rows carry
a visibility column that no migration in this repo creates, so naming it would
work remotely and fail on a freshly migrated database.

It also adds the organization embed, which the list never returned even though
the card has always read job.organization. Every other consumer of this endpoint
— SavedJobsScreen, useUniversalSearch — reads only fields inside the kept set.

Crawlable content is the metadata plus an ItemList of the loader's rows pointing
at each /jobs/. A second server-only list would mean two trees that have
to agree, which is the hydration failure already tracked in #679/#681, for
content Google reads out of structured data anyway.

Two smaller things the move exposed:

  • useUserApplications ran with enabled: true, so every anonymous visit now
    fires a guaranteed 401 for a set that is necessarily empty. Gated on session.
  • No DrawerLayout here, matching /jobs/. DrawerContent has no signed-out
    variant — it renders an avatar and a "Sign out" item unconditionally, which
    is the account chrome the issue objected to. Signed-out navigation is its own
    piece of work and is filed separately.

The test is the static form of what the issue asked for. An end-to-end walk of
the sitemap needs Supabase, the api function and a warm dev server — the same
preconditions that have kept tests/e2e/profile and tests/e2e/office from ever
running (#553, #592). This one needs the filesystem, so it runs on every PR.
Confirmed it fails on the defect rather than assuming it: restoring
(protected)/jobs/index.tsx turns "lists only routes outside the authenticated
groups" red, and removing it turns it green again.

Typecheck is unchanged by this — 195 pre-existing errors on the base, 194 with
these changes, none in a file touched here.

Closes #756


🤖 Generated with Claude Code

@thinkclay

Copy link
Copy Markdown
Contributor Author

Lint REST API Code is red here for a reason that is not in this diff: main has been failing that job since #758 merged (d2f52ff), where deno fmt --check finds one unformatted import in __tests__/routes/policies-have-grants.test.ts. Every PR opened since inherits it.

Fixed separately so it can land on its own — this branch will go green once it is rebased on that.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results


thinkclay and others added 2 commits September 14, 2026 20:48
… columns

sitemap-pages.xml has listed /jobs at priority 0.8 while the route lived under
app/(protected). An anonymous visitor — a crawler included — got a signed-in
shell, a spinner, and a redirect to /auth about forty seconds later. #734 had
already made the /jobs/<slug> detail pages public and crawlable; the list they
are reached from was the half still behind the gate.

Nothing in the backend needed opening. GET /v1/jobs answers anonymous callers
in production today (verified against auth.scaffald.com with the anon key), and
the SDK provider already falls back to that key when there is no session. Only
the layout above the screen ever stopped it, so the listing moves to
app/(public)/jobs/index.tsx and signed-in and signed-out visitors get the same
DiscoverJobsScreen.

Being reachable made the payload worth reading. The handler was select("*") —
all ~95 columns of core.jobs to anyone who asked, including auto_reject_criteria,
min_reputation, minimum_score, internal_job_code, cost_center, hiring_manager_id,
recruiter_id, utm_parameters and search_tsv. The route's own response schema has
said "simplified public fields" since it was written, so the * was contradicting
the declared contract, not extending it. PUBLIC_JOB_COLUMNS is the union of that
schema, what the SDK's Job type promises, and what InternalJobCard renders: 30
columns, all verified present on the table, 70 dropped. Confidential rows are
excluded too, via is_confidential rather than visibility — production rows carry
a visibility column that no migration in this repo creates, so naming it would
work remotely and fail on a freshly migrated database.

It also adds the organization embed, which the list never returned even though
the card has always read job.organization. Every other consumer of this endpoint
— SavedJobsScreen, useUniversalSearch — reads only fields inside the kept set.

Crawlable content is the metadata plus an ItemList of the loader's rows pointing
at each /jobs/<slug>. A second server-only list would mean two trees that have
to agree, which is the hydration failure already tracked in #679/#681, for
content Google reads out of structured data anyway.

Two smaller things the move exposed:

  * useUserApplications ran with `enabled: true`, so every anonymous visit now
    fires a guaranteed 401 for a set that is necessarily empty. Gated on session.
  * No DrawerLayout here, matching /jobs/<slug>. DrawerContent has no signed-out
    variant — it renders an avatar and a "Sign out" item unconditionally, which
    is the account chrome the issue objected to. Signed-out navigation is its own
    piece of work and is filed separately.

The test is the static form of what the issue asked for. An end-to-end walk of
the sitemap needs Supabase, the api function and a warm dev server — the same
preconditions that have kept tests/e2e/profile and tests/e2e/office from ever
running (#553, #592). This one needs the filesystem, so it runs on every PR.
Confirmed it fails on the defect rather than assuming it: restoring
(protected)/jobs/index.tsx turns "lists only routes outside the authenticated
groups" red, and removing it turns it green again.

Typecheck is unchanged by this — 195 pre-existing errors on the base, 194 with
these changes, none in a file touched here.

Closes #756

Co-Authored-By: Claude Opus 5 <[email protected]>
Reviewing the narrowed schema against a live response turned up one field that
disagreed with the wire, and it predates this branch: `description` is declared
`z.string()` while `core.jobs.description` is JSONB holding TipTap rich-text
(001_schema.sql:145 — and 007's FTS index reads it through
`extract_tiptap_plain_text`, which only makes sense for JSON). A production
response returns an object.

Every other column in PUBLIC_JOB_COLUMNS was checked the same way, against
either an observed value or its migration: `security_clearance_required` TEXT,
`travel_percentage` INTEGER (now declared `.int()`), `pay_frequency` TEXT,
`number_of_openings` INTEGER, `minimum_years_experience` INTEGER,
`application_deadline` TIMESTAMPTZ, `job_category` TEXT, `benefits_summary`
TEXT, `minimum_education_level` TEXT, `position_level` TEXT,
`required_soft_skills` JSONB. Those all matched.

Nothing breaks either way — `@hono/zod-openapi` does not validate responses
here, which is exactly why it went unnoticed — but the schema is the published
contract and this PR is the one asserting it now matches reality. Leaving a
known-false line in it would undo the point.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay force-pushed the feat/756-public-jobs-list branch from 664fb55 to e43ac69 Compare September 15, 2026 00:48
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results


@thinkclay
thinkclay merged commit 1488e50 into main Sep 15, 2026
14 checks passed
@thinkclay
thinkclay deleted the feat/756-public-jobs-list branch September 15, 2026 00:58
thinkclay added a commit that referenced this pull request Sep 15, 2026
…ing (#767)

#760 moved the jobs listing to `(public)` and deleted the `index` screen from
`(protected)/jobs/_layout.tsx`, but left the layout file. A `_layout.tsx` makes
its directory a navigator that claims the directory's own path, so two screens
claimed `"jobs"` — asked of expo-router's own resolver:

    "jobs"        /(protected)/jobs        <- navigator, no index child
    "jobs"        /(public)/jobs/index     <- the public listing
    "jobs/:slug"  /(public)/jobs/[slug]

React Navigation matches the first, found a navigator with no screen for the
path, rendered nothing, and expo-router's history sync rewrote the URL. In
production `/jobs` returned 200 with no title, no description, no canonical and
no JSON-LD, then showed the marketing landing page. The server route was built
and deployed the whole time (`λ Bundled … (public)/jobs/index.tsx`), which is
why it looked fine from the build log.

The chrome moves one level down — `saved/`, `applications/`, `my-listings/` and
`view/` each mount the shared JobsSectionLayout — so the `jobs` segment has no
navigator and the public listing is the only claim on `"jobs"`. Every child URL
is unchanged; the resolver confirms `jobs/saved`, `jobs/applications`,
`jobs/applications/:applicationId`, `jobs/my-listings` and `jobs/view/:id` all
still resolve, and those screens keep their drawer and ErrorBoundary.

Verified rather than assumed:

  * `curl localhost/jobs` now returns the title, description and canonical that
    production returns empty.
  * `location.pathname` stays `/jobs` after hydration instead of rewriting.
  * route-shadowing.test.ts fails on the shipped state, naming it exactly —
    `/jobs ← navigator ./(protected)/jobs/_layout.tsx shadows
    ./(public)/jobs/index.tsx` — and passes once the layout moves.

That test is the point. route-collisions.test.ts compares page files and skips
anything beginning with `_`, so a layout-versus-page collision was invisible to
it; sitemap-routes-are-public.test.ts only asks which group a file sits in. Both
guards read the filesystem. This one reads what expo-router actually resolves,
via its own getRoutes, so it cannot drift from the router the way a
re-implementation does. If those internals move, it fails loudly — it asserts
the tree is non-trivial first, so a broken import cannot make it vacuously
green.

Closes #766

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/jobs is indexed in the sitemap but redirects anonymous visitors to /auth

1 participant