Skip to content

CAD downloads, part pictures, and Control Kit's AI review through Control Point (link contract v1.2) - #340

Merged
sushilm20 merged 3 commits into
mainfrom
feat/cad-files-pictures
Oct 29, 2026
Merged

sushilm20 merged 3 commits into
mainfrom
feat/cad-files-pictures

Conversation

@sushilm20

@sushilm20 sushilm20 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

The owner asked: "i should also be able to download all the parts in control point itself, also show the preview images in control point too", and for Control Kit's AI review, "when control point is linked it should work". This builds Control Point's side of contract v1.2 (docs/control-kit-link.md, a copy of control-kit's docs/control-point-link.md). The Control Kit side is ZOGWORK/control-kit#61, and the two must merge together.

Downloads (§6)

  • New bearer route POST /api/integrations/control-kit/workspaces/:id/imports/:importId/files?name=:
    • takes raw bytes up to 64 MB (zip, xlsx or csv, matching the name's extension) and checks X-Content-SHA256;
    • stores the file as a CAD doc of the import, on its robot;
    • puts it in the import's file list, in place of its own reference or the "STEP files" placeholder it completes;
    • the same bytes again count as a duplicate, and new bytes replace the old file;
    • the file list is swapped only from the value it was read as, so two uploads never drop each other.
  • Control Kit now always sends the STEP zip this way, right after the bundle. A send without STEP can get it later with Add STEP files in Control Kit.
  • The robot page offers STEP files for every part to make and Workbook downloads:
    • in the header, from the newest send that has each one;
    • on the Make group;
    • on the Files tab, which also says when the zip comes from an older send.
    • An unstored zip reads "Not uploaded yet. In Control Kit, press Add STEP files."

Part pictures (§6)

  • Migration 154 adds cad_parts.ck_picture_url, ck_picture_key and ck_picture_at. Imports never touch them.
  • GET …/imports/:importId/pictures lists the keys Control Point holds, so Control Kit skips pictures that are already here.
  • POST …/imports/:importId/pictures takes up to 40 PNGs per call (8 MB, 1 MB each), keyed by part identity and Control Kit's revision key:
    • an unchanged key is skipped;
    • a new key replaces the picture and deletes the old file;
    • non-PNGs, bad keys and unknown parts are counted and refused.
  • Each BOM row shows the part's Onshape picture as a thumbnail. The drawer shows it large, on Control Kit's dark stage, with when it arrived.

AI review for Control Kit (§7)

  • New bearer route POST …/workspaces/:id/ai/review (server/controlKitAi.ts).
  • It accepts only a version 1 review: 1 to 150 lines of part facts and catalog candidates, with instructions and schemas of at most 8,000 characters each. So it can't be used as a general model proxy.
  • Providers:
    • Gemini first, with responseSchema;
    • Anthropic once with a JSON-schema output, only when Gemini answers 429 or 5xx or can't be reached (never on a 4xx);
    • 90-second calls and no blind retries, the same policy as Bruno.
  • Each workspace gets at most 20 reviews an hour and 100 a day. These limits are in memory, so they reset on restart.
  • The answer is the model's items as given. Control Kit validates them against its own request, caches them, and enforces its per-person and global allowance.

Screenshots

Captured from a local server with a throwaway database. The bundle was built from the HORS scan saved on 2026-10-26 and matched against the published catalogs. The 11 part pictures are the Onshape pictures Control Kit had already cached, and nothing new was drawn. The STEP zip is Control Kit's committed sample zip, standing in for a real export.

Robot header: STEP and workbook downloads beside the robot picture.
Robot header

BOM rows with part pictures, and STEP files on the Make group.
BOM rows

Part drawer with the Onshape picture.
Part drawer

Files tab: downloads and the latest send's files.
Files tab

The robot page at 390 px.
Mobile

Tests

  • server/__tests__/controlKitFiles.test.ts (new, real server, fake models on loopback) covers:
    • uploading a zip in place of its reference, then downloading it as an attachment;
    • a duplicate upload, and a replacement that removes the old file;
    • a workbook filling a placeholder;
    • refusing a wrong checksum, the wrong type, another workspace's import, and an unknown token;
    • storing, skipping, replacing and listing pictures, which another team can't fetch;
    • Gemini answering;
    • failover to Anthropic on a 429, and no failover on a 403;
    • both providers failing, and an unparseable answer;
    • a bad request and a non-member;
    • the hourly workspace limit answering 429 with Retry-After.
  • cadRobotBom.test.tsx covers the header, Make and Files downloads (including a zip from an older send) and the pictures in rows and the drawer.
  • controlKitLink.test.ts, cadRobots.test.ts and cad.test.tsx pass unchanged. npm run lint is clean.

Not verified

  • No live Control Kit Worker, Onshape, Gemini or Anthropic call was made. The model calls ran against a local fake.
  • No real STEP export was uploaded. A real HORS zip could be tens of MB, and only the 64 MB cap was tested.
  • The AI rate limits live in memory and reset when the VM restarts.

…ures, and AI review with Control Point's keys

- Files uploaded after a send (raw bytes, SHA-256 checked, 64 MB) are stored as CAD docs of the import and fill
  its reference or placeholder entry. The robot page offers the newest STEP zip and workbook as downloads.
- Part pictures by identity and Control Kit's revision key: listed, stored, replaced, shown in BOM rows and the drawer.
- AI review for Control Kit: Gemini first, Anthropic once on a rate limit or server failure, 90-second calls,
  20 an hour and 100 a day per workspace, strict request shape.
- Migration 154 adds cad_parts.ck_picture_*; docs/control-kit-link.md is this repo's copy of the contract.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Adds CAD downloads, part pictures, and AI review through the Control Kit link.

  • Robot pages offer the newest stored STEP files and workbook for download.
  • BOM parts show their Onshape pictures in rows and the part drawer.
  • Linked Control Kit reviews can use Control Point’s Gemini and Anthropic keys.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Control Kit review] --> G[Ask Gemini]
  G --> S{Response status}
  S -->|Success| B[Read model answer]
  S -->|Request or key error| E[Return failure]
  S -->|Rate limit or server error| K{Anthropic key set?}
  G -->|Connection failure| K
  K -->|Yes| H[Ask Anthropic once]
  K -->|No| E
Loading

Reviews (3) · Last reviewed commit: "Greptile: a refused model call is decide..." · Reviewed by Greptile

Comment thread server/controlKitAi.ts Resolved
Comment thread server/controlKitLink.ts Resolved
Comment thread server/controlKitLink.ts Resolved
Comment thread src/modern/pages/cad/RobotPage.tsx Resolved
Comment thread src/modern/pages/cad/RobotPage.tsx Resolved
Comment thread server/controlKitLink.ts Resolved
…model bodies fail over, downloads across every send, picture reset and cleanup
@sushilm20

Copy link
Copy Markdown
Collaborator Author

@greptile review

Comment thread server/controlKitAi.ts Resolved
@sushilm20

Copy link
Copy Markdown
Collaborator Author

@greptile review

@sushilm20
sushilm20 merged commit 096599c into main Oct 29, 2026
1 check passed
@sushilm20

Copy link
Copy Markdown
Collaborator Author

Production verification (merge commit 096599c):

  • "Deploy to Oracle VM" run 40814442225 on the merge commit: success.
  • https://tryctrlpoint.org/ 200; /connect/control-kit 200.
  • New routes refuse requests without a token: POST /api/integrations/control-kit/workspaces/1/ai/review returns 401; POST /api/integrations/control-kit/imports/1/files returns 403.
  • Not checked: the signed-in robot page (downloads, picture thumbnails, Files tab), which needs an owner sign-in. Migration 154 ran as part of the deploy; its effect shows on the first Control Kit send with pictures.

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.

1 participant