Skip to content

Switch to the bullet_stream function interface (instead of type-state "streaming" interface)#419

Merged
schneems merged 29 commits intomainfrom
schneems/bullet-stream-fun
May 1, 2025
Merged

Switch to the bullet_stream function interface (instead of type-state "streaming" interface)#419
schneems merged 29 commits intomainfrom
schneems/bullet-stream-fun

Conversation

@schneems
Copy link
Copy Markdown
Contributor

@schneems schneems commented Apr 30, 2025

The bullet_stream global function interface was introduced in 0.4.0 https://github.com/heroku-buildpacks/bullet_stream/blob/ce8fd41c8886a8f0e2c5992f2bfa673838ad509a/CHANGELOG.md#v040---20250121

This PR updates the Ruby buildpack to use the new style of printing interface over the heavier type-state interface.

A little history on why it took so long to introduce and adopt a function interface in a functional language:

The original design of the printing interface was a little bit functional with a light type-state pattern. You can see the original interface here #155.

Over many pairing sessions, the type-state design was emphasized and functional style interfaces de-emphasized. It's a good pattern, but in hind-site not a good fit for the work.

This work happened in:

After this point, there were now two interfaces:

We continued working on it, and in an attempt to get it into libcnb, this functional interface was removed to reduce the size of the PR that shipped: heroku/libcnb.rs@174fc02.

While the PR was technically merged into libcnb, it missed core functionality and was unusable. I ported the code over to a new repo, heroku-buildpacks/bullet_stream, with only the type-state API, believing Manuel (who is a co-author of that commit) preferred it.

I started sending PRs to other repos and got tired of the heavy interface with relatively minimal benefit, and released 0.4.0 with the functional interface. Since then, it's been shown to be a clear favorite for other buildpack maintainers who have chosen to use that library.

schneems added 29 commits April 30, 2025 09:59
There's no real reason to hide the extra flags.
It looks awkward when the line is longer than the terminal and there is a leading `remote:` from a `git push` as the text does not stay in front of the `remote: ` it ends up looking something like this:

```
remote: ! Error: `Gemfile found with error
remote: !
remote: ! There was an error trying to read the contents of the application's Gemfile. The buildpack 
cannot continue if the Gemfile is unreadable.
remote: !
remote: ! Error info
```

We cannot prevent this from happening always, but we also don't have to purposefully have very long lines in our output.
This matches Ruby convention for Procs, lambdas, and service objects. Basically anything that has a generic execute this code" entrypoint usually uses `call`.
@schneems schneems marked this pull request as ready for review April 30, 2025 22:11
@schneems schneems requested a review from a team as a code owner April 30, 2025 22:11
@schneems schneems enabled auto-merge (squash) May 1, 2025 14:31
@schneems schneems merged commit 0b4379b into main May 1, 2025
7 checks passed
@schneems schneems deleted the schneems/bullet-stream-fun branch May 1, 2025 19:34
heroku-linguist Bot added a commit that referenced this pull request May 5, 2025
## heroku/ruby

### Fixed

- Internal API used for producing buildpack output updated. ([#419](#419))

### Changed

- Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). ([#422](#422))
@heroku-linguist heroku-linguist Bot mentioned this pull request May 5, 2025
heroku-linguist Bot added a commit to heroku/cnb-builder-images that referenced this pull request May 5, 2025
## heroku/ruby

### Fixed

- Internal API used for producing buildpack output updated. ([#419](heroku/buildpacks-ruby#419))

### Changed

- Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). ([#422](heroku/buildpacks-ruby#422))
heroku-linguist Bot added a commit to heroku/cnb-builder-images that referenced this pull request May 5, 2025
## heroku/ruby

### Fixed

- Internal API used for producing buildpack output updated. ([#419](heroku/buildpacks-ruby#419))

### Changed

- Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). ([#422](heroku/buildpacks-ruby#422))

Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.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