Skip to content

Catalogue 0.1.14: Smart items can only point at standard catalogues

Catalogue 0.1.14 stops a smart item’s pricing rules from pointing at another smart catalogue, or at its own, so a price can no longer depend on a chain of rules.

The Catalogue Rules list on a smart item now offers only standard catalogues. A rule saved another way that points at a smart catalogue is refused with “must reference a standard catalogue, not a smart catalogue”.

Other changes:

  • Error messages from the import wizard and other admin actions, such as “Failed to parse CSV file.” or “Unsupported file format.”, now come from one place and can be translated.
  • Removing a featured image or a metadata field shows Removing… while it works, and the permanent delete buttons show Deleting….
  • For developers, Catalogue.list_category_ancestors/1 returned nothing for any category below the top level; it now returns the full path.
  • The package documentation gets a Smart Catalogues guide.
Full release notes: Catalogue 0.1.14

0.1.14 · 28 April 2026

Added

  • Smart-chain guard (issue #16) — CatalogueRule now rejects rules whose referenced_catalogue is itself kind: "smart", with the error "must reference a standard catalogue, not a smart catalogue" on :referenced_catalogue_uuid (validation: :smart_chain). Self-references fall under the same guard. Applied to create_catalogue_rule/2, update_catalogue_rule/3, put_catalogue_rules/3, and change_catalogue_rule/2. The item-form rule picker now lists only standard catalogues so the user is never offered an option that would fail on save.
  • :only scope on search_items/2 + count_search_items/2 + <.item_picker> (issue #15) — :uncategorized_only restricts to items with no category_uuid, :categorized_only restricts to items in some category, nil (default) is unrestricted.
  • PhoenixKitCatalogue.Errors — central atom-to-string dispatcher (13 plain atoms + 9 tagged tuples) for UI flashes. Plus per-atom pinning tests.
  • Smart Catalogues guide (guides/smart_catalogues.md) — concepts, schema diagram, worked example, host-side reference implementation, pitfalls. Wired into mix.exs package.files and docs.extras.
  • @spec backfill on the 14 most-called CRUD entry points + 26 specs across Catalogue.
  • Test.Endpoint / Test.Router / Test.Layouts / LiveCase test infra so the suite actually runs (598 → 869 tests).

Changed

  • search_items/2 and count_search_items/2 now raise ArgumentError on two foot-guns that previously yielded silent empty results: category_uuids: [nil] (use :only => :uncategorized_only instead) and :only => :uncategorized_only combined with non-empty :category_uuids (logical contradiction).
  • Activity logging — enable_system / disable_system log catalogue_module.{enabled,disabled}. enabled?/0 adds catch :exit, _ for sandbox-owner shutdowns. ActivityLog rescue narrowed to Postgrex.Error :undefined_table for the host-without-V90 case before logging a warning.
  • Failure-side audit rows — LV layer writes metadata.db_pending: true rows on every LV-visible failure via Helpers.log_operation_error/3. Context layer stays success-only.
  • Tree.subtree_uuids_for/1 and ancestor_uuids/1 cast ^uuid / ^roots via type(_, UUIDv7) (CTE was losing type info). ancestors_in_order/1 rewritten — previously returned [] for every non-root category.
  • Task.start/1 → Task.Supervisor.start_child(PhoenixKit.TaskSupervisor, ...) for the supervised import task.
  • phx-disable-with="Deleting..." on the two permanent-delete buttons in components.ex.

Removed

  • Dead Catalogue.broadcast_for/2 clauses ("manufacturer" / "supplier" / "smart_rule") and the orphan lookup_parent(:smart_rule, _). The submodules (Manufacturers, Suppliers, Rules) call PubSub.broadcast/3 directly and never reached the helper.

Fixed

  • change_catalogue_rule/2 smart-chain guard no longer issues a DB lookup on every form keystroke — switched to Ecto.Changeset.get_change/2 so the lookup only fires when :referenced_catalogue_uuid actually changes.

Catalogue 0.1.14. Install or update: {:phoenix_kit_catalogue, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.