Skip to content

PhoenixKit 2.3.0: Country lists in the visitor's language, with your countries first

PhoenixKit 2.3.0 shows country lists in the visitor’s language with the countries you choose at the top, adds GitHub and Amazon Bedrock as integration providers, and fixes scheduled jobs that never ran on some installs.

Country lists

Country selects now use the names of the active language, sorted by those names. A language without data for a country falls back to the untranslated name for that country only, so no country goes missing. Accents are ignored when sorting, so in languages that give letters such as Ü or Å their own place in the alphabet, the order is close but not exact.

The organization settings in the admin get a Main countries card for the countries shown at the top of every country list. Countries can be dragged into order, or moved with buttons from the keyboard, and added from a searchable list. The card suggests countries near your organization’s own country. Until you save a list, country lists stay plain alphabetical.

Two new integration providers

  • GitHub takes a fine-grained, read-only personal access token.
  • Amazon Bedrock takes a long-term API key and a region. The connection test lists the foundation models in that region, which proves the key, the region and the permission at once. Bedrock can be used for AI completions.

Both come with step-by-step setup instructions. The AWS SES connection test now also reports the account id and which of SES, SQS and SNS the key may use.

Scheduled jobs that run

  • With debug logging on, the sweep that publishes scheduled jobs crashed before doing any work, every time, so nothing scheduled was ever published.
  • Upgrades never added the scheduled_jobs queue to the Oban config on installs from a certain period, so those jobs piled up and never ran. mix phoenix_kit.update now adds it. The code that adds Oban queues to config.exs could also corrupt the file in some layouts; it is now one shared, safer routine.
  • The upgrade that was supposed to replace the old posts publishing worker in the cron config did nothing, and said it had. It now works, and tells you to remove one entry if you run both.
  • mix phoenix_kit.doctor has a new Oban Cron Queues check for cron entries whose queue this server does not run.

Other fixes

  • Assigning roles could deadlock against permission edits, and every registration waited on one locked row. Both are fixed.
  • The editor script loaded from the CDN was Leaf 0.3.2 while the app ran Leaf 0.5.1. It now matches.

Upgrading

No migration. Run mix phoenix_kit.update so it adds the missing scheduled_jobs queue. Adding the queue releases any jobs that piled up all at once.

Full release notes: PhoenixKit 2.3.0

2.3.0 · 13 August 2026

Localized country selects with operator-chosen pinning, two new integration providers, and a scheduled-jobs sweep that no longer dies at :debug. No schema change — the chain stays at V166.

Added

  • Country selects follow the active locale, and an operator can pin the countries they actually serve. countries_for_select/1, eu_countries_for_select/1 and get_country_name/2 take :locale (defaulting to the active Gettext locale, dialects reduced to their base — ru-RU → ru) and :priority (alpha-2 codes pinned to the top, defaulting to the new country_select_priority setting). Names come from BeamLabCountries.Translations and a locale with no data falls back per country, so a host only ever loses the translation, never the entry. Sorting moves to the localized name with NFD accent folding — a deliberate approximation, not collation; locales that give diacritics their own alphabet position (Estonian’s Ü, Swedish’s Å/Ä/Ö) are sorted into the base letter’s block instead. Both functions still work with no arguments (#708).

  • A “Main countries” card on Admin → Settings → Organization to choose that pinned list: drag to reorder, keyboard move buttons alongside (SortableJS is a CDN fetch a strict CSP can block, and dragging has no keyboard path), a searchable picker, and a suggestion derived from the organization’s own country by great-circle distance rather than from a constant baked into the library. Nothing is pinned until an operator stores a list (#708).

  • GitHub and Amazon Bedrock integration providers. GitHub takes a fine-grained read-only PAT, validated against /rate_limit. Bedrock takes a long-term API key (plain Bearer, no SigV4) plus a region, validated with a new :amazon_bedrock strategy that lists foundation models in that region — the cheapest call proving the key, the region and bedrock:CallWithBearerToken at once. Bedrock declares :ai_completions; both carry step-by-step setup instructions (#707).

  • mix phoenix_kit.doctor gained “Oban Cron Queues” — reports crontab entries whose queue this node does not run, resolving queues the way Oban.Plugins.Cron does and staying quiet where a warning would be wrong (queues: false, queues: [], testing: :inline | :manual). Its warning says what taking the advice will do: configuring the queue releases the whole backlog at once (#710).

  • aws_ses “Test connection” now reports the account id and which management APIs the key may use (SES/SQS/SNS), via the same CredentialsVerifier sweep the Emails settings page runs. Strictly additive — the send-quota probe remains the verdict, and enrichment failing can never downgrade it (#707).

Fixed

  • The scheduled-jobs sweep died before doing any work, at :debug. ProcessScheduledJobsWorker.perform/1 logged job.id, but ScheduledJob’s key is :uuid. Logger.debug defers evaluation, so at :info the interpolation never ran and the mistake stayed invisible; at :debug it raised KeyError before reaching process_pending_jobs/0, and with max_attempts: 1 Oban discarded the sweep rather than retrying. A host running debug logging published nothing at all, silently, for as long as it ran (#710).

  • Upgrading never added the scheduled_jobs queue. The crontab entry entered the generated config on 2025-12-28 without it; the fresh-install block was fixed in 1.7.63 but the upgrade path had no helper for that queue, so hosts installed in between were never repaired — one was found 15 days in with 21,337 jobs stuck in available, growing ~1,440/day, because Pruner deletes terminal states only. ensure_scheduled_jobs_queue/2 fills the gap (#710).

  • Every ensure_*_queue helper now shares one hardened implementation. The six that predated scheduled_jobs each hand-rolled the same string surgery on the host’s queues: list and reproduced the same defects — worse than the missing queue, because a bad insert corrupts config.exs: queues: [\n] wrote queues: [,, a nested default: [limit: 10] swallowed the insert into an option Oban rejects at boot, and an Oban block with no queues: of its own let the scan walk into a neighbouring application’s config. Their unanchored guards were also satisfied by a key merely ending in the queue’s name, so a host’s own push_notifications: 5 silently suppressed the real notifications queue.

  • The cron migration claimed to replace the old posts worker and did not. The replacement literal named PhoenixKit.Posts.Workers.PublishScheduledPostsJob, a module in no repo — the real one is PhoenixKitPosts.Workers.…. The guard matched, the replace found nothing, and being cond’s first clause it shadowed every later case, so the core worker was never added either: an upgrading host kept the old entry, gained nothing, and was told the opposite. Hosts running both entries are now told to remove one rather than silently given a duplicate (#710).

  • The editor bundle is pinned to the leaf release we actually resolve. The CDN tag still served v0.3.2 while hex resolved 0.5.1 — almost everything leaf adds is a server↔client contract, so the stale bundle rendered an identical editor and quietly stopped implementing what the server expected. A test now compares the pin against Application.spec(:leaf, :vsn) so the two cannot drift again (#709).

  • The Organization settings page no longer builds country labels by concatenating a nilable flag, which would have raised ArgumentError in load_settings/1 and taken the whole page down. Every current beamlab_countries row carries a flag; this stops depending on that.

  • Role rows are no longer a deadlock hotspot. Every insert into phoenix_kit_user_role_assignments makes PostgreSQL take a FOR KEY SHARE lock on the referenced phoenix_kit_user_roles row to validate the foreign key — and two paths were taking a conflicting plain FOR UPDATE on those same rows: Roles.ensure_first_user_is_owner/1 (the Owner row, on every registration) and Permissions.lock_role_for_update/2 (the target role row, on every grant/revoke/set_permissions). Assigning a role therefore blocked on unrelated permission edits, and two transactions each holding one role row and then referencing the other’s deadlocked outright (40P01). Both sites now use FOR NO KEY UPDATE: neither mutates the role’s key, so the guard still excludes the writers it exists to exclude while leaving FK checks free.

  • Registration no longer serializes app-wide. ensure_first_user_is_owner/1 held that Owner-row lock on every single registration, so all registrations queued behind one row for the life of the install. Once an active Owner exists the answer can never flip back to “you are the first user”, so the count is now read unlocked and the lock is taken only while no Owner exists. A missing Owner role row also rolls back cleanly instead of raising.

  • Silenced DBConnection.OwnershipError in PhoenixKit.Settings reads. It is the Ecto-sandbox spelling of repo_available?() == false, which this module already answers with a silent nil; it cannot occur outside a sandboxed repo, so no production logging changes. It was emitting ~960 lines per mix test run and burying real failures.

  • Fixed a call to the nonexistent PhoenixKit.repo/0 in the notifications inbox-grouping test (RepoHelper.repo/0), which had never run.

i18n

  • New msgids for the Main countries card (et, ru, en) (#708).

PhoenixKit 2.3.0. Install or update: {:phoenix_kit, "~> 2.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.