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

AnimaLogica / kathikon / 136c354b5a4b76b07c73c13976ad13054767fdfc-PR-85
96%
main: 96%

Build:
Build:
LAST BUILD BRANCH: v0.6.0/Ecto_storage_backend
DEFAULT BRANCH: main
Ran 26 Nov 2026 05:02PM UTC
Jobs 1
Files 34
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

26 Nov 2026 04:42PM UTC coverage: 94.248% (-0.4%) from 94.611%
136c354b5a4b76b07c73c13976ad13054767fdfc-PR-85

Pull #85

github

thanos
**v0.5.0 uniqueness is in.** Tests 290 passed; credo, dialyzer, and docs are clean.

```elixir
use Kathikon.Worker, unique: [period: 60, keys: [:args]]

Kathikon.insert(Worker, args, unique: [period: 5, keys: [:args]])
Kathikon.insert(Worker, args, unique: false)  # disable
```

- `Kathikon.Unique` — resolve/normalize/fingerprint
- `Storage.insert_unique/2` (optional callback; Mnesia implements it)
- `:kathikon_unique` bag; cleared on terminal states / delete
- `insert_many` applies uniqueness per spec

- `@version "0.5.0"`, README roadmap (uniqueness @ 0.5, leases @ 0.7), CHANGELOG, workers guide, release notes

 - closed #69
 - closed #70
 - closed #71
 - closed #72
 - closed #73
 - closed #74
 - closed #75
 - closed #76

The `:by` option is in, and all five todos are done. Tests pass (299 passed, 8 `:async_timing` tests excluded). Format check, `credo --strict`, dialyzer (0 errors) and `mix docs --warnings-as-errors` are clean, and coverage is 94.1%. Nothing is committed or pushed, and I left the plan file alone.

**How it works**
- **`unique: [period: 60, by: fun]`:** `fun` is a one-arity function of the built `%Kathikon.Job{}`, or a `{module, function}` pair. Whatever it returns is hashed together with the worker module, so two workers returning the same term never collide.
- **`:keys` and `:by`:** you can't use both. Doing so, or passing a `:by` that isn't a 1-arity function or `{module, function}`, raises `ArgumentError`.
- **Where it runs:** `Kathikon.insert/3` and `insert_many/2` now run your function once, before anything is stored. It never runs inside a Mnesia transaction, so transaction retries can't re-run it.
- **Storage:** the Mnesia backend now receives the precomputed fingerprint and no longer looks at the worker.
- **Determinism:** hashing now uses deterministic term encoding, so maps with the same contents give the same fingerprint regardless of key order.

**Failures**
- **Single insert:** if your function raises, throws or exits,... (continued)
Pull Request #85: v0.5.0 uniqueness

140 of 156 new or added lines in 6 files covered. (89.74%)

45 existing lines in 4 files now uncovered.

1704 of 1808 relevant lines covered (94.25%)

56.07 hits per line

Uncovered Changes

Lines Coverage ∆ File
9
85.48
lib/kathikon/unique.ex
4
93.08
-0.14% lib/kathikon/storage/mnesia.ex
2
73.68
9.4% lib/kathikon/insert_many.ex
1
91.67
-0.74% lib/kathikon/storage.ex

Coverage Regressions

Lines Coverage ∆ File
29
93.08
-0.14% lib/kathikon/storage/mnesia.ex
10
73.68
9.4% lib/kathikon/insert_many.ex
5
91.67
-0.74% lib/kathikon/storage.ex
1
94.74
0.0% lib/kathikon/scheduler/built_in.ex
Jobs
ID Job ID Ran Files Coverage
1 136c354b5a4b76b07c73c13976ad13054767fdfc-PR-85.1 26 Nov 2026 05:02PM UTC 34
94.25
GitHub Action Run
Source Files on build 136c354b5a4b76b07c73c13976ad13054767fdfc-PR-85
  • Tree
  • List 34
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #85
  • PR Base - main (#D2343DBD...)
  • Delete
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