From acd88ffb1eff390c9f70807b68642290d6b8bfda Mon Sep 17 00:00:00 2001 From: fork Date: Sun, 22 Nov 2026 19:37:34 +0100 Subject: [PATCH 1/2] Check out several parts of an assembly at once (#415) Server: POST /api/v1/checkouts (services::checkouts::checkout_many) checks out a list of revisions (by id, or item and code) in one transaction with a result per revision: the ones that can be taken are checked out, the rest are reported with a reason (not_found, released, in_review, locked, forbidden). Rows are locked in one statement ordered by id, so overlapping batches cannot deadlock and every revision has one winner; hidden revisions answer like missing ones; one revision.checkout audit record per changed revision. Tests in tests/checkout_batch.rs. Desktop: "Check out parts..." on an assembly (revision toolbar and Structure tab) shows the structure as a tree with check boxes, state and lock holder, checks out the ticked parts with workspace_checkout_many, makes their files writable and lists what was refused. Docs: CHANGELOG, README, api.md, desktop guide, desktop/README.md, threat model, OPEN_WORK. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 17 ++ README.md | 4 +- desktop/README.md | 1 + desktop/src/commands.rs | 16 ++ desktop/src/main.rs | 1 + desktop/src/workspace.rs | 174 ++++++++++++++++ desktop/ui/js/revision.js | 12 +- desktop/ui/js/workspace.js | 115 +++++++++++ docs/OPEN_WORK.md | 4 +- docs/src/dev/threat-model.md | 1 + docs/src/guide/desktop.md | 27 ++- docs/src/reference/api.md | 41 +++- src/api/concurrency_api.rs | 25 +++ src/api/mod.rs | 2 + src/services/checkouts.rs | 376 ++++++++++++++++++++++++++++++++++- tests/checkout_batch.rs | 326 ++++++++++++++++++++++++++++++ 16 files changed, 1135 insertions(+), 7 deletions(-) create mode 100755 tests/checkout_batch.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb48d14..2418bc1d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,23 @@ see the notices in the README. ## [Unreleased] +### Added + +- **Check out several parts of an assembly at once** (#415): `POST /api/v1/checkouts` + takes a list of revisions (by id, or item and code) and checks them out in one + transaction with a result per revision – the ones that can be taken are checked + out, the rest are reported with a reason (`not_found`, `released`, `in_review`, + `locked`, `forbidden`), so one released or locked part does not stop the others. + The rows are locked in a fixed order, so overlapping batches cannot deadlock and + every revision has one winner; each changed revision gets its own + `revision.checkout` audit record. A server batch rather than one call per part: + one round trip and one consistent moment for the whole set, with the rules of + the single check-out in one place. TeamCraft Desktop: *Check out parts…* on an + assembly (revision toolbar and *Structure* tab) shows the structure as a tree + with check boxes, state and lock holder (parts that cannot be checked out are + disabled with the reason), checks out the ticked ones in one step, makes their + files in the working folder writable and lists what was refused. + ## [0.2.12] - 2026-11-22 ### Security diff --git a/README.md b/README.md index 6b9bde78..8c292a62 100755 --- a/README.md +++ b/README.md @@ -197,7 +197,9 @@ end-to-end tests against a real PostgreSQL. **Files and versions** - **Check-out / check-in** – exclusive locks per revision; a check-in based on - an outdated version is refused instead of overwriting it. + an outdated version is refused instead of overwriting it. Several parts of an + assembly can be checked out in one step to edit them in its context + (`POST /api/v1/checkouts`, a result per part). - **Versions and rollback** – every upload is a new version; download or restore any of them, history is never rewritten. - **Vault explorer** – project groups as folders with lock owners, files and diff --git a/desktop/README.md b/desktop/README.md index 3491c674..a4fb0b91 100755 --- a/desktop/README.md +++ b/desktop/README.md @@ -39,6 +39,7 @@ TeamCraft server – it is a client, not an offline copy. | SolidCraft item data | *Item data* in the Workspace tab (SolidCraft designs of your check-out, not open in SolidCraft): `solidcraft-cli run