forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on af331ecc8a4a0c661bcdbc905b95bb2cf77a72de

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
🧪 test: port e2e, rate_limit, ai_bridge, ai_protocol to the Postgres harnessAhmet Kaan Gümüş · e0e3597
🧪 test: port e2e, rate_limit, ai_bridge, ai_protocol to the Postgres harness

e2e: spawn_server_with_ai re-pointed at init_test_tenants; the board
helpers read and seed through runtime sqlx (stroke ids, payloads,
epoch, participants roster); promote writes app_user; ULID literals
became common::ABSENT_ID.

rate_limit: the durable-window trio stands on one control database's
rate_limit table (two UserRateLimiters, pools dialed before the clock
freezes); fold reads are query_scalar; the down-database leg takes the
fold's table away and hands it back instead of flipping the deleted
health flag; embedded-engine caveats deleted.

ai_bridge/ai_protocol: bootstrap renames plus the chatbot history seed
inserted over sqlx; the down-socket test outages the school registry
table and recovers, keeping both original assertions.

src/rate_limit.rs: rebuilt the wave-1-deleted epoch-roll unit test
(a_wall_epoch_roll_charges_no_request_twice + its admits helper) over
the control database, driving sync_once's epochs directly.
🐛 fix: rename app_user in the six FromRow entities the port missedAhmet Kaan Gümüş · 0466c1a
🐛 fix: rename app_user in the six FromRow entities the port missed

PagedList reads with SELECT * + FromRow need field names to match
columns; Attendance, Enrollment, ExamAttempt, ExamResult, ExamAnswer
and AnswerImage carried a bare `user` field, so any paged read 500'd
with a database error (found live by e2e's full_user_journey via
GET /events/{id}/attendance). Attribute-only: query_as! sites are
unaffected, no .sqlx refresh needed.
🗃️ feat!: port exams domain to sqlx/PostgresAhmet Kaan Gümüş · 381e16c
🗃️ feat!: port exams domain to sqlx/Postgres

- db/{exam,exam_question,exam_attempt,exam_answer,exam_result,question_image,answer_image}:
  SurrealQL -> static query!/query_as! (PagedList exemption kept for
  exam_question listing); composite natural PKs (exam,user,seq) everywhere;
  sitting scoping via key.rs wire helpers unchanged.
- Freeze gate: write_unfrozen/IndexedResults/FROZEN_SLOT deleted; freeze is
  a shared in-tx freeze_gate() (exam row FOR UPDATE + EXISTS(attempts)) run
  inside each question/image write's own tx_with_retry.
- EXAM_LOCK deleted: sitting create re-judges sittable/window gates on the
  locked exam row (guard_start) then claims exam_sat_total in one CTE;
  exam delete locks the exam row before its ordered cascade and collects
  blob keys inside the tx; answer/answer-image saves lock the exam row
  ahead of their upserts (bump-and-restore touch tricks deleted).
- PRESENCE_LOCK deleted: join = unconditional left_at clear; last-out =
  single conditional stamp_left_if_running (left_at IS NULL AND
  finished_at IS NULL AND live-schedule in-progress); ExamPresence map
  mutex stays for counts.
- Grade tx: exam row FOR UPDATE, draft gate in-tx, kind_ref claim
  (retired=false), 4-counter first-vs-regrade precedence preserved exactly;
  remove() refunds via data-modifying CTE.
- THROW markers -> early returns: exam_redraft, questions_frozen, no_exam,
  question_subject_gone, question_row_gone, question_stale_move,
  exam_missing, exam_draft, kind_retired.
- cfg(test) mods left for wave 3.
🗃️ 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.
🗃️ feat!: port boards, notes and rag to sqlx/PostgresAhmet Kaan Gümüş · c928ecf
🗃️ feat!: port boards, notes and rag to sqlx/Postgres

- board/note/course_note/rag_output db layers: static query!/query_as! against
  the union-schema prepare DB; PagedList/FieldUpdate for the runtime builders
- file caps via the cap claim CTE at each call site; board create claims
  app_user.board_count, delete releases it in the same tx
- BOARD_ROSTER_LOCK deleted: invite is one guarded atomic-array union
  (coalesce(array_agg(DISTINCT unnest(participants || $n))) with a
  cardinality cap on the row version the UPDATE acts on)
- stroke dual-counter claim: one UPDATE bumps both counters, lifetime cap +
  open guard + epoch in the WHERE; zero rows re-read via cap::full_kind
- board clear: pre-image read under SELECT ... FOR UPDATE, refusal precedence
  preserved (closed > not-creator > locked > blank), guarded epoch bump,
  marker insert, one tx (CLEAR_REFUSED THROW now Rust-level refusals)
- rag_output.payload JSONB (sqlx::types::Json), sources uuid[] cascade via
  $n = ANY(sources); note/course_note delete cascades sweep rag_output
  in-tx (real FKs refuse dangling derived rows)
- board rosters: uuid[] + GIN, membership reads $n = ANY(participants)
- dead SurrealQL-shaped constants removed (BOARD_OPEN_GUARD, BOARD_STROKE_TABLE,
  counter/file-count field constants); uuid::Uuid imports for my domain files