Skip to content

ci: activate and use CI pipeline in GitHub#5

Merged
kentaro merged 11 commits intokentaro:mainfrom
xu-chris:ci/use-quality-ci
Jan 28, 2026
Merged

ci: activate and use CI pipeline in GitHub#5
kentaro merged 11 commits intokentaro:mainfrom
xu-chris:ci/use-quality-ci

Conversation

@xu-chris
Copy link
Copy Markdown
Contributor

Currently when opening a PR or merging one, neither quality nor quality.ci does run. The whole CI workflow seems to be not activated. One reason potentially could be open and hard to solve Dialyzer issues.

This PR solves it by:

  • Adding quality.ci consistently to the CI quality job
  • Adding OTP 28 to the matrix
  • Solve current Dialyzer issues

I still continue working on more fixes, so this is building upon #3 and #4 and should be merged after these therefore.

Chris Xu and others added 10 commits January 19, 2026 08:49
The expression `[:__struct__] -- except` evaluates to `[:__struct__]`
(since except typically doesn't contain `:__struct__)`, so the final
result is `Map.keys(struct) -- [:__struct__]` — the except fields are
never removed.

This especially happens when deriving from Ecto schemas and ignoring the
`__meta__` like this:
`@derive {Toon.Encoder, except: [:__meta__]}`

This solves it by removing the parentheses. The PR adds necessary tests
to make sure this is fixed.
fix: remove parantheses to make except work
Previously, structs would fall through to the map clause in normalize/1,
which attempted to enumerate them and failed with "Enumerable not implemented".

This fix adds a struct clause before the map clause that dispatches to the
Toon.Encoder protocol, mirroring how Jason handles struct encoding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix: dispatch to Toon.Encoder protocol for structs in normalize/1
Prevents double-escaping of nested structs by having derived encoders
return maps instead of TOON strings. The actual TOON encoding now
happens once at the top level.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @moduledoc false to test fixture modules
- Fix alias ordering in nested_struct_test.exs
- Update @SPEC to allow map() return from derived encoders

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix(encoder): return normalized maps from derived encoders
- Add OTP 28 to test matrix with exclusions for Elixir < 1.18
- Replace separate format/credo steps with mix quality.ci
- Add PLT caching for faster dialyzer runs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove dead code patterns that could never match:
  - detect_root_type([]) in structural_parser.ex
  - append_lines(writer, [], _depth) in objects.ex
- Define precise types to fix supertype warnings:
  - Add @type decoded in decode.ex
  - Add @type validated in options.ex
  - Use nonempty_list() in arrays.ex and strings.ex specs
- Fix protocol fallback no_return warning:
  - Remove @SPEC from Toon.Encoder.Any encode/2 functions
  - Add .dialyzer_ignore.exs for intentional no_return behavior
- Add edge case tests to verify behavior before dead code removal

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
README.md Outdated

[![Hex.pm](https://img.shields.io/hexpm/v/toon.svg)](https://hex.pm/packages/toon)
[![Documentation](https://img.shields.io/badge/docs-hexdocs-blue.svg)](https://hexdocs.pm/toon)
[![Coverage Status](https://coveralls.io/repos/github/xu-chris/toon_ex/badge.svg?branch=main)](https://coveralls.io/github/xu-chris/toon_ex?branch=main)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kentaro This needs probably a change by you to use the correct handle for the Coverage status. :)

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 28, 2026

Pull Request Test Coverage Report for Build 4b742b545266a13fabb5b8a37a01459115669285-PR-5

Details

  • 8 of 10 (80.0%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+34.3%) to 34.279%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/toon/encoder.ex 0 1 0.0%
lib/toon/shared/utils.ex 4 5 80.0%
Files with Coverage Reduction New Missed Lines %
lib/toon/encoder.ex 2 5.0%
Totals Coverage Status
Change from base Build 673ccb5e70b8d5e127fb6358fb4557d96acec5b9: 34.3%
Covered Lines: 314
Relevant Lines: 916

💛 - Coveralls

@kentaro
Copy link
Copy Markdown
Owner

kentaro commented Jan 28, 2026

Thank you!!

@kentaro kentaro merged commit 58d393b into kentaro:main Jan 28, 2026
16 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