forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/service/builder.rsClear filter

2026-09-15

🐛 fix: the boot seed survives a rival boot; a failed create drops its databaseAhmet Kaan Gümüş · f8d7a2d
🐛 fix: the boot seed survives a rival boot; a failed create drops its database

Two more members of the class the template fix opened — a statement issued
where a rival process may already have written the same row.

`service::builder::ensure` raced on `builder_username`: find-then-insert is
not a guard, and the loser's raw `23505` killed the boot (measured: four boots
racing a fresh control database, three died, only the winner stayed up). The
insert is now `INSERT … ON CONFLICT (username) DO NOTHING`, so the loser
neither raises nor logs — a refused insert is logged by the server even when
the client handles it — and the winner's credential stands. The same 4-way
probe now reports 4/4 up with zero server-side error lines.

`Tenants::create`'s rollback deleted the registry rows but left the database it
had just created: names are minted per create and never replayed, so that is an
unreachable 70-table database nothing can name again. The rollback now drops it
best-effort and warns when even that fails, so the one leak this path can
produce is at least visible.

`.sqlx` regenerated for the changed statement (scripts/prepare_db.sh + cargo
sqlx prepare).

2026-09-12

2026-09-11

🧹 chore: split profile, badge, builder into domain/db/service layersAhmet Kaan Gümüş · 7f616c0
🧹 chore: split profile, badge, builder into domain/db/service layers

C3 identity lane. Moves, not rewrites:

- badge: BadgeStats::load / BadgeAward::list_for / sync (UPSERT with the
  earned_at = NONE idempotency stays whole) -> db::badge, with the
  award-key mint and the persistence tests; BadgeStat/BadgeStats/earned/
  BadgeAward (pure rules) stay in domain::badge; service::badge wraps
  list_for/sync for the web layer.
- profile: ProfileStats::load (+ PomodoroTotals, persistence tests) ->
  db::profile; newtypes + getters stay; service::profile::load wraps.
- builder: find_by_username/read/create(create_session)/find_by_token/
  delete_by_token -> db::builder; the idempotent seed ensure ->
  service::builder (ensure_admin precedent); both tests ride their fns.
- preferences, key: fully pure (validated newtypes, composite-id
  helpers) — stay domain-only, no db/service modules created.

Entity fields the split constructs from are now pub(crate) (Builder,
BuilderSession, ProfileStats), matching the user split.

Callers re-pointed crate-wide: web/{users,exams/mod,questions,homework,
sessions,auth,extractor,builder,tenant_state}, service/exam_attempt.rs
(badge::sync after start), database.rs (control seed), tests/
{builder_api,e2e,integration}; cross-lane compile fixups in
domain/pomodoro.rs and domain/session_attendance.rs (their lanes
re-point on merge). constant.rs doc link -> crate::db::badge::list_for.