Compute isOpenComposite automatically during load - #40
Merged
Conversation
A part studio is an open composite when Onshape's /parts response has more than one part and one is a composite (bodyType === "composite"). Compute this during load instead of relying on a manual admin toggle. - Model bodyType on OnshapePart (regenerate the /parts reference dump). - Detect open composites in a dedicated load step (part studios only, every load), and persist the flag on the insertable row. - Make part-number indexing composite-aware: for an open composite it reads only the composite part, raising UNSTABLE_COMPOSITE when a configuration loses its composite and MULTIPLE_PARTS when more than one composite resolves. - Remove the admin toggle route, its mutation hook, and the "Open composite" switch; drop the field from the build-status DTO. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_015v5N7js8uGfu4DHXRrwvtN
Address review feedback on the isOpenComposite work: - Extract a shared evaluateParts(parts) that returns hasMultipleParts, isOpenComposite, and the part to index. computeOpenComposite and parsePartStudioParts now build on it instead of each re-deriving the composite filtering. A non-composite studio indexes parts[0] (more than one part is just MULTIPLE_PARTS), dropping the scan-for-a-number loop. - Document the Onshape schema reference workflow in openapi-ts.config.ts and onshape-types.ts (add the operation, regenerate, hand-author the subset) so modeling a new field isn't a guessing game. - Add reusable insertable factories (insertableTarget, parsedInsertable) and an override-taking seedInsertable; use them to make the load and parse tests behavior-focused and readable, and trim the saveInsertable tests to the reload-vs-insert column split. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_015v5N7js8uGfu4DHXRrwvtN
AlexKempen
pushed a commit
that referenced
this pull request
Aug 16, 2026
* added basic error enum functionality * Update branch to current feature changes * Fixed package-lock mismatch * Drop maxWorkers pin and dead route, finish the HttpStatus sweep The hand-merge that brought this branch up to date pulled in two changes unrelated to the status-code work: - `maxWorkers: 1` on the backend vitest project. The suite passes without it (190/190) and runs in 34s instead of 58s. Storage isolation is per-test-file and `applyD1Migrations` is idempotent, so parallel workers are already safe by design. - The `/toggle-open-composite` route, which #40 deleted when the flag became something load computes. Nothing calls it, and writing the flag by hand would just be overwritten on the next load. Also convert the call sites the sweep missed: `getLibraryParam`, the onError rate-limit and fallback responses, `OnshapeRateLimitError`, and the 429 check in `OnshapeApi`. Test assertions keep their literals so they still pin the wire values independently. Moves the http-status-ts import in onshape-api.ts up with the other imports. --------- Co-authored-by: Claude <[email protected]>
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.
A part studio is an open composite when Onshape's /parts response has
more than one part and one is a composite (bodyType === "composite").
Compute this during load instead of relying on a manual admin toggle.
every load), and persist the flag on the insertable row.
reads only the composite part, raising UNSTABLE_COMPOSITE when a
configuration loses its composite and MULTIPLE_PARTS when more than
one composite resolves.
composite" switch; drop the field from the build-status DTO.
Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_015v5N7js8uGfu4DHXRrwvtN