forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/db/profile.rsClear filter

2026-09-14

🗃️ feat: pre-prod schema: person join key, drop school password copyAhmet Kaan Gümüş · 804bd3c
🗃️ feat: pre-prod schema: person join key, drop school password copy

app_user no longer stores password_hash (login already verifies
control person). School rows carry person uuid + created_at.
class_blueprint is uuid-keyed; exam child rows composite-FK to
(exam, question); pool/solution images are child tables;
graded_at/marked_at/enrollment timestamps added.

Left alone: occupancy/refcount counters (cap locks, not lies),
ledger source, menu derived id, school.slug PK, fee_plan JSONB.

2026-09-12

🧪 test: port T4 regress/partial-patch suites to the Postgres harnessAhmet Kaan Gümüş · f553d14
🧪 test: port T4 regress/partial-patch suites to the Postgres harness

- fixture SQL → runtime sqlx (kind_ref/slot_ref upserts, settings JSONB,
  point-row UPDATEs, count/scalar helpers); ULID idioms re-pointed
- SurrealDB DEFINE EVENT injections → PG-native: RAISE triggers (roles/
  classes/blueprints pending), pg_sleep window trigger (exam delete),
  lock-queueing probe (attendance), row-snapshot probe (badge awards)
- EXTRA: drop DB_KEEPALIVE_INTERVAL_SECS/DB_PING_TIMEOUT_SECS + their
  /limits EXCLUDED pins; drop stale BOARD_OPEN_GUARD pin (wave-2 leftover)
- production fixes pinned by these suites: exam_result grade claim mints
  an absent kind_ref (absent = in service); field_update run() emitted a
  double WHERE (every guarded PATCH 500'd); attendance event mark now
  locks the event row (orphan race); admin floor takes the admin-set row
  locks (cross-target demotions raced); profile focus sum cast to BIGINT
- delete the two appointment store-property tests: their subject was the
  SurrealDB engine's write-skew; Postgres closes it by constraint
- .sqlx refreshed for the changed query macros
🗃️ feat!: port identity+auth (user, session, profile, badge, settings, builder) to sqlx/PostgresAhmet Kaan Gümüş · 29cdff2
🗃️ feat!: port identity+auth (user, session, profile, badge, settings, builder) to sqlx/Postgres

- db/user: static query_as! row mint (23505 on app_user_username -> 409),
  PagedList listings, position()-based fold search, role cascade as ONE
  tx_with_retry(cascade=true) closure (admin floor = guard on the role write
  itself; class/enrollment counts decrement in the delete CTEs; parent-seat
  sweep frees unfrozen lists via DELETE..USING; board close CAS + strip with
  post-image fan-out rows; appointment bookings cancelled then slots deleted
  under the new SET NULL link); avatar writers return the FOR UPDATE pre-image
- service/user: ADMIN_FLOOR_LOCK deleted (floor rides the UPDATE's WHERE),
  would_orphan_admins deleted; set_role keeps the 404 pre-read
- service/settings: SETTINGS_LOCK, Undo/restore deleted; retire/unretire +
  guarded save ride ONE transaction (stale save aborts via marker and retries);
  retire switch = cap.rs recipe (FOR UPDATE + ON CONFLICT..WHERE count=0);
  messages byte-identical
- db/settings: load/save/save_if_unchanged as static macros; CAS is ONE
  guarded upsert (INSERT arm seeds defaults, ON CONFLICT WHERE
  IS NOT DISTINCT FROM per column)
- db/badge: counter projection off app_user *_total columns; sync keeps the
  runtime N-statement exemption with ON CONFLICT..WHERE earned_at IS NULL
- db/profile: one-row pomodoro aggregate (COALESCE sum, negative floor)
- db/session, db/builder: static macros; builder_session keys now uuid v7
- domain/badge: fields crate-visible for macro construction
- db/page: Param::Texts variant for ANY() text-array binds
- web/users: avatar blob name mints via next_uuid; docs de-Surrealized
- cfg(test) mods left for wave 3 (service/settings tests reference the deleted
  lock machinery; db tests reference init_mem)

SQL semantics probe-verified on a scratch Postgres: CAS arms (insert/match/
stale/NULL), admin floor (demote/refuse/promote), retire switch (insert/
in-use-refused/unchanged/idempotent unretire), cascade CTEs (counts, frozen
list kept, strip post-image, close first-stamp-wins), position() fold,
badge stamp idempotency.

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.