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
feat(compliance): wire EEO report to real data from migration 305 #535
packages/scf-core/features/office/compliance/EEOReportScreen.tsx renders hardcoded constants. Migration 305_privacy_eeo_project_hiring.sql provides the real fields.
This is the follow-up to the issue that adds a "sample data" banner — that one removes the risk, this one removes the mock.
Work
Build the EEO aggregation query over real applications and hires, grouped by job group.
Wire EEOReportScreen to it; delete MOCK_JOB_GROUPS, GENDER_SUMMARY, VETERAN_SUMMARY.
Verify the four-fifths-rule adverse-impact math (already implemented at line 219) against a known dataset.
Ensure withdrawn applications are not counted as rejections (see the linked withdrawn issue) — this changes adverse-impact ratios.
Remove the sample-data banner only once the numbers are real.
Starting this surfaced two blockers. Neither is a reason to abandon it, but together they make this a feature rather than the wiring task the description implies.
1. The tables cannot be read by anything
Migration 305 created all seven of its tables with RLS enabled and zero GRANT statements. A missing GRANT fails before RLS is evaluated, so even service_role gets permission denied:
core.eeo_self_identification 403
core.eeo_reports 403
(and the five privacy/hiring-project tables alongside them)
Fixed in #558. Same class as 332_api_keys_grants and 335_scheduling_grants.
2. Nothing collects EEO data
grep -rn eeo_self_identification across packages/ and apps/ returns one hit — the generated types.ts. There is:
no self-identification form anywhere in the app,
no endpoint that writes the table,
no seed data.
So with grants fixed, the table is still empty, and wiring the report to it produces an all-zero report.
On a compliance screen, that is worse than the current labelled sample data. An adverse-impact panel showing 0 flags detected reads as "we checked and found no disparity". The truth would be "nobody has been asked". Those are very different statements to put in front of an auditor.
Collection — a voluntary self-identification step at application time, writing eeo_self_identification. This is the legally-sensitive part: EEOC/OFCCP have expectations about wording, voluntariness, the availability of "decline to state", and the separation of this data from hiring decisions. It should not be drafted by inference from a schema.
Aggregation — a server-side endpoint computing counts by job group under service_role, returning aggregates only. 305's RLS correctly forbids employers reading individual rows, and that must not be widened.
Wire the report, and have it distinguish no data collected from no adverse impact — an explicit empty state, not a zero.
Remove the sample-data banner only at that point.
Also unresolved: the mock groups applications by SOC code (47-2061, 11-9021). Nothing in the schema carries an occupation code on a job, so "job group" needs defining before aggregation can be written.
Recommendation
Land #558 now. Treat (2) as its own issue with product/legal input — I can build the form and endpoint once the wording is settled, but I should not invent the wording. (3) and (4) are then straightforward and I can take them.
The banner from #524 stays in place throughout, which is the right default: the screen keeps saying it is not a compliance record until it is one.
Unblocked on all three environments. Migration 343 is applied and recorded on dev, preview and prod as of today.
Before this, all seven tables migration 305 created had zero table-level GRANTs, so every access — including service_role — returned 42501 permission denied. They had been unreachable since creation, in production as well as locally. This issue could not have been implemented against a real database.
Verified per environment rather than assumed:
All seven tables return 200 to service_role over PostgREST; each returned 42501 before.
anon is still denied on eeo_self_identification, eeo_reports and privacy_data_requests — it was granted nothing, deliberately.
RLS is still enabled on 7/7 in all three.
The grant fingerprint (72 rows across the three roles) is byte-identical on dev, preview and prod, so there is no environment drift to discover later.
The EEO asymmetry from 305's policy is preserved intentionally: authenticated has SELECT, INSERT on eeo_self_identification and noUPDATE or DELETE. A voluntary self-identification is an audit record, not an editable field, and the RLS policy is auth.uid() = user_id, so an applicant reaches only their own row. Employers must never read individual rows — only aggregates computed server-side under service_role. Whatever this issue builds should keep that shape.
Note for whoever picks this up: the wording decision on the self-ID form is still open and is a product/legal call, not an implementation detail.
Activity
feat(office): connect the ATS — employer read path, status mapping, a…
thinkclay commentedon Aug 11, 2026
Starting this surfaced two blockers. Neither is a reason to abandon it, but together they make this a feature rather than the wiring task the description implies.
1. The tables cannot be read by anything
Migration 305 created all seven of its tables with RLS enabled and zero GRANT statements. A missing GRANT fails before RLS is evaluated, so even
service_rolegetspermission denied:Fixed in #558. Same class as
332_api_keys_grantsand335_scheduling_grants.2. Nothing collects EEO data
grep -rn eeo_self_identificationacrosspackages/andapps/returns one hit — the generatedtypes.ts. There is:So with grants fixed, the table is still empty, and wiring the report to it produces an all-zero report.
On a compliance screen, that is worse than the current labelled sample data. An adverse-impact panel showing
0 flags detectedreads as "we checked and found no disparity". The truth would be "nobody has been asked". Those are very different statements to put in front of an auditor.The real shape of the work
eeo_self_identification. This is the legally-sensitive part: EEOC/OFCCP have expectations about wording, voluntariness, the availability of "decline to state", and the separation of this data from hiring decisions. It should not be drafted by inference from a schema.service_role, returning aggregates only. 305's RLS correctly forbids employers reading individual rows, and that must not be widened.Also unresolved: the mock groups applications by SOC code (
47-2061,11-9021). Nothing in the schema carries an occupation code on a job, so "job group" needs defining before aggregation can be written.Recommendation
Land #558 now. Treat (2) as its own issue with product/legal input — I can build the form and endpoint once the wording is settled, but I should not invent the wording. (3) and (4) are then straightforward and I can take them.
The banner from #524 stays in place throughout, which is the right default: the screen keeps saying it is not a compliance record until it is one.
fix(db): grant the seven tables migration 305 created (#558)
thinkclay commentedon Aug 11, 2026
Unblocked on all three environments. Migration 343 is applied and recorded on dev, preview and prod as of today.
Before this, all seven tables migration 305 created had zero table-level GRANTs, so every access — including
service_role— returned42501 permission denied. They had been unreachable since creation, in production as well as locally. This issue could not have been implemented against a real database.Verified per environment rather than assumed:
service_roleover PostgREST; each returned42501before.anonis still denied oneeo_self_identification,eeo_reportsandprivacy_data_requests— it was granted nothing, deliberately.The EEO asymmetry from 305's policy is preserved intentionally:
authenticatedhasSELECT, INSERToneeo_self_identificationand noUPDATEorDELETE. A voluntary self-identification is an audit record, not an editable field, and the RLS policy isauth.uid() = user_id, so an applicant reaches only their own row. Employers must never read individual rows — only aggregates computed server-side underservice_role. Whatever this issue builds should keep that shape.Note for whoever picks this up: the wording decision on the self-ID form is still open and is a product/legal call, not an implementation detail.
feat(compliance): aggregate EEO report resource (#18)