Catalogue 0.12.0: Supplier price history and a working Suppliers card
Catalogue 0.12.0 keeps a dated history of what each supplier charges for an item, shows it on the item form, and works with the PhoenixKit migration that makes the Suppliers card usable.
Price history per supplier
A supplier’s unit cost on an item is no longer simply overwritten. A new cost closes the current row with today’s date and starts a new one from today, keeping the primary supplier flag. Changing only the currency, to correct a mistake, also makes a new row. A row with no end date is the current one, and only current rows count as the item’s active supplier links.
On the item form, the Suppliers card has a new History column. Its button opens Price History: every cost the supplier has had for the item, with Unit Cost, Currency, Valid From and Valid To, and the current one marked Current. New costs are recorded through the module’s functions; the card itself does not edit them.
Other modules, such as a warehouse goods receipt, can now ask for a supplier’s current cost on an item to check a received price against it.
Supplier references
The mix phoenix_kit_catalogue.audit_supplier_refs task now looks only at current rows.
Upgrading
The Suppliers card needs PhoenixKit 1.7.199 or later, whose V151 migration adds the columns it uses. The module’s requirement still allows older versions, so update phoenix_kit yourself and run mix phoenix_kit.update. Two price changes made at the same moment for a non-primary supplier can leave two current rows; there is no guard against that yet.
Full release notes: Catalogue 0.12.0
0.12.0 · 17 July 2026
Added
- Unit-cost revisions with validity-window price history (#45) —
phoenix_kit_cat_item_supplier_inforows now carry a non-destructive price history via their existingvalid_from/valid_todate fields.Catalogue.revise_supplier_info_cost/3(ItemSupplierInfos.revise_unit_cost/3) closes the current junction row (valid_to: today,is_primary: false) and inserts a successor with the new cost,valid_from: today,valid_to: nil, freeing the partial-unique primary index inside the same transaction so the successor can inheritis_primary. A row is “current” whenvalid_toisnil;list_for_item/1,primary_for_item/1, andmix phoenix_kit_catalogue.audit_supplier_refswere all updated to filter on that predicate so closed history rows no longer surface as active links. NewCatalogue.supplier_info_history_for_pair/2/active_supplier_info_for/2round out the read side — the latter is the function intended for warehouse/goods-receipt integrations to check whether a receipt’s unit price diverges from the catalogued cost. The item edit form’s Suppliers card gained a read-only “Price History” column/modal showing the full validity-window history for a supplier.
Fixed
revise_unit_cost/3silently no-op’d a currency-only correction — the no-op guard only compared the new cost to the row’s existingunit_cost, so calling it with the same cost but a differentopts[:currency](e.g. correcting a mis-recorded currency without a price change) returned{:ok, info}without creating a revision row, logging the change, or updating the currency — despite the function’s own docs describing currency correction as supported. The guard now also requires the currency to be unchanged before treating the call as a no-op. Seedev_docs/pull_requests/2026/45-unit-cost-revisions/CLAUDE_REVIEW.md.
Known limitation (not fixed — needs a core migration)
- No guard against two concurrent
revise_unit_cost/3calls producing two simultaneous “current” rows for the same non-primary item/supplier pair. The primary case self-corrects via the existing partial-uniqueis_primaryindex (a race errors loudly instead of double-writing), but a non-primary junction row has no equivalent — the schema intentionally carries no uniqueness on(item_uuid, supplier_uuid). Closing this needs a partial unique index (WHERE valid_to IS NULL) added in a corephoenix_kitmigration; out of scope for this repo alone per its own “no DB migrations of its own” rule. Full detail in the review doc above.
Notes
- Dependency lockfile advances (no
mix.exsconstraint changes):phoenix_kit1.7.194 → 1.7.199 (pulls in core’sV151migration —supplier_source/is_primarycolumns + the partial-unique index — already required by the #44 feature; the migration-gap “Known blocker” noted in 0.11.0 is resolved as of this pin),phoenix_kit_ai0.12.2 → 0.16.0,hackney4.5.2 → 4.6.0,etcher0.7.2 → 0.8.0,fresco0.8.0 → 0.9.0,mdex_native0.2.5 → 0.2.6,mint1.9.2 → 1.9.3 (EEF-CVE-2026-59249),quic1.7.0 → 1.7.1,req0.6.2 → 0.6.3,tessera0.3.2 → 0.3.3. Constraints stay loose. - Verification:
mix format,mix compile --warnings-as-errors,mix credo --strict, andmix dialyzerare all clean.mix testcould not be run in this environment (no local Postgres) — the new no-op-guard regression test was reviewed by manual trace against the transaction logic rather than executed; get a real CI/Postgres run before treating this release as fully verified.
Catalogue 0.12.0. Install or update: {:phoenix_kit_catalogue, "~> 0.12"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.