Skip to content

Catalogue 0.12.5: PRO100 sync can create new items and matches more rows

Catalogue 0.12.5 lets the PRO100 price sync create items for rows that match nothing, instead of dropping them.

The sync preview now lists every unmatched row with its name, SKU, price and category, and flags rows with a doubtful price or unit. A checkbox creates them; it is ticked by default only when there is nothing to update, as with a fresh price list. New items are created at the catalogue’s top level. Rows left out are still counted in the report. The button now reads Apply.

Rows are also matched better. PRO100 codes keep only the digits of a SKU, so two different SKUs can share a code; the sync now matches on code and name together, and on the code alone only when it is unique. In an export that spans several groups, rows from a group other than the chosen catalogue are refused.

Upgrading

Catalogue 0.12.5 needs PhoenixKit 1.7.231 or later, and brings the new saxy dependency.

Full release notes: Catalogue 0.12.5

0.12.5 · 6 August 2026

Added

  • PRO100 rows that match nothing can now be created instead of dropped (#50) — the sync preview lists every unmatched row with its name, SKU, price and category alongside price? / unit? flags, behind a checkbox that defaults on only when there is nothing to update (the fresh-price-list case). Creates run through the universal Import.Executor, so category get-or-create, activity logging and the roll-up PubSub event behave exactly as in a normal import. Rows left uncreated are still accounted for in the report as :not_imported rather than vanishing.
  • PRO100 rows are matched by code and name (#50) — the file’s numeric code is our SKU reduced to digits, which is lossy: 73.U767.18 and 73.U767.PM.18 both become 7376718, and on a real export 28 codes were shared by 62 rows that could therefore never be updated. Import.Matcher now indexes both {digits, name} and digits, resolving on the pair first and falling back to the code alone when it is unique — the name decides when the code cannot, the code still decides when the name has drifted. Items whose SKU carries no digits are skipped in both indexes, so a code-less file row can never match a SKU-less item by name alone.
  • A PRO100 export spanning several groups no longer bleeds across catalogues (#50) — rows are prefixed with their group (Acme Carcass / MP U741 …); one whose group is not the selected catalogue’s name is refused as :foreign_group before matching runs, so a foreign row can never resolve onto a local item through a colliding lossy code. The separator must be whitespace-padded, because article codes contain bare slashes (MP U767 PM/ST9 18mm).
  • PRO100 estimate-template layer (#50) — Import.Pro100TemplateParser (Saxy; xmerl rejects the export, which declares no encoding and carries Estonian and Cyrillic text), Import.Pro100TemplatePlan and Import.Pro100TemplateLoader read PRO100’s configTables price template into folder / catalogues / categories / items / smart rules, idempotently and with dry_run: true by default. New direct dependency: {:saxy, "~> 1.6"}. Not yet wired to any caller — see Notes.

Changed

  • phoenix_kit floor raised to 1.7.231 (#51) — three LiveViews use PhoenixKitWeb.Live.UrlState, which first shipped in that release; the declared requirement still named 1.7.189, a range that admits a core with no such module and a consumer build that fails to compile. Contract correction only — mix.lock already carried a newer core. Constraints stay loose above the floor.
  • Import.Executor.execute/4 accepts notify_pid: nil (#50) — for callers that run it inline and read the returned result map. Both {:import_progress, _, _} and {:import_result, _} are then skipped; ImportLive‘s PRO100 branch needs this, since a delivered {:import_result, _} would flip the operator onto the universal import’s :done screen instead of the sync report.

Fixed

  • PRO100 force-create was unreachable for every prefixed row, and misfiled the rest (#50 post-merge) — the group prefix was passed through as the category to create, but a group only survives the foreign-group guard when it is the selected catalogue’s name. So a prefixed row either went to :foreign_group and was never created, or was created inside a category duplicating the catalogue’s own name — while the unprefixed rows of the same export landed at the catalogue root. A checked group now yields no category, so created rows sit at the root exactly like unprefixed ones; the prefix is still stripped from the item name. This also removes the _category_name-must-appear-in-categories_to_create drift hazard for the UI path, since that list is now always empty.
  • Executor.execute/4’s @spec still forbade the nil the change exists to pass (#50 post-merge) — dialyzer rejected the ImportLive call outright and declared the created-row error reporter unreachable as a consequence.
  • Two return types drifted from what the functions return (#50 post-merge) — Pro100TemplatePlan.build/2 returns a :problems key absent from @type t() (a dialyzer invalid_contract), and Pro100TemplateLoader’s @type report() omitted :rules.
  • mix precommit failed on merged main (#50 post-merge) — two of the new files were unformatted and three functions tripped credo --strict’s nesting check, on top of the two dialyzer errors above. Formatting applied; the nesting sites extracted into named private functions.

Notes

  • The PRO100 estimate-template layer has no caller yet. Pro100TemplateParser / Pro100TemplatePlan / Pro100TemplateLoader reference only each other — no LiveView, no mix task. It ships because the measurements encoded in it (708 rows across 10 tables; //TableItem yields 1876 because 584 rows are serialised twice under SumTables; TableId is 0 on 707 of 708 rows) are worth preserving with the code, but nothing in the app reaches it. Where it belongs — a mix task, a fourth Import.Source, an admin screen — is still open.
  • Tests added: 22 for the template parser and plan (test/phoenix_kit_catalogue/import/pro100_template_test.exs), pinning the SumTables-snapshot exclusion, section/sub-heading detection, gross→net conversion, price recovery from the name, the computed row splitting into its own smart catalogue, and problems/1. Pro100TemplateLoader remains untested — it is pure database work.
  • The PRO100 LiveView integration tests were asserting the pre-guard behaviour and could not fail, being auto-excluded without a database. They now match the merged code and a fourth test pins the foreign-group refusal end to end. They have not been executed — see Verification.
  • Reviews: dev_docs/pull_requests/2026/50-pro100-sync-key/CLAUDE_REVIEW.md, dev_docs/pull_requests/2026/51-core-version-floor/CLAUDE_REVIEW.md.
  • Verification: mix precommit is clean (compile --warnings-as-errors, deps.unlock --check-unused, hex.audit, format --check-formatted, credo --strict, dialyzer). mix test runs 572 tests + 2 doctests with 803 :integration tests excluded — no Postgres in this environment — so the four import_live_pro100_test.exs force-create tests are unverified end to end. Get a Postgres-backed run before treating the PRO100 create path as validated.

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