Skip to content

fix(zip-it-and-ship-it): include buildData on FunctionResult - #7139

Merged
lemusthelroy merged 3 commits into
mainfrom
lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy
Aug 4, 2026
Merged

fix(zip-it-and-ship-it): include buildData on FunctionResult#7139
lemusthelroy merged 3 commits into
mainfrom
lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy

Conversation

@lemusthelroy

@lemusthelroy lemusthelroy commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

FunctionResult returned in-memory by zipFunctions exposes bootstrapVersion and runtimeAPIVersion at the top level, but only nests them into a buildData object when writing the manifest cache file. Consumers reading buildData from the return value see undefined for functions zipped outside a manifest write, silently dropping metadata that downstream tooling relies on.

This patch populates buildData in formatZipResult so the in-memory shape matches what manifest.ts already persists. Also adds bootstrapVersion?: string to ZipFunctionResult — the node runtime already returns this field, the type just didn't reflect it.

Companion patch in the CLI: netlify/cli#8353.

Test plan

  • Extended existing manifest test to assert files[0].buildData on the in-memory return
  • CI

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eb00c4a4-28ac-451a-b1bb-e0d0f0837f28

📥 Commits

Reviewing files that changed from the base of the PR and between f2dbda8 and 427abf4.

📒 Files selected for processing (1)
  • packages/zip-it-and-ship-it/src/utils/format_result.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/zip-it-and-ship-it/src/utils/format_result.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Function build results now include available bootstrap and runtime API version details.
    • Build metadata is provided only when version information is available, keeping responses concise.

Walkthrough

The change extends function result types with bootstrap and runtime API build metadata. formatZipResult now conditionally includes this metadata in FunctionResult, and the v2 API test verifies it on the bundled function entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding buildData to FunctionResult in zip-it-and-ship-it.
Description check ✅ Passed The description covers the summary and test plan, but omits the required Fixes #issue reference and most checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

e18e dependency analysis

No dependency warnings found.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@netlify/build

npm i https://pkg.pr.new/@netlify/build@7139

@netlify/build-info

npm i https://pkg.pr.new/@netlify/build-info@7139

@netlify/cache-utils

npm i https://pkg.pr.new/@netlify/cache-utils@7139

@netlify/config

npm i https://pkg.pr.new/@netlify/config@7139

@netlify/edge-bundler

npm i https://pkg.pr.new/@netlify/edge-bundler@7139

@netlify/functions-utils

npm i https://pkg.pr.new/@netlify/functions-utils@7139

@netlify/git-utils

npm i https://pkg.pr.new/@netlify/git-utils@7139

@netlify/headers-parser

npm i https://pkg.pr.new/@netlify/headers-parser@7139

@netlify/api

npm i https://pkg.pr.new/@netlify/api@7139

@netlify/nock-udp

npm i https://pkg.pr.new/@netlify/nock-udp@7139

@netlify/opentelemetry-sdk-setup

npm i https://pkg.pr.new/@netlify/opentelemetry-sdk-setup@7139

@netlify/opentelemetry-utils

npm i https://pkg.pr.new/@netlify/opentelemetry-utils@7139

@netlify/redirect-parser

npm i https://pkg.pr.new/@netlify/redirect-parser@7139

@netlify/run-utils

npm i https://pkg.pr.new/@netlify/run-utils@7139

@netlify/zip-it-and-ship-it

npm i https://pkg.pr.new/@netlify/zip-it-and-ship-it@7139

commit: ce53c88

JakeChampion and others added 2 commits July 23, 2026 09:50
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>
@lemusthelroy
lemusthelroy merged commit 978997d into main Aug 4, 2026
39 checks passed
@lemusthelroy
lemusthelroy deleted the lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy branch August 4, 2026 15:53
lemusthelroy added a commit to netlify/cli that referenced this pull request Aug 4, 2026
## 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>
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