Fix build_data::get_previous() discarding stored false values#2077
Merged
Fix build_data::get_previous() discarding stored false values#2077
build_data::get_previous() discarding stored false values#2077Conversation
The jq `//` (alternative) operator treats both `null` and `false` as falsy, so a stored boolean `false` would return empty string instead of `"false"`. Fixed by replacing with an explicit `has()` check. Though in practice, no callers of `get_previously()` retrieve boolean fields, so currently nothing was affected by this. Also use `--arg` for the jq key parameter in both `build_data::has()` and `build_data::get_previous()`, instead of string interpolation, for consistency with `build_data::_set()`, and to avoid issues if the key name contained any special characters (though in practice they shouldn't given the names aren't user controlled). GUS-W-21977968. GUS-W-21977978.
Member
Author
|
Once this merges, I'll port these improvements (and any others) over to the other classic buildpacks using these utility functions. |
colincasey
approved these changes
Apr 10, 2026
edmorley
added a commit
to heroku/heroku-buildpack-nodejs
that referenced
this pull request
Apr 10, 2026
edmorley
added a commit
to heroku/heroku-buildpack-nodejs
that referenced
this pull request
Apr 10, 2026
edmorley
added a commit
to heroku/heroku-buildpack-nodejs
that referenced
this pull request
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The jq
//(alternative) operator treats bothnullandfalseas falsy, so a stored booleanfalsewould return empty string instead of"false". Fixed by replacing with an explicithas()check. Though in practice, no callers ofget_previously()retrieve boolean fields, so currently nothing was affected by this.Also use
--argfor the jq key parameter in bothbuild_data::has()andbuild_data::get_previous(), instead of string interpolation, for consistency withbuild_data::_set(), and to avoid issues if the key name contained any special characters (though in practice they shouldn't given the names aren't user controlled).GUS-W-21977968.
GUS-W-21977978.