Conversation
Some platforms have no @ff-labs/fff-bin-* prebuilt. FreeBSD builds the C library cleanly from source, but nothing publishes it, so an npm install can never resolve it. Add an FFF_C_LIB override, checked before the npm package and the local dev build, so such a build is usable from a normal install (and from a bun --compile binary, where resolution happens at runtime). Also recognise freebsd in getTriple(), allow @ff-labs/fff-bun to install there, and make resolveFromNpmPackage() return null instead of throwing when the platform has no package mapped.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe package now supports FreeBSD and checks ChangesPlatform support and binary resolution
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to FreeBSD is now recognized, and an explicit library path takes priority in the normal binary-resolution flow; embedded executables retain their embedded library. No actionable merge risk remains. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Lets
@ff-labs/fff-bunuse a native library built from source on platforms thathave no
@ff-labs/fff-bin-*package, via anFFF_C_LIBenvironment override.Why
The
fff-ccrate builds cleanly on FreeBSD (x86_64 and aarch64) with no Rustchanges — this was built and FFI-validated in #824. But no FreeBSD prebuilt is
published, so an npm/bun install can never resolve one:
getTriple()throws forfreebsd, andpackage.jsonexcludes it, so the package does not install at all.FFF_C_LIBcloses that gap without committing the project to a release leg ithas to keep green (no GitHub-hosted FreeBSD runner), and it is generic — it also
covers any custom or cross-compiled build on a supported platform.
Changes
src/download.ts:findBinary()checksFFF_C_LIBfirst. If it is set but thepath does not exist, resolution fails with an explicit error instead of silently
falling through.
src/download.ts:resolveFromNpmPackage()returnsnull(instead of throwing)when the platform has no package mapped — matching its existing "expected on
unsupported platforms" contract.
src/platform.ts:getTriple()recognisesfreebsd→unknown-freebsd.package.json: addfreebsdtoosso the package installs there.README.md: document the override.No
TRIPLE_TO_NPM_PACKAGEentries are added: there is no@ff-labs/fff-bin-freebsd-*to point at, so naming one would be a dead entry.Adding those two lines is all that is needed if FreeBSD prebuilts are ever
published.
Notes
bun --compile: on FreeBSDresolveEmbeddedLibPath()returnsnull, sofindBinary()is consulted at runtime and an externalFFF_C_LIBlibrary isdlopen'ed normally.
packages/fff-nodeduplicates the samegetTriple()/resolution logic; happy tomirror this there if wanted.
without fff; see feat: add FreeBSD (x86_64, aarch64) build support anomalyco/opencode#53371).
Thanks to @apbodrov for proposing exactly this in #824 and for the FreeBSD builds
that show the native library works there.
Summary by CodeRabbit
FFF_C_LIB. This path is checked before platform packages and local builds; if it does not exist, an explicit error is shown.FFF_C_LIB.