Task: Fix TOCTOU race in party codename trigger

Table of Contents

This page documents a task in the Party codename story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Fix the time-of-check-to-time-of-use race in the party codename generation trigger.

Status

Field Value
State DONE
Parent story Party codename
Now Completed 2026-03-04.
Waiting on None.
Next None.
Last touched 2026-03-04

Acceptance

  • pg_advisory_xact_lock added inside the BEFORE INSERT trigger to serialise codename generation.
  • Intermittent CI duplicate-key failures resolved.

Plan

Captured during execution; cleared into the parent story on close.

Notes

First attempt at the race fix; the advisory lock approach proved insufficient under batch inserts — the next task replaces it.

Result

TOCTOU race resolved (for single-row paths).

Emacs 29.1 (Org mode 9.6.6)