Repository navigation
Check out several parts of an assembly at once (#415) - #445
Merged
Merged
Conversation
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 <noreply@anthropic.com>
Server: checkout_many resolves every entry under the visibility guard (by code and by id) before deduplicating and locking, so a hidden revision is deduplicated by what was sent and never locked - exactly like a missing one; the result count and row locks no longer tell them apart. Desktop: an unreadable answer of POST /checkouts is an error instead of "nothing was checked out"; Check out parts... greys out parts of groups the user is not a member of (and everything for viewers). Docs: threat model row no longer cites the read_permissions sweep (its probe body does not reach POST /checkouts) and states the echo of the caller's own identifiers; api.md not_found row; desktop guide reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sebagrei
marked this pull request as ready for review
November 22, 2026 20:50
…several-parts # Conflicts: # CHANGELOG.md # docs/OPEN_WORK.md # docs/src/dev/threat-model.md # docs/src/reference/api.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #415
What changed
Server –
POST /api/v1/checkouts(services::checkouts::checkout_many){"revisions": [{"id": …} | {"item": "PRT-1", "code": "A"}]}(codelatest= newest), at most 500 entries, duplicates answered once.revisions::ensure_checkout_possible) stay in one place. This is documented in the CHANGELOG andapi.md.SELECT … FOR UPDATE ORDER BY id, so two overlapping batches cannot deadlock: the second waits, then reports the parts the first took aslocked. The full rows are read after the lock, so holder names are current.ok,already(held before: no change, no audit),reason(not_found,released,in_review,locked,forbidden),message,checked_out_by_name. Hidden revisions answer exactly like missing ones and echo only what the caller sent.revision.checkoutaudit record per changed revision. Viewers get 403 for the whole request.api/mod.rs.Desktop
workspace_checkout_many(workspace::checkout_many): it callsPOST /checkouts, then fetches the files of every revision now checked out through the existingfetch. The files become writable (locked_by_me), an unchanged copy only loses its read-only flag, and local changes are kept. It returns the results, the refused list, the download report and a summary (checkout_many_summary, unit-tested).checkoutPartsDialog(tab)inui/js/workspace.jsbuilds the tree from the BOM (bom?expand=true&rule=latest) and adds state, group and lock holder from the workset. It shows checkboxes, and parts that are released, in review or held by someone else are disabled with the reason. After the check-out it shows a toast and the refused list.Docs: CHANGELOG
[Unreleased], README Features,docs/src/reference/api.md(new section and resource table),docs/src/guide/desktop.md(new section Check out parts of an assembly),desktop/README.md,docs/src/dev/threat-model.md,docs/OPEN_WORK.md(#415 ticked in the #408 line).Out of scope (optional follow-up from the issue): Revise and check out for released parts.
Tests
tests/checkout_batch.rs:forbiddenfor that part while their own part goes throughtokio::join!): each revision has one winner, the other side reports itlockedwith the winner's name, and there is one audit record per revisionUnit tests:
checkouts::tests::checkout_summaries(server) andworkspace::tests::checkout_many_summaries(desktop).Not compiled or run locally. There are no builds on this machine (the user's rule). Only
cargo fmt --allran, in the root and indesktop/.node --checkwas not available, so the JS was only reviewed by hand. CI verifies the build, clippy and tests.Checklist
knowledge), or openly licensed material under a compatible licence
that is credited. It contains no code decompiled, disassembled or
rewritten from proprietary software and no leaked code
(CONTRIBUTING.md).
CHANGELOG.md,README.md,docs/src/**,docs/OPEN_WORK.mdwhere it applies).cargo fmt --all --check,cargo clippy --all-targets -- -D warningsand
cargo testpass locally, or CI runs them. (fmt ran; clippy and tests are left to CI)🤖 Generated with Claude Code