Catalogue 0.7.0: European prices import correctly and PDFs survive a bad page
Catalogue 0.7.0 fixes prices in European format that were imported about a thousand times too small, makes CSV import pick the right separator, and keeps a PDF’s text when only one page can’t be read.
Import
A price written as 1.234,56, with a dot for thousands and a comma for decimals, was read as 1.23456. The importer now takes whichever of the dot or comma comes last as the decimal separator, so both 1,234.56 and 1.234,56 read correctly, also with a currency sign in front.
The separator of a CSV file was guessed by counting commas, semicolons and tabs on the first line, so a quoted header with a comma in it turned every row into one column. The importer now tries each separator on a sample of lines and picks the one that gives a steady number of columns.
Uploads larger than 25 MB or with more than 50,000 rows are refused with a clear message instead of being loaded into memory. The duplicate check before an import only looks at items whose name appears in the file.
PDF text extraction
One unreadable page used to mark the whole PDF as failed and throw away every page that had been read. Extraction now skips the bad pages, keeps the rest and fails only when no page can be read. An upload could also be left waiting with no extraction job; it is now queued again whenever it is seen waiting.
Upgrading
No migration. The forms now use the AI translation wiring from PhoenixKit core, so use PhoenixKit 1.7.132 or later; the module’s own requirement still allows 1.7.125.
Full release notes: Catalogue 0.7.0
0.7.0 · 7 June 2026
Fixed
- European number formats in price import —
Import.Mapper.normalize_price/1mis-parsed the European"1.234,56"convention (dot thousands, comma decimal): it stripped the comma and read the value as1.23456— silently off by ~1000×. It now decides the decimal separator by whichever of./,appears last, so both"1,234.56"(US/UK) and"1.234,56"(EU) parse correctly, including multi-group values and currency-prefixed strings. - CSV delimiter mis-detection on quoted headers —
Import.Parserchose the delimiter by counting raw,/;/\tcharacters on the first line, so a quoted header cell containing a comma (e.g."Name, full";…) picked the comma parser and collapsed every row to a single column, silently importing garbage. Detection now parses a sampled set of lines with each candidate parser and scores by column count + consistency, which is immune to delimiters inside quotes. - PDF extraction enqueue could be silently dropped — the post-insert enqueue was gated on a 1-second wall-clock “was I the inserter?” heuristic; under DB/GC latency the inserting caller could arrive later and skip the enqueue, leaving a
pendingextraction with no job (only the manual Retry stuck path would heal it). It now (re-)enqueues on anypendingobservation —enqueue_extraction/1is already idempotent against live jobs, so this is safe and self-healing. - One bad PDF page no longer fails the whole document —
Workers.PdfExtractorhalted extraction on the first page error and marked the entire PDFfailed, discarding every successfully-extracted page and burning all retries on a single corrupt page. It now continues past per-page failures, keeps the usable partial result (logging the unreadable pages), and only fails — for retry — when every page fails.
Changed
- Import upload guards —
Import.Parser.parse/3andlist_sheets/1now reject oversized inputs up front (:file_too_largeabove 25 MB,:too_many_rowsabove 50 000) instead of materializing a pathological upload into memory. Both atoms have user-facingErrors.message/1copy. - Bounded duplicate-detection query —
Import.Mapper.detect_existing_duplicates/3narrows its existence query to items whose name appears in the import (a match requires name equality) instead of loading every non-deleted item in the catalogue into memory. - AI-translate LiveView wiring via the
AITranslate.Embedmacro (#33) — the catalogue/category/item form LiveViews replaced their hand-wired AI-translate handlers (sixai_*handle_eventclauses + the{:ai_translation}handle_info) withuse PhoenixKitWeb.Components.AITranslate.Embedfrom core, which attaches the modal/dispatch/PubSub handlers as lifecycle hooks. Requires the macro shipped in core (BeamLabEU/phoenix_kit#585). nimble_csvdeclared as a direct dependency — the CSV import parser uses it directly (NimbleCSV.define/2); it was only pulled transitively viaphoenix_kit. Loosely constrained (~> 1.2).
Docs
- Fixed a stale “SKU is unique” note in the
create_item/update_itemdocs — core V123 dropped that index; item SKUs are non-unique by design.
Notes
- Requires a phoenix_kit release containing
PhoenixKitWeb.Components.AITranslate.Embed(BeamLabEU/phoenix_kit#585) — the macro the form LiveViews nowuse. Developed and locked against core 1.7.132; themix.exsconstraint stays loose (~> 1.7 and >= 1.7.125), so pin aphoenix_kit >= 1.7.132in the parent app. - Verification:
mix precommitis clean (compile--warnings-as-errors+format --check-formatted+credo --strict+deps.unlock --check-unused+dialyzer). The new pure-function behavior (price normalization, delimiter detection, size/row caps) is covered by added unit tests. The full ExUnit suite is DB-gated — runmix testagainst a host with PostgreSQL. - Deferred follow-up: several form LiveViews still issue DB queries directly in
mount/3(which runs twice). Documented indev_docs/followup_2026_06_07_mount_connected_guard.md; deferred because validating the disconnected-render change needs the DB-backed LiveView test suite.
Catalogue 0.7.0. Install or update: {:phoenix_kit_catalogue, "~> 0.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.