Uh oh!
There was an error while loading. Please reload this page.
V151: supplier-info source/primary columns + CRM citext emails - #640
Conversation
timujinne
commented
Jul 14, 2026
Code review (GLM-5.2 @ max thinking, static full-file review + chain context V87/V138/V146/V148)Code Review — PR #640: V149 migration (catalogue supplier-info junction + CRM email normalization)Scope: one commit ( Verified against: What's solid
Findings[major] v149.ex:13-18, 151-154 — Release-order coupling: confirm V146 was never independently published before this ships. [minor] v149.ex:170, 187 (up) and 258, 275 (down) — [minor] v149.ex:175-176, 192-193 — citext [minor] No CHANGELOG entry / no [suggestion] v149.ex:68, 86, 139 — [suggestion] v149.ex:41 — raw Required testingThe migration was not executed against a database in this review — all findings are from static analysis of the code. The dev environment has no scratch PostgreSQL, and no integration suite was run. Before merge/release, exercise the chain end-to-end on a real Postgres:
VerdictAPPROVE. The migration is correct, fully idempotent, and prefix-safe in practice (bare index names, schema-anchored existence checks, correct citext revert target, V146-parity |
timujinne
commented
Jul 14, 2026
Review follow-ups applied in 5f4724d: the four |
ddon
commented
Jul 14, 2026
We have a conflict here |
timujinne
commented
Jul 15, 2026
Back to draft: upstream shipped its own V149 (PR #638 — junction as a pricing layer alongside the V146 scalar) and further rework is in flight. This PR will be rebased onto the final upstream state — the remaining unique pieces here are the CRM email citext normalization and (pending the final sourcing design) the supplier_source disambiguation column. Will re-open once the upstream layer settles. |
The merged catalogue sourcing layer (catalogue PR BeamLabEU#44) reads and writes supplier_source and is_primary on phoenix_kit_cat_item_supplier_info, but V149 ships the junction without them — every junction INSERT crashes on an undefined column. V151 adds the two columns (source CHECK vocabulary crm_company/crm_contact/local; partial-unique one-primary-per-item) and normalises the CRM party email columns to citext (prerequisite for the CRM v2 backfill matching and the user-contact bridge; extension is a core dependency since V01). The V146 scalar is left untouched per V149's design. Mirrored idempotent down; prefix-hardened throughout.
5f4724d to
450e3dcComparetimujinne
commented
Jul 16, 2026
Conflict resolved — the branch was rebuilt from scratch on current main as V151 (the upstream V149 junction + V150 shipped meanwhile). Now a pure additive follow-up: the two columns the merged catalogue sourcing layer already reads/writes ( |
Both reviewed clean: V151 migration (PR #640) follows all established prefix-safety conventions; PR #641's sanitizer/doctor fixes are correct and well-tested. One policy-conflict finding flagged (not fixed, per maintainer instruction): PR #641 re-adds a scrollbar-gutter override to layout_wrapper.ex, which AGENTS.md's 2026-07-12 removal explicitly says not to do. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Upstream PR #640 (feature/v149-parties-supplier-info) already claims V151 for the supplier-info columns + CRM citext emails, so the accumulator steps aside to V152. down() now stamps '151' (their migration becomes the previous step). The chain has a deliberate hole at 151 until the very next commit merges that branch in.
Summary (reworked on top of the upstream V149/V150 sourcing layer)
V151 — the follow-up that makes the merged sourcing layer coherent:
supplier_source+is_primaryonphoenix_kit_cat_item_supplier_info. The merged catalogue layer (catalogue PR Updated settings page with 4 new settings - Site URL, Allow anyone to resister, New user default role, Week starts on #44) reads and writes both fields (createdefaults, auto-primary promotion,set_primary/1,Suppliers.resolve/1routing, theaudit_supplier_refsreport), but V149 ships the junction without them — on current upstream every junction INSERT crashes on an undefined column. V151 adds:supplier_source VARCHAR(20) NOT NULL DEFAULT 'local'with a CHECK vocabulary (crm_company | crm_contact | local— disambiguates the polymorphic softsupplier_uuidwithout a trial cascade), andis_primary BOOLEAN NOT NULL DEFAULT FALSEwith the partial-unique one-primary-per-item index backingSuppliers.primary_for_item/1.citext(crm_contacts.email,crm_companies.email) — prerequisite for CRM v2 backfill match-by-email and the user↔contact bridge; the extension is a core dependency since V01, soensure_extension!/1no-ops on existing installs. Moduledoc documents the table-rewrite cost and the verified absence of email indexes.The V146 scalar
primary_supplier_uuidis left untouched per V149's design ("junction alongside the scalar"). Note for a follow-up decision: the merged catalogue schema no longer maps the scalar, so the warehouse 0.2.2 scalar-first resolver head can never match — a companion warehouse PR proposes the junction-primary path as the working default-supplier mechanism.Verification
mix compileclean; DDL idempotent both directions; prefix-hardened (bare index name on CREATE,escaped_prefixanchors, regclass only in queued DO-blocks); mirroreddownrestores V138 email shape and marker'150'. A dev host running the catalogue layer with these columns has the full flow live-verified (auto-primary, set-primary idempotence, resolve, warehouse supplier-order generation, receipt unit_value).Required testing before merge
No scratch DB in our dev environment — please run from scratch: fresh chain 0→151 (public + prefix oracle
test/integration/prefix_migration_test.exs), upgrade 150→151 on a DB with junction rows (columns backfill with defaults),down(version: 150)round-trip, idempotent re-runs,mix precommit. Then the catalogue suite against this branch (PHOENIX_KIT_PATH) — the junction context is unusable without these columns.