Skip to content

Check-in: "Update the BOM from the CAD file", ticked by default (#407) - #450

Merged
Sebagrei merged 3 commits into
mainfrom
feature/407-checkin-bom-from-cad
Nov 22, 2026
Merged

Sebagrei merged 3 commits into
mainfrom
feature/407-checkin-bom-from-cad

Conversation

@Sebagrei

Copy link
Copy Markdown
Collaborator

A check-in can now update the BOM of the revision from the CAD references of the version being checked in – the box Update the BOM from the CAD file, ticked by default, in the web check-in form and the desktop app's Check in….

Closes #407

What changed

  • services/bom_references.rs: plan() is split into plan_on() on one connection, so inside the check-in transaction it sees the references the check-in just stored. At check-in the instance counts come from file_references.instances (stored by the reference scan), so no file is parsed while the revision is locked. The add/update loop is shared by apply() and the new apply_on_checkin(): new children are added, CAD-counted quantities corrected (never from an assumed 1), circular children refused, nothing removed; kept_not_in_cad and not_in_teamcraft are reported; one bom.from_references audit entry with "source": "checkin" when a line changed. SolidCraft designs with placements now count as structure files (they were counted in cadrefs::instance_counts but filtered out by is_structure).
  • services/files.rs: check_in_with(…, CheckInOptions) runs the BOM step after store_uploads, in the same transaction; check_in() keeps its behaviour. uploads::finish passes the option on (never without check_in).
  • API: multipart field bom_from_references on POST …/checkin, body field on POST /uploads/{id}/finish, both off by default; the answers add bom: {added, updated, kept_not_in_cad, not_in_teamcraft, refused} (null without the field or without a structure file). Route help in api/mod.rs.
  • Web: the box in the check-in form (assembly items or revisions with CAD structure); the flash message adds e.g. BOM: 4 lines added, 1 quantity changed · not in TeamCraft: Lager.ipt · no longer in the CAD file: PRT-000012 (kept), nothing when nothing changed.
  • Desktop: the box in checkinDialog (shown when a revision file may be an assembly: assembly kinds, .prt, .stp/.step, .sc – pure rules in js/checkin-bom.js), bomFromReferences through workspace_checkin → multipart field (never on Park), the summary in the result toast.
  • Docs: guide/structure.md (new section, Inventor and SolidCraft as count sources), guide/desktop.md, guide/vault.md, reference/api.md, CHANGELOG.md, README.md, desktop/README.md, docs/OPEN_WORK.md.

Tests

  • tests/checkin_bom.rs: new children added, a differing CAD count corrected, an unreferenced line kept and reported, a missing file reported, one audit entry (and none on a repeat); an assumed 1 never overwrites a line; a circular child refused; park and a refused check-in (409 base version) leave the BOM untouched and the lock in place; no structure file / unticked box → bom null; the chunked finish path; the web form shows the ticked box and its field updates the BOM.
  • Unit tests in bom_references.rs (SolidCraft structure, stored counts, the summary line); scripts/desktop-checkin-bom.test.mjs (added to the ui job).

Not compiled or run locally (no builds on this machine): only cargo fmt --all (server and desktop) was run; Node.js is not installed here, so the JS was not syntax-checked either. CI verifies.

Checklist

  • This is my own work (or my AI agent's, written from its own
    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).
  • Reading a file format: no new format findings (n/a).
  • The documentation is updated in this pull request (CHANGELOG.md,
    README.md, docs/src/**, docs/OPEN_WORK.md where it applies).
  • cargo fmt --all --check, cargo clippy --all-targets -- -D warnings
    and cargo test pass locally, or CI runs them. (fmt passes; clippy and tests: CI)

🤖 Generated with Claude Code

fork and others added 2 commits November 22, 2026 20:06
A check-in can update the BOM of the revision from the CAD references of
the version being checked in, in the check-in's transaction:

- services/bom_references.rs: plan() split into plan_on() on one
  connection (sees the references the check-in just stored; counts from
  file_references.instances, no parsing under the lock); the add/update
  loop shared by apply() and the new apply_on_checkin() (new children
  added, CAD-counted quantities corrected, never an assumed 1, circular
  refused, nothing removed; kept_not_in_cad / not_in_teamcraft reported;
  audit bom.from_references with source checkin). SolidCraft designs
  with placements count as structure files.
- services/files.rs: check_in_with() with CheckInOptions; check_in()
  keeps its behaviour. uploads::finish passes the option on.
- API: multipart field bom_from_references on POST .../checkin, body
  field on POST /uploads/{id}/finish (off by default), answer adds bom.
- Web: the box in the check-in form (assembly items or CAD structure),
  the flash message says what changed.
- Desktop: the box in Check in... (js/checkin-bom.js), bomFromReferences
  through workspace_checkin, the result line in the toast; never on Park.
- Tests: tests/checkin_bom.rs, unit tests, scripts/desktop-checkin-bom.test.mjs.
- Docs: guides (structure, desktop, vault), API reference, CHANGELOG,
  README, desktop/README, OPEN_WORK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review findings on PR #450:

- file-status answers bom_structure (bom_references::has_structure: the
  structure rule on the stored reference counts, no parsing); the desktop
  shows *Update the BOM from the CAD file* for that flag, an assembly item,
  an assembly file or a SolidCraft design (.sc and .solidcraft) - no
  longer for every NX/Creo .prt or STEP export.
- Web: the check-in box also uses has_structure; cad_structure counts STEP
  assemblies (Exchange) that lead to other items.
- Check-in: items referenced only through components excluded from the
  BOM in the CAD file are no longer reported as "no longer in the CAD
  file" (Collected/Plan.excluded_items, unit tests).
- plan(): the CAD files are parsed for their counts with no pooled
  connection held (load_files / compare_on split; the check-in keeps
  everything on its transaction).
- Docs: structure.md, desktop.md, desktop/README, api.md, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Sebagrei
Sebagrei marked this pull request as ready for review November 22, 2026 20:51
…om-from-cad

# Conflicts:
#	.github/workflows/desktop.yml
#	CHANGELOG.md
#	desktop/ui/js/workspace.js
#	docs/OPEN_WORK.md
#	docs/src/reference/api.md
#	src/api/mod.rs
#	src/services/checkouts.rs
@Sebagrei
Sebagrei merged commit 95debea into main Nov 22, 2026
8 checks passed
@Sebagrei
Sebagrei deleted the feature/407-checkin-bom-from-cad branch November 22, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check-in: "Update the BOM from the CAD file" checkbox, ticked by default

1 participant