learning_ai_common_plat/services/platform-service
saravanakumardb1 33c1d8d5fa fix(platform-service): make fleet job claim truly atomic via datastore updateIfMatch
The foundation's revUpdateJob/revUpdateLease did a read -> rev-check -> write with
await points between them, so two CONCURRENT claims could both read the same rev,
both pass the check, and both write — a double-assignment the old (sequential) race
test could not catch.

Rewire revUpdateJob/revUpdateLease to delegate to the datastore's updateIfMatch,
which performs the compare and the write as one indivisible operation (Cosmos
If-Match; synchronous compare-set on memory). The coordinator's tryClaimJob keeps
identical external behavior (ok/conflict) but is now genuinely single-winner.

Upgrades the coordinator tests to prove atomicity under TRUE concurrency:
- two contenders via Promise.all -> exactly one ok, one conflict; assigned once;
  one run; one lease; leaseEpoch 1.
- N-claimer (15) stress via Promise.all -> one ok, N-1 conflicts, no double-assignment.
- N concurrent claimNextJob for one job -> exactly one non-null claim.
- N concurrent lease renewals -> exactly one wins.

Verified these concurrent tests FAIL against the old read-check-write (double-assign)
and pass after the fix.
2026-05-29 20:59:08 -07:00
..
scripts chore(platform): document script CLI output 2026-05-04 16:45:42 -07:00
src fix(platform-service): make fleet job claim truly atomic via datastore updateIfMatch 2026-05-29 20:59:08 -07:00
.gitignore feat(services): add platform-service (auth, audit, flags, notifications, blob) 2026-02-12 11:39:00 -08:00
Dockerfile fix(docker): INFRA-gap-02 unblock full-stack docker compose up 2026-04-16 15:48:32 -07:00
package.json feat(platform): add /devops page with platform common devops package 2026-05-11 03:38:06 +00:00
POSTAL_SMTP_SETUP.md feat(platform-service): add smtp email delivery and postal setup 2026-03-14 05:52:28 +00:00
tsconfig.json feat(services): add platform-service (auth, audit, flags, notifications, blob) 2026-02-12 11:39:00 -08:00
vitest.config.ts fix(ci): add --pool forks to all vitest test scripts to fix kill EPERM on Node v25 2026-03-27 23:23:38 -07:00