Skip to content

chore: modernize to minimum_otp_vsn 27 - #59

Merged
kivra-kenand merged 9 commits into
masterfrom
chore-make-otp27-minimum
Aug 27, 2026
Merged

kivra-kenand merged 9 commits into
masterfrom
chore-make-otp27-minimum

Conversation

@kivra-kenand

Copy link
Copy Markdown
Contributor

Modernize build, deps and CI

Requires OTP 27+ — JSON now goes through the stdlib json module.

  • Drops jsx in favour of stdlib json. Encode/decode output was diffed against jsx across map and proplist mode before the swap; behaviour is unchanged for all valid input, including proplist objects, jsx's [{}] empty object, and duplicate-key ordering.
  • Drops mochiweb test dep — dead weight. The vendored test/mochiweb_util.erl oracle shadowed the dep's module of the same name, and the dep was only reachable via a guess_mime/1 no test calls.
  • Bumps hackney 4.5.2 → 4.7.4, erlsom 1.5.1 → 1.5.2, meck 0.8.13 → 1.2.0, proper → 1.5.0 (was unpinned).
  • CI now runs build/test and dialyzer across OTP 27, 28 and 29.
  • Removes the erlang.mk / rebar2 path (erlang.mk, rebar.config.script, restc.d) — it carried a duplicate dep list that had already drifted (hackney pinned at 1.20.1 there vs 4.5.2 in rebar.config).
  • Bumps elvis 4.1.1 → 6.0.0; 4.1.1 can't build on OTP 29 (its lager/goldrush chain uses deprecated catch with warnings_as_errors). elvis.config migrated to the 5.x/6.x format, including five renamed rules that the new elvis otherwise skips silently.

Two behaviour changes to check before upgrading

  1. Malformed JSON raises error:unexpected_end / error:{invalid_byte, N} instead of error:badarg. Same error class, so catch error:_ handlers are unaffected — only code matching badarg specifically.
  2. {return_maps, true} (tuple form) now returns maps from JSON bodies; it previously returned a proplist. This was a genuine inconsistency — the JSON branch used lists:member/2 while the empty-body and urlencoded branches used proplists:get_bool/2, so the same option gave two different answers. Bare [return_maps] is unaffected.

Commits are split so each one builds and tests green independently.

Worth a grep for badarg and {return_maps, true} across the consuming services before tagging.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Modernizes restclient for OTP 27+, replacing JSX with stdlib JSON and simplifying build tooling.

Changes:

  • Migrates JSON encoding/decoding to OTP’s json module.
  • Updates dependencies, Elvis, tests, and CI for OTP 27–29.
  • Removes legacy erlang.mk/rebar2 support and unused dependencies.

Reviewed changes

Copilot reviewed 12 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.gitattributes Removes erlang.mk diff handling.
.github/workflows/erlang.yml Tests OTP 27–29.
.gitignore Removes obsolete build ignores.
Makefile Retains Elvis tooling only.
README.md Documents OTP requirement and installation.
elvis.config Migrates to Elvis 6 rules.
erlang.mk Removes legacy build system.
rebar.config Sets OTP minimum and updates dependencies.
rebar.config.script Removes rebar2 compatibility.
rebar.lock Refreshes dependency locks.
restc.d Removes obsolete make metadata.
src/restc.app.src Removes JSX application dependency.
src/restc.erl Introduces the public JSON term type.
src/restc_body.erl Implements stdlib JSON handling.
test/mochiweb_util.erl Removes unused MIME functionality.
test/restc_SUITE.erl Updates JSON integration tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/restc.erl
Comment thread src/restc_body.erl
Comment thread src/restc_body.erl Outdated
Comment thread README.md
@kivra-kenand
kivra-kenand merged commit 3555cad into master Aug 27, 2026
6 checks passed
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