• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 5603
90%

Build:
DEFAULT BRANCH: main
Ran 28 Jul 2026 01:20AM UTC
Jobs 1
Files 453
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Jul 2026 01:19AM UTC coverage: 91.255% (+0.1%) from 91.132%
5603

push

github

bobzhang
refactor(diff): redesign the public API (abstract types, callback rendering)

API review outcome (maintainer + codex design review). Final surface:

  type Diff[T]
  Diff::Diff(old~, new~, cutoff?, algorithm?)   // T : Hash + Eq
  Diff::edits() -> ArrayView[Edit]
  Diff::old_view() / Diff::new_view() -> ArrayView[T]
  Diff::group(context?) -> Array[Hunk[T]]
  pub(all) enum DiffAlgorithm { Myers; Patience } derive(Eq, Debug)
  pub enum Edit { Delete(old_index~, old_len~, new_index~)
                  Insert(old_index~, new_index~, new_len~)
                  Equal(old_index~, new_index~, len~) } derive(Eq, Debug)
  type Hunk[T]
  Hunk::render(show~ : (T) -> String) -> String

- `Diff`/`Hunk` are abstract: `Diff.edits` was a mutable `Array[Edit]`, so
  `pub struct` let consumers corrupt the script invariants `group` relies on.
  `old_view`/`new_view` keep a received `Diff` self-contained (a consumer of a
  `Diff` value cannot otherwise interpret `edits()`); the `_view` suffix avoids
  reading `Diff::new` as a constructor.
- `Hunk::render(show~)` replaces the `Show`-bound `to_string` and the `Show`
  impl: `Show` is for canonical value display, a unified-diff block is a
  generated document, and a callback frees element types from needing `Show`
  at all (the test fixtures' hand-written Show impls are gone).
- `Edit` uses per-variant lengths (`old_len`/`new_len`) so a length can't be
  misread across sides, documents the cursor contract (monotone cursors,
  Delete-before-Insert normalization, no zero-length, coalesced runs), and
  derives `Eq`. No `Replace` variant, decided consciously: pub enums are
  matched exhaustively, so adding it later would be breaking - we accept that.
- `group(radius?)` renamed `group(context?)` (unified-diff terminology).
- `cutoff` semantics specified: edit-distance budget, minimal within it,
  correct-but-not-minimal beyond; default ~sqrt of compacted sizes floored at
  4096; `<= 0` heuristics-immediately (covered by test).
... (continued)

22 of 0 new or added lines in 0 files covered. (NaN%)

15893 of 17416 relevant lines covered (91.26%)

188965.11 hits per line

Jobs
ID Job ID Ran Files Coverage
1 5603.1 28 Jul 2026 01:20AM UTC 454
91.27
GitHub Action Run
Source Files on build 5603
  • Tree
  • List 453
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 5ed28adf on github
  • Prev Build on main (#5593)
  • Next Build on main (#5606)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc