Skip to content

feat(compliance): aggregate EEO report resource - #18

Merged
thinkclay merged 1 commit into
mainfrom
feat/employer-eeo-report
Aug 11, 2026
Merged

thinkclay merged 1 commit into
mainfrom
feat/employer-eeo-report

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

The employer half of EEO reporting. Pairs with the /v1/employer/eeo-report route in Scaffald/SaaS#535.

Counts only, by design

core.eeo_self_identification holds protected-class data. Migration 305's policy is auth.uid() = user_id — an applicant reaches their own row and nobody else's — and migration 343 granted authenticated only SELECT and INSERT, because a voluntary self-identification is an audit record rather than an editable field.

So there is deliberately no method that returns an individual self-identification, and no parameter that could narrow a cohort down to one person. client.compliance.getEEOReport() returns aggregates the server computed.

Two things the types encode

impactRatio: number | null. Null means the four-fifths ratio cannot be computed — no applicants, nobody hired anywhere, or a cell suppressed for being too small — not that the ratio is zero. This matters concretely: the screen this replaces divided by the highest selection rate unconditionally, so an organisation that had hired nobody rendered NaN% ✓ Pass. Coercing null to 0 is the mirror-image bug, reporting adverse impact that was never measured. Same for selectionRate.

coverage carries the denominator. Self-identification is voluntary. A report over 4 of 900 applicants is not evidence of anything, and a reader needs that ratio in front of them before acting on any number in the report.

Verification

4 new tests, including that absent params are omitted rather than stringified (organization_id=undefined would 400 against the uuid schema) and that a null impactRatio survives the round trip. Full suite 781 passed; pnpm lint, pnpm typecheck and pnpm build clean.

The route itself was driven end to end against a live local database before this PR: a hand-computed fixture of 5 self-identifications reproduced exactly (white 2 applicants / 2 interviewed / 1 offer, black 3 / 0 / 0, both suppressed below the minimum cell size, all ratios null because nobody was hired), and a cross-organisation probe 403s.

The employer half of EEO reporting (Scaffald/SaaS#535). Pairs with the
/v1/employer/eeo-report route.

Counts only, by design. core.eeo_self_identification holds protected-class
data whose RLS policy is `auth.uid() = user_id` — an applicant reaches
their own row and nobody else's. There is deliberately no method here that
returns an individual self-identification, and no parameter that could
narrow a cohort to one person.

Two things the types encode that callers get wrong otherwise:

- `impactRatio: number | null` — null means the four-fifths ratio cannot be
  computed (no applicants, nobody hired anywhere, or a suppressed cell),
  not that it is zero. Rendering null as 0% reports adverse impact that was
  never measured. Same for `selectionRate`.

- `coverage` carries the denominator. Self-identification is voluntary, so
  a report over 4 of 900 applicants is not evidence of anything, and the
  reader needs to see that before acting on a ratio.

4 tests; full suite 781 passed.
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.

1 participant