Skip to content

Fix build_data::get_previous() discarding stored false values#2077

Merged
edmorley merged 1 commit intomainfrom
build-data-fixes
Apr 10, 2026
Merged

Fix build_data::get_previous() discarding stored false values#2077
edmorley merged 1 commit intomainfrom
build-data-fixes

Conversation

@edmorley
Copy link
Copy Markdown
Member

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.

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.
@edmorley edmorley self-assigned this Apr 10, 2026
@edmorley
Copy link
Copy Markdown
Member Author

Once this merges, I'll port these improvements (and any others) over to the other classic buildpacks using these utility functions.

@edmorley edmorley marked this pull request as ready for review April 10, 2026 11:30
@edmorley edmorley requested a review from a team as a code owner April 10, 2026 11:30
@edmorley edmorley merged commit 8123714 into main Apr 10, 2026
8 checks passed
@edmorley edmorley deleted the build-data-fixes branch April 10, 2026 12:40
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
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