Bug fixes
Rejected domains PATCH now re-reads before classifying a concurrent fill (issue #917)
set_company_domain_if_empty’s two error branches after a rejected domains
PATCH classified the same race outcome differently. The non-matching branch
(uniqueness conflict, 5xx, schema mismatch) re-reads the record and, if a
concurrent writer filled the domains slot in the pre-PATCH-GET → PATCH
window, returns domains_already_set → orchestrator noop_had_domain. The
matching validation_type rejection introduced in #898 (to fix #888)
early-returned domain_invalid without that re-read, so the identical race
outcome — a record that ends with a domain — was classified unresolved
(“still needs a domain”). A single-run counter off-by-one that self-corrects
on the next run, but the two branches disagreed on the identical race
outcome, which misleads anyone tracing an unresolved for a record that
visibly has a domain.
The matching branch now re-reads before classifying, and a single
conditional return chooses domains_already_set (concurrent writer won) or
domain_invalid (still empty), so both error branches agree on the race
outcome. The re-read failure path re-raises the original PATCH error
(raise exc from e), mirroring the non-matching branch’s error-handling
contract — no swallowing of server rejections. The narrow recheck preserves
the #888/#898 fix (empty → unresolved) and restores the race case (filled →
noop_had_domain); the matching branch is collapsed to a single return to
stay under the lint return-count.Last modified on October 3, 2026