Skip to content

Publishing 0.4.7: Deleted translations really go, and dialects get their own URLs

Publishing 0.4.7 fixes deleted translations that stayed public, gives sibling dialects their own URLs and closes many race conditions in the editor.

Deleting a language only marked its content as archived, and no page ever checked that, so the translation kept being served, kept its URL slug and came back as a draft in every new version. Deleting a translation now removes it; versions remain the way to undo. The primary language’s content can no longer be deleted, since it anchors the post; the editor says to edit it instead.

Also in this release:

  • A second dialect of one language, such as en-GB next to en-US, gets its own URL segment (/en-gb/…). Existing URLs do not change.
  • Public pages in a dialect such as fr-FR showed English text; they now use the right translation.
  • A newly added language with no content yet no longer appears as an empty published page or an “Untitled” listing card.
  • On a cluster, a listing change on one node clears the listing cache on the others.
  • Saves of posts and group settings lock their row, so parallel saves, publishes and AI translations no longer overwrite each other.
Full release notes: Publishing 0.4.7

0.4.7 · 4 August 2026

PR #38 — the public + admin language surfaces, sibling-dialect URLs, and a concurrency-hardening pass — plus the post-merge review fixes. 0.4.6 was tagged before this merge landed, so the whole wave ships here.

Added

  • Sibling dialects of one base now have their own public URLs. LanguageHelpers.public_url_segment/1 gives a non-owner dialect its full lowercase code (/en-gb/…) while the base’s owner dialect keeps the historical base segment (/en/…), so no existing URL changes. Routing, canonical redirects, the language switcher, feeds, and term archives all pin the segment through the same helper.
  • Cluster-wide listing-cache invalidation. ListingCache.CacheSync, a supervised node-local subscriber, erases this node’s :persistent_term listing entries when another node invalidates a group. :persistent_term is process-less, so a peer node’s warm cache previously kept serving pre-mutation listings (rename/trash/delete, category changes) until an unrelated local mutation. Erase-only — the next read rebuilds lazily, so an invalidation can never start a cluster-wide regeneration storm.
  • Canonical-prefix 301s for feeds, search results, and term archives, matching the plain listing. Feed redirects are strictly feed-to-feed.
  • Failure-side activity rows for category create/update/delete/reorder, translation add/clear/delete, version create, and public comment create — every user-driven mutation now leaves a db_pending audit row when it fails. ActivityLog.reason_string/1 keeps changesets (user free text) out of metadata.

Changed

  • delete_language/5 hard-deletes the content row instead of setting status: "archived". No read path ever filtered archived rows, so a “deleted” translation kept serving publicly, kept its url_slug claimed, stayed in available_languages, and create_version_from resurrected it as a draft in every new version. Versions remain the undo mechanism.
  • The primary language’s content row can no longer be deleted by clear_translation/5 or delete_language/5 — new :cannot_delete_primary_language error. It anchors publish validation, the post’s url_slug identity, and the public primary URL. A legacy base-code row ("en" while primary is "en-US") counts as primary; an enabled sibling ("en-GB") does not.
  • Collaborative form keys are version-scoped (<group>:<uuid>:v<N>:<lang>) and new-post keys are socket-scoped. Editors on v1 and v2 of the same language shared one lock/sync channel, and two admins composing new posts shared one lock.
  • Listing previews and feed item descriptions derive per-language. The version-level data["description"] carries no language, so it showed one language’s text under every language’s title; it is now only the last-resort og:description default.
  • Presence metas carry %{uuid, email}, not the full %User{} struct (hashed_password included — redact: only affects Inspect).
  • Removed the unrouted all-groups overview template and the dead dashboard_summary assign, build_summary/2, and PubSub.editor_presence_topic/1.

Fixed

  • StaleFixer could revert a concurrent publish. The active-version pointer heal is now a compare-and-swap (clear_active_version_if/2) and the orphan demotion is conditional on the pointer still being NULL (demote_version_if_orphaned/2), with a fresh re-read between them.
  • Post saves take the post row lock with an in-transaction version re-read, closing the save-vs-publish status TOCTOU and the lost updates parallel AI-translation jobs inflicted on version.data (tags and legacy promotions clobbering each other).
  • Group-settings saves take the group row lock and re-merge against the fresh data — two concurrent saves used to read the same snapshot and the second silently reverted the first’s setting keys.
  • Concurrent deletes could empty a version or a post. Translation clear/delete and version delete now re-check “is this the last one” under the lock.
  • name_i18n merges per key. The edit form only renders tabs for enabled languages, so a wholesale replace wiped the override of any language disabled after it was translated.
  • :translation_deleted now carries the version as a string, matching :translation_created and the editor’s current_version scope. An integer never compared equal, so the editor silently kept showing a language pill for a translation that no longer existed.
  • Sibling-language editors reload on shared version-field saves, via a mirrored :sibling_editor_saved broadcast on the post’s translations topic. Without it, a stale tab’s next autosave reverted the sibling’s categories and published_at (and so a timestamp post’s public URL).
  • A never-edited V1 post no longer loses its featured image and description on public surfaces — the mapper falls back to the legacy per-language content.data values until promotion-on-first-edit runs.
  • Untranslated stubs stop rendering as empty published pages. “Add language” writes {title: "Untitled", content: ""} onto the active version, instantly public; those now read as a missing translation and go through the smart fallback, and they no longer produce Untitled listing cards.
  • A slug displaced by the collision self-healer joins previous_url_slugs, so the established public URL 301s to the renamed one instead of being silently handed to the colliding post.
  • Date-count URL disambiguation is computed across all languages (Listing.group_date_counts/1) — URL resolution is language-agnostic, so a language-filtered count emitted a date-only URL whose same-day sibling merely lacked the viewer’s translation, resolving to a different post.
  • Public strings render in the right locale. Gettext.put_locale/2 is given the base code — catalogue directories are base-coded and gettext has no dialect fallback, so "fr-FR" matched nothing and every public string silently fell back to English. Comment-submission flashes set the locale too, and the notes section, live badge, and two admin page titles are now translatable.
  • Card excerpts are plain prose again: PHK component markup is stripped before derivation (a truncated tag used to survive as escaped junk), <style>/<script> bodies are dropped rather than inlined as a wall of CSS, and HTML entities are decoded so Fish & chips stops reading Fish &amp; chips.
  • A malformed post UUID no longer crashes the LiveView — read_post_by_uuid/3 casts first and returns {:error, :not_found}. Crafted switch_language / set_new_version_source payloads and bare /:group/edit URLs are handled too.
  • PostShow live-updates again (its handle_info head never matched the broadcast payload) and checks group membership, so one group’s post can no longer render under another group’s URL.
  • The admin dashboard stops multiplying its PubSub subscriptions. Phoenix.PubSub.subscribe/2 is not idempotent; every debounced refresh re-subscribed, delivering each post event N times.
  • AI source reads fail closed on a language mismatch — the read falls back to another language when the requested row is missing, and translating that text labelled as the source language fanned wrong output out to every target.
  • The category parent_uuid FK is constrained in the changeset, so a raced parent delete surfaces as a validation error rather than a 500.
  • Editor and admin fixes: typing in the create-group custom-type box no longer wipes name/slug and flips the mode radio; a group-slug collision flashes instead of raising CaseClauseError; erasing a custom url_slug restores the default as the UI promises; publish failures name the real reason and unblock language/version switching; remote version deletion does a full editor transition (form, client content, URL); stuck translation locks self-release when Oban reports no active jobs; language pills open the version that actually holds the language; branching a version keeps the language pin and clearing a translation keeps the version pin.

Publishing 0.4.7. Install or update: {:phoenix_kit_publishing, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.