Skip to content

Return frozen empty stand-in from #lifecycle_data on missing row#5263

Open
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:lifecycle-data-orphan-fix
Open

Return frozen empty stand-in from #lifecycle_data on missing row#5263
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:lifecycle-data-orphan-fix

Conversation

@philippthun

@philippthun philippthun commented Jul 3, 2026

Copy link
Copy Markdown
Member

The buildpack_lifecycle_data / cnb_lifecycle_data row can be destroyed independently of the owning app, build, or droplet. When that happens, calling #lifecycle_data returns nil and callers not guarding further method invocations hit NoMethodError (e.g. build_presenter.rb on lifecycle_data.to_hash), resulting in an HTTP 500 response.

Fall back to a frozen empty BuildpackLifecycleDataModel / CNBLifecycleDataModel instance so callers see a well-shaped object whose to_hash returns { buildpacks: [], stack: nil }. The freeze prevents any accidental attempt to persist the stand-in.

Also freeze the docker-branch stand-in for the same reason and consistency.

Document the possibility of an empty data payload in the buildpack and cnb sections of the v3 lifecycle doc.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@philippthun philippthun force-pushed the lifecycle-data-orphan-fix branch from 3fdbd0d to e8d7a18 Compare July 3, 2026 14:08
The buildpack_lifecycle_data / cnb_lifecycle_data row can be destroyed
independently of the owning app, build, or droplet. When that happens,
calling #lifecycle_data returns nil and callers not guarding further
method invocations hit NoMethodError (e.g. build_presenter.rb on
lifecycle_data.to_hash), resulting in an HTTP 500 response.

Fall back to a frozen empty BuildpackLifecycleDataModel /
CNBLifecycleDataModel instance so callers see a well-shaped object
whose to_hash returns '{ buildpacks: [], stack: nil }'. The freeze
prevents any accidental attempt to persist the stand-in.

Also freeze the docker-branch stand-in for the same reason and
consistency.

Document the possibility of an empty data payload in the buildpack
and cnb sections of the v3 lifecycle doc.
@philippthun philippthun force-pushed the lifecycle-data-orphan-fix branch from e8d7a18 to c4c18cb Compare July 3, 2026 14:20
@philippthun philippthun marked this pull request as ready for review July 3, 2026 14:22
@jochenehret jochenehret self-requested a review July 3, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants