Skip to content

Feature/death registry check - #2973

Open
maricavor wants to merge 11 commits into
masterfrom
feature/death-registry-check
Open

maricavor wants to merge 11 commits into
masterfrom
feature/death-registry-check

Conversation

@maricavor

@maricavor maricavor commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Close #2960

Checks Estonian private-person contacts (priv/EE) against the Population Register death open data and handles deceased registrants and contacts automatically, replacing the manual ENTITY_BURIED process. Full description, production setup and all message texts: doc/death_registry.md.

What was done

  • Local death file (DeathRegistry::FileBuilder, DeathRegistry::Lookup): the opendata.smit.ee CSVs are reduced to a sorted ident;date file, replaced atomically, with a minimum record count check. Lookups use binary search and refuse a missing or stale file.
  • Check at contact creation (EPP and REPP): a deceased person's ident is refused with 2003 "Ident is invalid". A missing file never blocks creation. Behind validate_deceased_contacts (off by default).
  • Daily DeathRegistryCheckJob: checks each linked contact once a year, rebuilds the file when it is older than 7 days, so production needs one cron line. Dry run by default (death_registry_dry_run): only a CSV report is emailed to the admin.
  • Deceased registrant: poll to the registrar at discovery; fast-track force delete (reason deceased_person) at death + 6 months + 1 day, after re-checking the person.
  • Deceased admin/tech contact: an optional contact is removed with a poll; the last required admin contact (organisation or minor registrant) starts a soft force delete (deceased_admin_contact), lifted by CheckForceDeleteLift once a new admin contact is added.
  • Existing force delete: the death fast track replaces it only if it releases the domain earlier. The replaced force delete is saved and restored (dates unchanged, clientHold at once if the outzone date has passed) when the death force delete stops and its reason still exists.
  • Person no longer in the register / admin cancel: the death date is cleared and the force delete stopped or the earlier one restored.
  • Admin: death date and check time on the contact page, contact list filter, force delete start date on the domain page, reasons in the daily force delete summary.
  • Fixes: the fast-track force delete email now uses the template of its reason (it could send the invalid email letter);
  • Migration: contacts.death_date, contacts.death_registry_checked_at and indexes.

Before go-live

  • Review the English poll drafts and the new deceased_admin_contact email (doc section 9).
  • Production dry run and report review, then add the cron line, enable validate_deceased_contacts and set death_registry_dry_run: 'false' (doc section 6).

maricavor and others added 10 commits November 5, 2026 16:05
Weekly job downloads the Population Register death open data
(andmed.eesti.ee "surmaandmed") and builds a sorted, fixed-width file of
Estonian personal identity codes and death dates. DeathRegistry::Lookup
binary searches it on disk and raises FileUnavailable when the file is
missing, stale or malformed, so a missing file never reads as "alive".

The old file is kept when a download fails, the CSV format changes or the
record count drops below death_registry_min_records.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Check new EE private contacts against the local death registry file
when validate_deceased_contacts is enabled. A deceased person is
rejected with EPP 2003 "Ident is invalid"; a missing or stale file
logs a warning and lets the contact through.

Add contacts.death_date and death_registry_checked_at with partial
indexes, show them in admin, and add a death registry filter to the
admin contact search.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DeathRegistryCheckJob checks each EE private contact linked to a domain
once a year against the local death registry file. A deceased person
gets a death_date; a deceased registrant whose death is less than six
months old triggers a poll message to the registrar for each domain.

The job rebuilds the file itself when it is older than seven days, so
production needs a single cron line. Dry run mode, on by default, saves
nothing and emails the admin a CSV report instead. File problems are
emailed to the admin.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DeathRegistryCheckJob starts a fast track force delete with reason
deceased_person on the domains of a registrant who died at least six
months ago. The person is looked up again before that and every day
during the force delete; if they are no longer in the death registry,
the death date is cleared and the force delete is cancelled. Domains
that already have a force delete are left alone for now.

Fast track force delete emails now use the template of the reason and
store template_name, so a deleted company no longer gets the invalid
email letter. A valid contact email no longer cancels a deceased
registrant's force delete, and an admin cancelling it clears the death
date.

Show the force delete start date in admin, include status notes in the
admin daily summary reason, and drop the Russian part of the force
delete email subject.
A deceased tech contact, or an admin contact the domain can do without,
is removed from the domain and the registrar gets a poll message. When
the last required admin contact of an organisation's or a minor's domain
has died, a soft force delete starts with reason deceased_admin_contact,
blocking renewal and transfer until a new admin contact is added.
CheckForceDeleteLift lifts it once the domain has enough living admin
contacts.

The person is looked up in the death registry again first; one who is
no longer there has the death date cleared. A valid contact email no
longer cancels the soft force delete, and an admin cancelling it clears
the deceased admin contacts' death date.
A deceased registrant's fast track force delete replaces an existing force
delete when it releases the domain earlier. The replaced force delete is
saved and restored when the death force delete stops (the person is no
longer in the death registry, or an admin cancels it), if its reason still
exists. Its dates are not moved; when its outzone date has passed, the
domain goes out of the zone at once. The registrar gets a poll message.
The reason selects the email to the registrant and administrative
contacts. Before, the letter was guessed from the domain data: any
private registrant got the "registrant has died" letter, and a contact
with a failing email turned any letter into the invalid email one.
"Other" sends no email. "Invalid email" is refused when no contact email
fails, as CheckForceDeleteLift would lift it the next day.

Mass action ENTITY_BURIED now uses the private or legal person letter by
registrant type instead of the guessed one.
@maricavor
maricavor force-pushed the feature/death-registry-check branch from 15308c5 to 845398e Compare November 5, 2026 14:07

This branch has not been deployed

No deployments
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.

Validate private contacts against death register

1 participant