Skip to content

Publishing 0.2.0: An audit fixes redirects, routing and publishing reliability

Publishing 0.2.0 is the result of a full audit of the module: 9 high, 16 medium and 12 low findings fixed in public routing, the listing cache, publishing and the editor. There is no API change; the minor version reflects how much behaviour was hardened.

Old URLs and host routes

  • When you rename a post’s URL slug, the old slug is now saved, so the old URL redirects with a 301 instead of giving a 404.
  • Publishing no longer shadows your app’s own routes. Only GET and HEAD requests are handled, so a host form or webhook on the same path keeps working, and the first path segment is treated as a language only when it is an enabled language.
  • Two redirect loops are closed, and canonical redirects keep the query string.
  • Reserved route words are refused as post or group slugs.
  • The public version dropdown on posts is back.

Publishing you can trust

  • Publishing a post is atomic, and an orphaned published version is repaired, so the admin can no longer show “published” while the public page gives a 404.
  • Post updates and new blank versions happen in one transaction and cannot half-apply.
  • A post ID from another group is treated as not found.
  • When two posts claim the same custom URL slug, the post that had it first keeps it and the other is renamed. The editor explains the conflict and links to the other post instead of clearing the field. A slug another post used before is blocked.
  • Empty posts are moved to the trash instead of being deleted, and the change is logged.
  • Timestamp posts are stamped in the site’s time zone.

Editor and cache

  • A user who only watches a post being edited can no longer change it, and reloads stay on the version being edited.
  • The render cache now runs under the supervision tree. Listing cache changes reach every node of a cluster, and a cache update no longer sets off a loop of regenerations across the cluster.
  • Code blocks and multi-line <Image> tags render reliably, and HTML escaping is the same on every path.

Removed

The <Hero> and <Page> components are gone, together with the core Pages module they relied on, and so is an unused per-post SEO and OpenGraph override.

Upgrading

Update the dependency. There is no migration and no configuration. The module still needs PhoenixKit 1.7.132 or later. If a post used <Hero> or <Page>, replace them.

Full release notes: Publishing 0.2.0

0.2.0 · 11 June 2026

PR #25 — a full-module adversarial audit: 9 High / 16 Medium / 12 Low findings fixed across public routing, the listing cache, publishing atomicity, the editor, and markdown rendering, each pinned by a regression test. Plus a post-audit fix to listing-cache invalidation. No public API breaks; the minor bump reflects the breadth of behavioral hardening (redirects, slug-collision precedence, cache/clustering semantics). Built against phoenix_kit ~> 1.7.144.

Fixed

High

  • 301 redirects from renamed posts now fire — previous_url_slugs are actually persisted, so an old URL redirects to the current one instead of 404ing.
  • Router host-route hijack closed — segment-0 is only treated as a locale when it’s an enabled/resolvable language, and a GET/HEAD method gate stops the publishing router from shadowing a host app’s POST/form/webhook routes on the same path.
  • Two infinite-redirect loops closed (canonical-language ping-pong and a future-dated-timestamp fallback loop).
  • Render cache is supervised — started in the supervision tree instead of being born in a transient request process.
  • Spectator/read-only write guards on every mutating editor event; editor reloads are pinned to the version being edited.
  • Public version dropdown restored.

Medium

  • Publishing is atomic and StaleFixer heals orphaned published versions — closes the “admin shows published / public 404s” split.
  • Transactional post updates and blank-version creation (content-wipe + version promotion can no longer half-apply).
  • Timestamp-collision retry matches by constraint name (won’t swallow a slug-uniqueness violation); trashed timestamp slots are counted for availability so the retry converges.
  • Cross-group UUID access rejected — a post UUID from another group returns not-found.
  • Clustering: cross-node cache invalidation and remote-pid-safe presence checks.
  • Supervised lock table + crash-proof regeneration guard (a vanished ETS table can’t 500 a read).
  • Empty / featured-image-only posts are trashed, not hard-deleted, with ActivityLog entries.
  • Markdown safety: code-region integrity, multi-line <Image> detection, and consistent HTML escaping across paths.
  • url_slug collisions: the incumbent post wins and the loser is auto-renamed; claiming another post’s previous slug is blocked; the editor shows an explain-and-link conflict modal instead of silently clearing.
  • Admin-insight cache consistency and stale translation-lock clearing.

Low

  • switch_version crash on a junk param; preview save-failure handling; unpublish pre-lock re-read; transactional blank version; timestamp posts stamped in the site time zone; group-rename cache invalidation; whole-cache erase on memory-cache disable; double-backtick code spans masked; unresolved {{placeholder}} preserved; token-scoped lock release; narrowed update-error rescue; folded the listing-cache timestamps into one term to cut :persistent_term churn; title phx-debounce; canonical/302 redirects preserve the query string; reserved route words rejected as post/group slugs.

Post-audit (listing-cache invalidation storm)

  • The :cache_changed LiveView handler no longer calls regenerate/1, which re-broadcast :cache_changed and — because the view subscribes to its own group’s cache topic — looped into a self-sustaining, cluster-wide regeneration storm. The handler now invalidates the node-local term; the next public read rebuilds it fresh and silently. Mutation sites are the only :cache_changed announcers; read-miss repopulation is silent. This also removes a stale-hit window and a redundant per-event DB read, and erases stale terms on every node regardless of whether an admin view is mounted.

Removed

  • Dead per-post SEO/OpenGraph override scaffolding, and the <Hero> / <Page> components (resolved to core modules that were deleted with the Pages module).

Changed

  • Built against phoenix_kit ~> 1.7.144 (leaf 0.2.23 transitively); the declared floor stays ~> 1.7.132.
  • humanize_field/1 keeps acronyms uppercased (“URL slug”, “SEO title”); the slug-truncation warning persists while the title stays over the URL cap.

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