-- +goose Up -- THE AEDT CANDIDATE NOTICE, FROM A ROUTE NOBODY CALLS TO A RULE THAT HOLDS. -- -- POST /candidates/{id}/notice has existed and worked since the governance module shipped. It has never been -- called: production carries three candidate evaluations and ZERO notices. Every one of those three people -- was scored by an automated employment decision tool without a disclosure record existing. -- -- WHAT THE LAW ASKS. New York City Local Law 144 requires an employer to notify a candidate at least ten -- business days BEFORE an automated employment decision tool is used on them, and to say which job -- qualifications and characteristics the tool assesses. The EU AI Act classifies hiring as high risk and its -- obligations apply from August 2026. Illinois and Colorado have their own. The common shape across all of -- them is the same: tell the person first, and be able to prove you did. -- -- WHY THIS IS A SETTING AND NOT A HARD BLOCK. Turning the rule on for an existing customer would refuse to -- score their entire bench the moment they upgraded, because nobody has notices on file yet. That is not -- safety, it is an outage. So the rule ships OFF, the settings screen states plainly what the law asks, and -- an owner turns it on when their notices are in place. What ships ON for everybody is the ABILITY to record -- a notice and to see, per candidate, whether one exists, because a firm cannot comply with a rule it has no -- way to satisfy. -- -- THE DEFAULT IS THEREFORE A DELIBERATE CHOICE TO NOT ENFORCE, and it is recorded here as one rather than -- left to look like an oversight. ALTER TABLE org_settings ADD COLUMN aedt_notice_required boolean NOT NULL DEFAULT false; -- The index the gate needs. The check runs on the scoring path, which is the hottest write in the product, -- and asks one question: does this candidate have a notice. Without the index that is a scan of every notice -- the organization has ever issued, on every score. -- -- DESC on the disclosure time so the newest notice is the first row read: what the gate wants is the most -- recent one, and a candidate legitimately accumulates notices as the disclosure version changes. CREATE INDEX IF NOT EXISTS idx_aedt_notices_candidate ON aedt_candidate_notices (organization_id, candidate_id, disclosed_at DESC); -- +goose Down DROP INDEX IF EXISTS idx_aedt_notices_candidate; ALTER TABLE org_settings DROP COLUMN IF EXISTS aedt_notice_required;