Skip to content

fix(faigate): restore pydantic-core source-build hardening for clean linkage audit#2

Open
typelicious wants to merge 1 commit into
mainfrom
fix/pydantic-core-headerpad-regression
Open

fix(faigate): restore pydantic-core source-build hardening for clean linkage audit#2
typelicious wants to merge 1 commit into
mainfrom
fix/pydantic-core-headerpad-regression

Conversation

@typelicious
Copy link
Copy Markdown
Contributor

Summary

brew upgrade fusionaize/tap/faigate to v2.3.0 prints on every install:

Error: Failed changing dylib ID of /opt/homebrew/Cellar/faigate/2.3.0/libexec/lib/python3.12/site-packages/pydantic_core/_pydantic_core.cpython-312-darwin.so
  from @rpath/pydantic_core._pydantic_core.cpython-312-darwin.so
    to /opt/homebrew/opt/faigate/libexec/lib/python3.12/site-packages/pydantic_core/pydantic_core._pydantic_core.cpython-312-darwin.so
Error: Failed to fix install linkage
Updated load commands do not fit in the header of ... needs to be relinked, possibly with -headerpad or -headerpad_max_install_names

Runtime startup happens to keep working, which masked the regression — but Homebrew's linkage audit is broken on every upgrade and the noisy errors are user-visible.

Root cause

This formula was switched to pip install --prefer-binary (and dropped PIP_NO_BINARY=pydantic-core,watchfiles and the rust build dep) to skip the 3–5 min cargo build. That silently regressed the v1.2.2 hardening recorded in fusionAIze/faigate RELEASES.md. Prebuilt pydantic-core / watchfiles wheels are linked upstream without extra Mach-O headerpad space, so the post-install install_name_tool -id rewrite cannot fit the new install name. The LDFLAGS -headerpad_max_install_names flag the formula kept is a no-op for files pip did not compile.

Fix

Re-introduce PIP_NO_BINARY=pydantic-core,watchfiles, restore the rust => :build dependency, drop --prefer-binary, and inline a comment explaining why so this regression cannot land silently a third time. Same pattern as v1.2.2 / v1.2.3, now mirrored as a golden reference in fusionAIze/faigate Formula/faigate.rb (PR faigate#219).

Trade-off

The 3–5 min source build returns on brew upgrade. This is the price of a clean linkage audit and silent installs for users. Do not switch back to --prefer-binary until pydantic-core upstream ships wheels with sufficient headerpad.

Test plan

  • On a fresh macOS arm64 environment: brew upgrade fusionaize/tap/faigate prints zero Failed changing dylib ID / Failed to fix install linkage lines
  • faigate --version reports v2.3.0
  • brew services restart fusionaize/tap/faigate and confirm the gateway boots and pydantic-validated models work end-to-end
  • After merge: bump faigate to v2.3.1 with CHANGELOG note "packaging: restore pydantic-core source-build hardening on Homebrew (regression from v1.2.2 fix)"

🤖 Generated with Claude Code

…linkage audit

`brew upgrade fusionaize/tap/faigate` to v2.3.0 prints
`Failed changing dylib ID of ... pydantic_core/_pydantic_core.cpython-
312-darwin.so ... Updated load commands do not fit in the header ...
needs to be relinked, possibly with -headerpad_max_install_names` on
every install. Runtime startup happens to work, so the regression was
masked, but Homebrew's linkage audit is broken on every upgrade.

Root cause: this formula was switched to `pip install --prefer-binary`
to skip the 3-5 min cargo build, which silently dropped the v1.2.2
hardening. Prebuilt pydantic-core / watchfiles wheels are linked
upstream without extra Mach-O headerpad space, so the post-install
`install_name_tool -id` rewrite cannot fit the new install name.
The `LDFLAGS -headerpad_max_install_names` flag we kept is a no-op
for files that pip did not compile.

Fix: re-introduce `PIP_NO_BINARY=pydantic-core,watchfiles`, restore
the rust build dependency, and drop `--prefer-binary`. This is the
exact pattern that v1.2.2 / v1.2.3 originally landed and is mirrored
as a golden reference in fusionAIze/faigate's own Formula/faigate.rb.

The 3-5 min source build returns. That is the price of a clean
linkage audit. Do not switch back to `--prefer-binary` until
pydantic-core upstream ships wheels with sufficient headerpad.

See:
https://github.com/fusionAIze/faigate/blob/main/docs/PUBLISHING.md#macos-packaging-guard

Co-Authored-By: Claude Opus 4.7 <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.

1 participant