Repository navigation
feat(compliance): wire the EEO report to real data - #567
Merged
Merged
Conversation
Closes #535. The screen rendered hardcoded constants — invented applicant counts, invented selection rates, invented adverse-impact ratios — on a page that presents itself as a compliance artifact. Adds GET /v1/employer/eeo-report, backed by a pure aggregation module, and wires the screen to it. Every MOCK_ constant is gone. Privacy shape first, because it drove the design. core.eeo_self_ identification holds protected-class data; migration 305's policy is `auth.uid() = user_id` and 343 withheld UPDATE/DELETE from authenticated because a self-identification is an audit record. Employers get counts, never rows. There is deliberately no endpoint returning an individual record and no filter that could narrow a cohort to one person. Cells below a minimum size are suppressed — an aggregate of one *is* an individual record, which is the thing 343 exists to prevent. Four bugs found in the arithmetic while replacing it: - Adverse-impact ratios divided by the highest selection rate unconditionally. With nobody hired that is 0/0, and `NaN < 0.8` is false, so the badge rendered "NaN% ✓ Pass" — a false all-clear on a filing. `impactRatio` is now `number | null`, and null renders as an em dash. - The overall hire-rate tile divided the same way: "NaN% rate". - The adverse-impact flag tile counted only the three gender ratios, so a flag against an ethnicity — the dimension an EEO-1 exists for — never reached the summary. - The ethnicity table had no four-fifths column at all. The ratio was computed and never shown, so nobody could see which group was flagged. Also: withdrawn applicants leave the selection-rate denominator and are reported separately (#533). A withdrawal is not a rejection, and counting one as such invents adverse impact that did not occur. "Declined to State" now appears in every dimension — the mock dropped it, so the tables did not add up to the applicant count. Uncategorised requisitions roll into a visible bucket rather than vanishing. Stage counts derive from history, so someone rejected after interviewing still counts as interviewed. The screen now states its coverage: how many applicants self-identified out of the total. Self-identification is voluntary, and a ratio over 4 of 900 applicants is not evidence of anything. Verification: 13 Deno tests over a hand-computed fixture, every expected value written out in a comment (acceptance point 3). 13 screen tests. Mutation-checked on both sides — counting withdrawn in the denominator, deriving stages from current status only, dividing unconditionally, excluding suppressed groups from the reference rate, rendering null as 0%, and counting flags from gender only each turn a test red. Driven end to end against a live local database: a 5-row fixture reproduced exactly, and a cross-organisation probe 403s. Export stays disabled. The figures are real now, but there is still no export implementation — that button never had an onPress.
Contributor
📊 Performance Benchmark Results |
This was referenced Aug 11, 2026
feat(compliance): collect EEO self-identification — nothing writes core.eeo_self_identification
#568
Open
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.
Closes #535. Adds
GET /v1/employer/eeo-reportbacked by a pure, unit-tested aggregation module, and wiresEEOReportScreento it. EveryMOCK_constant is gone. SDK: Scaffald/sdk#18, merged.Privacy shape, because it drove the design
core.eeo_self_identificationholds protected-class data. Migration 305's policy isauth.uid() = user_id; migration 343 withheld UPDATE/DELETE fromauthenticatedbecause a voluntary self-identification is an audit record.Employers get counts, never rows. There is deliberately no endpoint returning an individual record and no filter that could narrow a cohort to one person. Cells below a minimum size are suppressed — an aggregate of one is an individual record, which is exactly what 343 was written to prevent.
The threshold is
MIN_CELL_SIZE = 5, a common floor for published EEO tabulations. This is a default I chose, not a legal determination — flagging it explicitly because it is the kind of number that should be confirmed rather than inherited from a PR.Four arithmetic bugs in what this replaces
NaN% ✓ Pass. Adverse-impact ratios divided by the highest selection rate unconditionally. With nobody hired that is0/0, andNaN < 0.8isfalse— so an organisation that had hired no one rendered a passing badge on a document people file.impactRatiois nownumber | null; null renders as an em dash.NaN% rate.Correctness decisions
Coverage is stated on screen
Self-identification is voluntary. The screen now says "N of M applicants self-identified", because a ratio computed over 4 of 900 applicants is not evidence of anything and the reader needs that before acting on any number.
Verification
countAdverseImpactFlagsand tightened the null-ratio assertion until they did.deno lintanddeno fmt --checkclean.Two things this does not do
Export stays disabled. The figures are real now, but there is still no export implementation — that button never had an
onPress. Leaving it enabled would give a screen whose purpose is producing a filing a control that silently does nothing.The report will read zero in every environment, because nothing collects self-identification yet:
core.eeo_self_identificationhas 0 rows on local, dev, preview and prod. That is the honest result and the screen says so explicitly rather than implying a clean bill of health. The collection form is blocked on the self-ID wording, which is a product/legal call and still open.Note migration 343 had not been applied to the local database (only dev/preview/prod), so these tables 403'd locally until I applied it — worth knowing for anyone running this branch.