Story: Party codename

Table of Contents

This page documents a story in Sprint 14. It captures the goal, current status, acceptance criteria, and the tasks that compose it.

Goal

Add adjective_noun codenames per party for per-party queue isolation; fix the race conditions the simple trigger approach surfaced; switch to a sequence-based suffix that survives batch inserts.

Status

Field Value
State DONE
Parent sprint Sprint 14
Now Completed 2026-03-12.
Waiting on None.
Next None.
Last touched 2026-03-12

Acceptance

  • Codename auto-generated per party via ores_utility_generate_whimsical_name_fn().
  • TOCTOU race fixed with pg_advisory_xact_lock (then superseded).
  • Sequence-based unique suffix (ores_utility_to_base26_fn) guarantees uniqueness under batch insert.
  • party_repository::write(vector) reinstated as proper batch insert.

Tasks

Task State Start End Description
Add party codename and report scheduling UI DONE 2026-05-20 2026-03-03 adjective_noun codename per party via ores_utility_generate_whimsical_name_fn(); used as prefix for per-party PGMQ queues ({codename}_report_events); codename visible (hidden by default) + read-only in detail dialog; enhanced report scheduling UI; centralised stamp_auth helper in tenant_aware_handler; party-scoped MQ visibility (ores_mq_list_party_queues_fn + ores_mq_metrics_party_fn + ores_mq_metric_samples_fn); idempotent MQ metrics scrape job registration.
Fix TOCTOU race in party codename trigger DONE 2026-05-20 2026-03-04 Address the time-of-check-to-time-of-use race in party codename generation by adding pg_advisory_xact_lock inside the BEFORE INSERT trigger; serialises codename generation; fixes intermittent CI duplicate-key failures.
Fix codename with sequence-based unique suffix DONE 2026-05-20 2026-03-12 Replace the advisory-lock + NOT-EXISTS loop with a sequence-based suffix: ores_refdata_party_codename_seq + ores_utility_to_base26_fn produce unique lowercase base-26 suffixes appended to whimsical names; simplified trigger; party_repository::write(vector) reinstated as proper batch insert.

Decisions

Codename as PGMQ queue prefix
per-party isolation outside RLS; queue names are human-readable + greppable.
Sequence-based suffix over advisory lock
the advisory lock was ineffective for batch inserts; a sequence is correct by construction.
Base-26 lowercase encoding
keeps the suffix readable + satisfies the codename regex.

Out of scope

  • User-renameable codenames — read-only on purpose.

See also

Emacs 29.1 (Org mode 9.6.6)