Skip to content

Declare rustler explicitly so mdex_native force-builds - #20

Merged
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:upstream-fixes/rustler-declare
Aug 22, 2026
Merged

Declare rustler explicitly so mdex_native force-builds#20
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:upstream-fixes/rustler-declare

Conversation

@timujinne

@timujinne timujinne commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

MDEX_NATIVE_BUILD=1 forces mdex_native to build its NIF from source when no precompiled build exists for the running OTP (28 in our case), which requires rustler itself, not just rustler_precompiled. mdex arrives here transitively through phoenix_kit; a clean checkout fails to compile without this declaration. Same declaration phoenix_kit's own mix.exs already carries.


One fix, six repositories. Every module that pulls mdex transitively through phoenix_kit needs the same one-line declaration, and each repository needs its own PR. Already merged: BeamLabEU/phoenix_kit_catalogue#77, BeamLabEU/phoenix_kit_billing#27. Still open: BeamLabEU/phoenix_kit_crm#25, BeamLabEU/phoenix_kit_entities#35, BeamLabEU/phoenix_kit_document_creator#42.

Scope. This makes this repository build from a clean checkout under MDEX_NATIVE_BUILD=1. It does not remove the need for a host application to declare rustler itself: optional dependencies of dependencies are never resolved, so whichever project is the root has to declare it.

MDEX_NATIVE_BUILD=1 in this environment forces mdex_native to build
its NIF from source (OTP 28 ships no precompiled build), which
requires rustler itself, not just rustler_precompiled. mdex arrives
here transitively through phoenix_kit; a clean checkout failed to
compile without this. Same declaration phoenix_kit's own mix.exs
already carries.
@timujinne

Copy link
Copy Markdown
Contributor Author

Ran the full suite on this branch tip: mix deps.get, mix compile under MIX_ENV=test, then mix test with the :integration half enabled against a real Postgres, with MDEX_NATIVE_BUILD=1 set under OTP 28 — the scenario this PR's rustler declaration targets. The declaration compiles and builds the native NIF cleanly.

Note on running the integration half at all here: config/test.exs on this branch hardcodes phoenix_kit_warehouse_test<partition> as the database name with no env override. On a Postgres role without CREATEDB, mix test doesn't fail — it silently excludes the entire :integration half instead (80 tests, 0 failures, 701 excluded), which looks green without having exercised anything DB-backed. To get real coverage I temporarily pointed config/test.exs at an existing database via an env-driven override, ran the suite, then reverted the change before touching git (not part of this PR — no commit, no push).

With the integration half actually running: 781 tests, 10 failures.

All 10 predate this PR and are unrelated to it — this PR only adds {:rustler, ">= 0.0.0", optional: true} to mix.exs/mix.lock, a build-time dependency declaration that touches none of the failing code paths. I read each failure's stack trace individually; all trace back to the same root cause: phoenix_kit_catalogue (a hard dependency of this module) is published on Hex pinned to phoenix_kit ~> 2.8, while the core actually resolved and running here is 2.13.5 — a real gap between the core version catalogue was built/tested against and the one in use. That shows up as: an admin-tab count assertion off by one (37 expected vs 38 actual), a foreign-key constraint on performed_by_uuid that the test fixtures don't account for, add_source_ref/3 returning {:error, :invalid_ref_type} where the tests expect success, a permission-redirect check that no longer holds, and a stale comment-count assertion.

None of this is introduced by this PR, and I haven't touched any of it here.

@ddon
ddon merged commit a846d43 into BeamLabEU:main Aug 22, 2026
ddon added a commit that referenced this pull request Aug 22, 2026
Raises the catalogue floor to ~> 0.18 so ItemSelectorModal is a declared
contract, not a lockfile coincidence. Supplier indexes now resolve names
the same way the forms do. ItemSelectorModal hosts pass active-only
scope, locale, and decimal qty precision, coerce JSONB quantities into
the selected map, and skip a missing catalogue row instead of crashing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants