Skip to content

feat(hackney)!: support hackney 4.x#880

Merged
yordis merged 3 commits into
elixir-tesla:masterfrom
tomekowal:support-hackney-4.x
Jun 2, 2026
Merged

feat(hackney)!: support hackney 4.x#880
yordis merged 3 commits into
elixir-tesla:masterfrom
tomekowal:support-hackney-4.x

Conversation

@tomekowal
Copy link
Copy Markdown
Contributor

@tomekowal tomekowal commented May 31, 2026

Adds support for Hackney 4.x.

There are two workarounds in this PR that are further explained in comments:

  • I kept Hackney 1.x in mix.lock because Hackney 4.x depends on quic which requires Erlang 26 which breaks the CI matrix; AFAIU, the only way to upgrade Hackney to 4.x in mix.lock would be to drop Erlang 25 from the CI matrix
  • Second commit introduces a function that does nothing except correcting wrong typespec in hackney for dialyzer to pass.

I made comments in places that I believe require attention during review.

Comment thread lib/tesla/adapter/hackney.ex
Comment thread lib/tesla/adapter/hackney.ex Outdated
Comment thread lib/tesla/adapter/hackney.ex Outdated
Comment thread lib/tesla/adapter/hackney.ex
Comment thread lib/tesla/adapter/hackney.ex
Comment thread test/tesla/adapter/hackney_test.exs Outdated
Comment thread mix.exs Outdated
@tomekowal tomekowal force-pushed the support-hackney-4.x branch from ef58606 to dd60959 Compare May 31, 2026 10:32
Comment thread mix.lock Outdated
@tomekowal tomekowal changed the title Support Hackney 4.x feat(hackney): support hackney 4.x May 31, 2026
@tomekowal
Copy link
Copy Markdown
Contributor Author

I've changed the PR title, but the action did not rerun. @yordis Could you rerun it?

@tomekowal tomekowal mentioned this pull request May 31, 2026
4 tasks
Comment thread test/tesla/adapter/hackney_test.exs Outdated
@yordis
Copy link
Copy Markdown
Member

yordis commented May 31, 2026

@tomekowal thank you so much, I wonder, should we leave TODO comments with the proper context in the code to later remove 1.0 support?

@tomekowal
Copy link
Copy Markdown
Contributor Author

Do we want to remove 1.0 support? I don't believe keeping both in the same adapter adds that much complexity. There is not a single if statement necessary. The only small thing is checking if hackney reference is either Erlang's reference or PID.

It would be totally fine to leave both 1.x and 4.x support indefinitely.

@halostatue
Copy link
Copy Markdown
Contributor

As someone adjacent to security…I don't think keeping 1.0 is a good idea. It's not getting any more updates and has three unresolved CVEs.

But that changes a number of things for consumers including the minimum supported OTP.

@yordis
Copy link
Copy Markdown
Member

yordis commented Jun 1, 2026

I am in a tricky situation here, it is effectively a breaking change for Tesla ... 😭 What do I do? Maybe I shouldn't feel so emotionally attach to cut a v2 or put a big disclaimer in the release note?

@tomekowal
Copy link
Copy Markdown
Contributor Author

tomekowal commented Jun 1, 2026

I think that makes sense for a major upgrade:

  • cut the support for OTP 25
  • cut support for Hackney 1.x
  • any other stuff that you would like to do but compatibility held you back?

@yordis
Copy link
Copy Markdown
Member

yordis commented Jun 1, 2026

use feat(hackney)! the ! is the key here, lets break changes 😢

@tomekowal tomekowal changed the title feat(hackney): support hackney 4.x feat(hackney)!: support hackney 4.x Jun 1, 2026
@tomekowal
Copy link
Copy Markdown
Contributor Author

I've change the title. Would you like to me to make other changes that drop Hackney 1.x support completely?

@yordis
Copy link
Copy Markdown
Member

yordis commented Jun 1, 2026

yeah, drop it completely by now

@tomekowal tomekowal force-pushed the support-hackney-4.x branch from 9591335 to df44506 Compare June 1, 2026 19:50
tomekowal and others added 3 commits June 1, 2026 20:10
BREAKING CHANGE: drops hackney 1.x. Tesla now requires hackney >= 4.0.2
and OTP 26+ (transitively via :quic).

- Adapter targets hackney 4.x conn() = pid() everywhere
- Stream upload path calls finish_send_body before start_response
  (4.x requires explicit chunked terminator)
- :max_body honored only on streaming response read; 4.x sync requests
  always return body inline
- start_stream_request wrapper restores {:ok, pid()} return shape that
  hackney's request_ret/0 omits, keeping dialyzer happy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Hackney 4.x pulls in :quic which requires OTP 26+. Bump the gun1 lockfile
job to the next pair (1.16.3 / 26.2.5) to keep gun 1.x coverage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
excoveralls 0.16.1 hard-required hackney ~> 1.16, conflicting with the new
hackney ~> 4.0 constraint. 0.18.5 dropped the mandatory hackney dep
(castore optional instead).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tomekowal tomekowal force-pushed the support-hackney-4.x branch from 318a427 to 04490ee Compare June 1, 2026 20:10
@tomekowal
Copy link
Copy Markdown
Contributor Author

OK, so:

  • I've removed traces of Hackney v1
  • Removed Erlang 25 from test matrix
  • updated excoveralls in gun lockfile (because updating hackney caused errors)
  • the Semantic PR Title failure seems to be not from the title itself but from how the job works

@yordis yordis merged commit c91639b into elixir-tesla:master Jun 2, 2026
6 of 7 checks passed
@yordis
Copy link
Copy Markdown
Member

yordis commented Jun 2, 2026

@tomekowal thank you so much for the help!

@tomekowal
Copy link
Copy Markdown
Contributor Author

Happy to help :)

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.

3 participants