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 universalImport.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_importedrather 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.18and73.U767.PM.18both become7376718, and on a real export 28 codes were shared by 62 rows that could therefore never be updated.Import.Matchernow indexes both{digits, name}anddigits, 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_groupbefore 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.Pro100TemplatePlanandImport.Pro100TemplateLoaderread PRO100’sconfigTablesprice template into folder / catalogues / categories / items / smart rules, idempotently and withdry_run: trueby default. New direct dependency:{:saxy, "~> 1.6"}. Not yet wired to any caller — see Notes.
Changed
phoenix_kitfloor raised to 1.7.231 (#51) — three LiveViewsuse 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.lockalready carried a newer core. Constraints stay loose above the floor.Import.Executor.execute/4acceptsnotify_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:donescreen 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_groupand 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_createdrift hazard for the UI path, since that list is now always empty. Executor.execute/4’s@specstill forbade thenilthe change exists to pass (#50 post-merge) — dialyzer rejected theImportLivecall 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/2returns a:problemskey absent from@type t()(a dialyzerinvalid_contract), andPro100TemplateLoader’s@type report()omitted:rules. mix precommitfailed on mergedmain(#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/Pro100TemplateLoaderreference only each other — no LiveView, no mix task. It ships because the measurements encoded in it (708 rows across 10 tables;//TableItemyields 1876 because 584 rows are serialised twice underSumTables;TableIdis0on 707 of 708 rows) are worth preserving with the code, but nothing in the app reaches it. Where it belongs — a mix task, a fourthImport.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 theSumTables-snapshot exclusion, section/sub-heading detection, gross→net conversion, price recovery from the name, the computed row splitting into its own smart catalogue, andproblems/1.Pro100TemplateLoaderremains 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 precommitis clean (compile--warnings-as-errors,deps.unlock --check-unused,hex.audit,format --check-formatted,credo --strict,dialyzer).mix testruns 572 tests + 2 doctests with 803:integrationtests excluded — no Postgres in this environment — so the fourimport_live_pro100_test.exsforce-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.