Repository navigation
feat(compliance): aggregate EEO report resource - #18
Merged
Merged
Conversation
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.
This was referenced Aug 11, 2026
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.
The employer half of EEO reporting. Pairs with the
/v1/employer/eeo-reportroute in Scaffald/SaaS#535.Counts only, by design
core.eeo_self_identificationholds protected-class data. Migration 305's policy isauth.uid() = user_id— an applicant reaches their own row and nobody else's — and migration 343 grantedauthenticatedonly 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 renderedNaN% ✓ Pass. Coercing null to 0 is the mirror-image bug, reporting adverse impact that was never measured. Same forselectionRate.coveragecarries 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=undefinedwould 400 against the uuid schema) and that a nullimpactRatiosurvives the round trip. Full suite 781 passed;pnpm lint,pnpm typecheckandpnpm buildclean.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.