fix(zip-it-and-ship-it): include buildData on FunctionResult - #7139
Conversation
The in-memory FunctionResult returned by zipFunctions exposed bootstrapVersion and runtimeAPIVersion at the top level, but only nested them into buildData when writing the manifest cache. Consumers reading buildData (e.g. netlify-cli's deploy path) saw undefined for functions zipped outside a manifest write, silently dropping bootstrap metadata from the deploy payload. Populate buildData in formatZipResult so the in-memory shape matches what the manifest already writes. Add bootstrapVersion to ZipFunctionResult so the type reflects what the node runtime already returns. Extend the manifest test to assert buildData is populated on the returned function objects. RUN-3166 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change extends function result types with bootstrap and runtime API build metadata. Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
e18e dependency analysisNo dependency warnings found. |
@netlify/build
@netlify/build-info
@netlify/cache-utils
@netlify/config
@netlify/edge-bundler
@netlify/functions-utils
@netlify/git-utils
@netlify/headers-parser
@netlify/api
@netlify/nock-udp
@netlify/opentelemetry-sdk-setup
@netlify/opentelemetry-utils
@netlify/redirect-parser
@netlify/run-utils
@netlify/zip-it-and-ship-it
commit: |
Attaching buildData unconditionally leaked an empty `buildData: {}` onto
results for runtimes without bootstrap/API-version metadata (Go, Rust),
breaking their strict-equality tests. Strip undefined values and omit the
key entirely when empty, so only Node functions carry buildData while the
manifest shape is preserved for consumers that need it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n-direct-netlify-deploy-forcing-legacy
## Summary Plain `netlify deploy` (and `netlify deploy --skip-functions-cache`) has been silently sending `build_data: undefined` for every function in the deploy create payload. Downstream tooling relies on `build_data.bootstrapVersion` and `build_data.runtimeAPIVersion` to route function uploads correctly. Root cause: `@netlify/zip-it-and-ship-it`'s in-memory `FunctionResult` exposes `bootstrapVersion` and `runtimeAPIVersion` at the top level, but only nests them into `buildData` when writing the manifest cache. Without a manifest hit, `func.buildData` is `undefined`. This patch restores the reconstruction loop originally proposed in #7099 (closed unmerged) so per-function metadata reaches the deploy record on direct-zip paths. A companion patch in `@netlify/zip-it-and-ship-it` (netlify/build#7139) fixes the shape at source. This CLI change remains useful as a defense against older ZISI versions. ## Test plan - [x] New unit test in `hash-fns.test.ts` asserts `fnConfig.build_data.bootstrapVersion` is populated for a v2 function on the direct-zip path - [ ] CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
FunctionResultreturned in-memory byzipFunctionsexposesbootstrapVersionandruntimeAPIVersionat the top level, but only nests them into abuildDataobject when writing the manifest cache file. Consumers readingbuildDatafrom the return value seeundefinedfor functions zipped outside a manifest write, silently dropping metadata that downstream tooling relies on.This patch populates
buildDatainformatZipResultso the in-memory shape matches whatmanifest.tsalready persists. Also addsbootstrapVersion?: stringtoZipFunctionResult— the node runtime already returns this field, the type just didn't reflect it.Companion patch in the CLI: netlify/cli#8353.
Test plan
files[0].buildDataon the in-memory return🤖 Generated with Claude Code