format and dialyzer are red on a clean main #131

Open
opened 2026-08-06 13:02:22 +00:00 by sickday · 0 comments
Owner

Measured on clean origin/main @ 420eddd on a Linux machine running the flake's pinned toolchain (Elixir 1.18.4, OTP 27.3.4.15), with every working change stashed and re-run to prove the failures are not a branch's. Three gates that mix revenant.ci treats as blocking are red before anybody touches anything.

mix format --check-formatted fails on one file

test/support/login_packet.ex

28 28  |    rsa_plain =
29 29  |      <<1, Keyword.get(opts, :login_type, 0), s0::signed-32, s1::signed-32, s2::signed-32,
30    -|        s3::signed-32, 0::64>> <>
   30 +|        s3::signed-32,
   31 +|        0::64>> <>
31 32  |        Keyword.fetch!(opts, :password) <> <<0>>

The file is untouched since 3ae3fc7 and is byte-identical to what main carries. So either the formatter's answer for this binary pattern moved between the version that last wrote the file and the pinned one, or the two machines this repo is developed on do not agree. The forge workflow runs the same gate at line 46 of .forgejo/workflows/ci.yml and it is blocking, so this should be visible upstream too — worth checking whether it is, because if the forge is green on this commit then the two environments genuinely differ and that is the more interesting bug.

Fix is one mix format on the file. Filed rather than fixed inside an unrelated branch.

mix dialyzer reports two errors

lib/revenant/cache/index/file_system.ex:231:guard_fail
lib/revenant/database/repository.ex:78:guard_fail

The guard clause: when _ :: true === nil can never succeed.

Both are the guard Elixir compiles an if into, on a condition Dialyzer has narrowed to true:

  • repository.ex:78 is if sqlite?(), and sqlite?/0 is @adapter == Ecto.Adapters.SQLite3 — a module attribute fixed at compile time. Under the SQLite adapter it is the literal true and the else branch is dead. This one is adapter-dependent by construction, so it should reproduce on any SQLite build and vanish on a Postgres one.
  • file_system.ex:231 is if state.read_only, where the field's inferred type is true.

Neither is a real defect and both are trivially silenced — invert to a case, or widen the type that narrowed. What matters is that the repo's stated standard is zero Dialyzer warnings, so anyone running the gate today has to know these two are the baseline before they can tell their own work is clean.

Why this is worth an issue rather than a note

The three tests already documented as expected-red have the same property, and the cost is the same: a contributor who runs mix revenant.ci on a fresh checkout cannot distinguish the baseline from their own regression without stashing and re-running. Every red gate that is expected should either be fixed or be recorded where the gate itself points at it.

Measured on clean `origin/main` @ 420eddd on a Linux machine running the flake's pinned toolchain (Elixir 1.18.4, OTP 27.3.4.15), with every working change stashed and re-run to prove the failures are not a branch's. Three gates that `mix revenant.ci` treats as blocking are red before anybody touches anything. ## `mix format --check-formatted` fails on one file ``` test/support/login_packet.ex 28 28 | rsa_plain = 29 29 | <<1, Keyword.get(opts, :login_type, 0), s0::signed-32, s1::signed-32, s2::signed-32, 30 -| s3::signed-32, 0::64>> <> 30 +| s3::signed-32, 31 +| 0::64>> <> 31 32 | Keyword.fetch!(opts, :password) <> <<0>> ``` The file is untouched since `3ae3fc7` and is byte-identical to what `main` carries. So either the formatter's answer for this binary pattern moved between the version that last wrote the file and the pinned one, or the two machines this repo is developed on do not agree. The forge workflow runs the same gate at line 46 of `.forgejo/workflows/ci.yml` and it is blocking, so this should be visible upstream too — worth checking whether it is, because if the forge is green on this commit then the two environments genuinely differ and that is the more interesting bug. Fix is one `mix format` on the file. Filed rather than fixed inside an unrelated branch. ## `mix dialyzer` reports two errors ``` lib/revenant/cache/index/file_system.ex:231:guard_fail lib/revenant/database/repository.ex:78:guard_fail The guard clause: when _ :: true === nil can never succeed. ``` Both are the guard Elixir compiles an `if` into, on a condition Dialyzer has narrowed to `true`: * `repository.ex:78` is `if sqlite?()`, and `sqlite?/0` is `@adapter == Ecto.Adapters.SQLite3` — a module attribute fixed at compile time. Under the SQLite adapter it is the literal `true` and the `else` branch is dead. This one is **adapter-dependent by construction**, so it should reproduce on any SQLite build and vanish on a Postgres one. * `file_system.ex:231` is `if state.read_only`, where the field's inferred type is `true`. Neither is a real defect and both are trivially silenced — invert to a `case`, or widen the type that narrowed. What matters is that the repo's stated standard is zero Dialyzer warnings, so anyone running the gate today has to know these two are the baseline before they can tell their own work is clean. ## Why this is worth an issue rather than a note The three tests already documented as expected-red have the same property, and the cost is the same: a contributor who runs `mix revenant.ci` on a fresh checkout cannot distinguish the baseline from their own regression without stashing and re-running. Every red gate that is expected should either be fixed or be recorded where the gate itself points at it.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Revenant/Server#131
No description provided.