Skip to content

PhoenixKit 2.65.0: The last 2.x release, the bridge to 3.0

PhoenixKit 2.65.0 is the last 2.x release and the step every existing site has to take before PhoenixKit 3.0. It also gives every file a short code, keeps HDR in iPhone and AVIF photos, and fixes how S3 serves copied files.

The bridge to 3.0

PhoenixKit 3.0 stops creating the tables of the optional modules and can only upgrade a database at migration V225, which this release brings. Upgrade to 2.65.0, run mix phoenix_kit.update until it reports V225, and only then move to 3.0.

To prepare for that, mix phoenix_kit.update now runs module migrations in dependency order: Staff and Entities before Projects, Billing before E-commerce. Before, the order was by display name. Modules can also name the places in their tables that point at stored files and supply a manifest of their own tables, which mix phoenix_kit.repair and mix phoenix_kit.doctor check. Those two tools now check only core’s own tables. Nothing in any database is created, changed or dropped by this.

Short codes for files

Every file now has a random 8-character code, such as k3Fq9xA2, that can name it in a URL instead of its UUID. The migration gives every existing file a code in one UPDATE and then builds a unique index, which blocks writes to the files table while it is built. The code is not a secret and grants nothing: the file’s library still decides who may read it.

HDR photos from iPhone and Android

Thumbnails and previews of HEIC and AVIF photos with a gain map, as iPhones and Android phones take them, are now made as Ultra HDR JPEGs, as JPEG sources already were. This needs ffmpeg 7.1 or later. A size that cannot be made this way is made the ordinary way, as before.

Libraries and reserved names

A host can give its accounts a public library next to the personal one, and change a library’s slug. With config :phoenix_kit, :reserved_library_slugs and :reserved_usernames (both empty by default) a host keeps names for its own pages: a reserved username is refused, and a library slug that would match one gets a number.

Fix: S3 content types

Files copied between S3 buckets, such as after a storage profile change, or stored without options, were served as binary/octet-stream, so the browser downloaded them instead of showing them. The type now comes from the file’s extension. Objects already stored without a type keep it until their metadata is rewritten.

Upgrading

Run mix phoenix_kit.update for V224 (an index on the activity log) and V225 (the file short codes). On a very large site, run it in a quiet window. Then stay on 2.65.0 until you are ready for 3.0.

Full release notes: PhoenixKit 2.65.0

2.65.0 · 27 October 2026

The last 2.x release. Core 3.0 stops creating the tables of the optional modules (each module’s own migration chain creates its tables) and strips that DDL from its migration modules, so it can only upgrade a database that is already at V225. Upgrade to 2.65.0, run mix phoenix_kit.update until it reports V225, and only then move to 3.0; 3.0 refuses a lower database with a message that names this release. This release also carries what 3.0 needs from the modules: the file_references/0 and expected_schema/0 callbacks, the per-module manifests, and dependency-ordered module migrations. Nothing in 2.65.0 changes behaviour for a host that does not use them.

 

Migrations V224 and V225 (V224, PR #983: an index on phoenix_kit_activities (resource_uuid, inserted_at); V225: phoenix_kit_files.short_code, below). Nothing else here migrates.

Fixed

  • Objects copied between S3 buckets, or stored without options, are served with the right Content-Type (#951). Providers.S3 set the type only when the caller passed :content_type, and Manager.copy_object/3 (the reconcile after a profile change) and Storage.store_new_file/8 pass none, so S3 served the object as binary/octet-stream and a browser downloaded it instead of showing it. The provider now falls back to the type of the key’s extension. Objects already stored without a type keep it until their metadata is rewritten (for example put_object_copy with metadata_directive: :REPLACE).

Added

  • mix phoenix_kit.update runs module migrations in dependency order. Migrations.Modules.pending/1 (and the new order_by_dependencies/1) place a module after every pending module its OTP application depends on, so phoenix_kit_staff and phoenix_kit_entities migrate before phoenix_kit_projects, and phoenix_kit_billing before phoenix_kit_ecommerce. Until now the order was the display name, which only worked because core created every module’s tables first. No module change is needed; a cycle keeps name order instead of failing.

  • A short code on every file (V225). phoenix_kit_files.short_code is a random 8-character base58 code (k3Fq9xA2: no 0, O, I or l) that names a file in a URL instead of its UUID, with a unique partial index. Storage.ShortCode makes and checks them; the File changeset gives one to every new file (never cast from attrs, never changed), and Storage.get_file_by_short_code/1 finds the file. The migration gives every existing file a code in SQL (duplicates redrawn until none repeat, then the index is built); the backfill is one UPDATE of the table and the index build takes a SHARE lock on it, so run it in a quiet window on a very large site. A code is not a secret and grants nothing: the file’s library decides who may read it.

  • Libraries.ensure_public_library/2 and backfill_public_libraries/1: a host may give its accounts a public library. The counterpart of ensure_personal_library/2, with the same rules (the host’s decision, no permission and no room under the limit, never a second one, not even after the user trashed theirs), except that it is public (visibility: "site") and never the user’s default; make the personal one first. Named “Public” unless :name says otherwise. Making one is written to the history as storage.library_published with "by" => "system".

  • Libraries.change_library_slug/3, for a host that names its pages by a library’s slug (the admin libraries page and any /<username>/<slug> address): unscoped like rename_library/3, written to the history, refuses a badly shaped, reserved or already used slug.

  • Names a host keeps for its own pages. config :phoenix_kit, :reserved_library_slugs and :reserved_usernames (both empty by default). A name that slugs to a reserved word is given the next free slug (photos-2), change_library_slug/3 and a username that is reserved are refused ("is reserved"), and a username generated from an email address that is reserved gets a number (admin_1). Case does not matter; names already taken are not changed. Libraries.reserved_slug?/1, User.reserved_username?/1.

  • HDR renditions of HEIC and AVIF photos. HdrResize kept a gain map for a JPEG source only, so an iPhone photo (a HEIC) got ordinary thumbnails and previews. HeifHdr now makes the same Ultra HDR JPEG from a HEIC or AVIF that has a tmap item (iPhone, Android): HeifBoxes reads the file’s boxes and its ISO 21496-1 parameters, ImageMagick cuts the picture, ffmpeg decodes the gain map (a tile grid, or a single picture), and HdrResize‘s writer assembles the picture, the map and the Multi-Picture directory. VariantGenerator picks the writer by container; a size that cannot be made this way (no ffmpeg 7.1+, a map with a value per colour channel or running backwards, a map of other proportions, anything unexpected) is made the ordinary way, as before. A photo’s rotation (irot) is applied to both pictures, strip_metadata and the focus crop work as for JPEG sources. Tested against a real iPhone HEIC (pixel-identical to the prototype that was checked in Safari on an iPad) and a synthetic AVIF.

  • Hdr.read/1 of a HEIC or AVIF reads the file’s boxes instead of matching bytes: "headroom" and "gain_map_bytes" are filled, and a new "parameters" map holds the gain map’s numbers under the names of Ultra HDR’s hdrgm properties. A HEIC whose meta box is larger than 512 KB is now recognised too.

  • Storage.VariantSets.remake_hdr_renditions/1 remakes only the HDR-eligible sizes (keep_hdr, JPEG, a shape the map can follow) of files that have a gain map (HEIC and AVIF by default, containers: to choose), without the cost of remake_all/1. Existing HEIC renditions are not seen as out of date otherwise, since keep_hdr is not in the spec hash.

  • PhoenixKit.Module.file_references/0: a module names the places in its own tables that point at a stored file. It returns {table, condition} pairs, the same NOT EXISTS shape core’s orphan-file check has always used for module tables; PhoenixKit.ModuleRegistry.all_file_references/0 collects them from every module, enabled or not. A module that implements it takes over its own tables: core’s built-in check for them steps aside, decided by PhoenixKit.Migrations.ModuleOwnedTables. A module that does not implement it keeps core’s built-in check, so nothing changes for a module version that predates the callback. A callback that raises or returns a malformed entry fails closed: no file is treated as orphaned until it is fixed. No default implementation exists on purpose, since an empty default would switch core’s protection off for every module.

  • PhoenixKit.Module.expected_schema/0: a module supplies the manifest of its own tables. It returns a module implementing PhoenixKit.Migrations.ExpectedSchema.Behaviour, generated from the module’s own chain by dev_docs/squash/generate_module_manifest.exs (catalog queries only). PhoenixKit.ModuleRegistry.all_expected_schemas/0 collects them from every module, enabled or not, and mix phoenix_kit.repair / doctor run one more pass per manifest after core’s, through the same differ and the same additive-only executor. A module is checked only while its recorded version equals its chain head: one that is behind gets an info finding (:module_behind), one that was never migrated none. Findings carry module: (the OTP app) and their message starts with the app. No default implementation: a module without a manifest is simply not checked, as since the manifest was narrowed to core’s tables. PhoenixKit.TestSupport.ModuleChainCheck.build_alone/4 builds core’s chain and then the module’s alone in a scratch schema, for generating and testing a manifest.

Changed

  • mix phoenix_kit.doctor and mix phoenix_kit.repair check core’s tables only. The manifest no longer lists the 141 tables that belong to modules (PhoenixKit.Migrations.ModuleOwnedTables), their columns, constraints, indexes, seed rows and the two email-table data invariants. A damaged module table is no longer reported or repaired by core; the module’s own chain puts it back on mix phoenix_kit.update. Nothing is created, changed or dropped in any database, and core’s migrations still create the module tables on a fresh install.

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