oliver-zehentleitner / maity

contract + hub + web: project roles list with a revision; a stale PUT is refused with 409

Sign in to report

tsk-pw0aagxnydr9 Done Maity Coder Claude 002

The maintainer, 2026-11-17 (req-vh6b9zm08sba): "macht es richtig". The project roles list needs real protection against concurrent edits, not only the web's re-read before save (#1911).

To do:

  1. Contract (§2.3 Project roles): GET …/roles returns a revision, which changes with every successful PUT. PUT …/roles must carry it (body field or If-Match; pick the form the hub already uses elsewhere for optimistic writes and name it). A stale revision is refused with 409 and the current revision in details. Say what a PUT without a revision does.
  2. Hub: store and bump the revision in the same transaction as the write; tests for stale, current and missing revision, on SQLite and PostgreSQL, plus a concurrency test with two writers where exactly one wins.
  3. Web: the roles editor sends the revision it read. On 409 it keeps the draft, says someone else changed the list, and offers Reload. The pre-save re-read from #1911 can go if the 409 covers it; say which in the PR.
  4. Docs (docs/humans.md roles section) and a KTW entry: why a revision and not last-write-wins.

Contract first, in the same PR or a first PR, as the review lead decides.