Skip to content

Compute isOpenComposite automatically during load - #40

Merged
AlexKempen merged 2 commits into
certfrom
claude/auto-hasopencomposite-c8kxsz
Aug 11, 2026
Merged

Compute isOpenComposite automatically during load#40
AlexKempen merged 2 commits into
certfrom
claude/auto-hasopencomposite-c8kxsz

Conversation

@AlexKempen

Copy link
Copy Markdown
Collaborator

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

claude added 2 commits August 11, 2026 05:17
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
AlexKempen merged commit 18cd930 into cert Aug 11, 2026
1 check passed
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]>
@AlexKempen
AlexKempen deleted the claude/auto-hasopencomposite-c8kxsz branch August 21, 2026 02:47
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.

2 participants