Skip to content

Control Point link v1.2: STEP files and part pictures reach Control Point; AI review runs through it when linked - #61

Merged
sushilm20 merged 4 commits into
mainfrom
feat/cp-files-pictures
Oct 29, 2026
Merged

sushilm20 merged 4 commits into
mainfrom
feat/cp-files-pictures

Conversation

@sushilm20

Copy link
Copy Markdown
Contributor

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 AI review, "when control point is linked it should work". This builds Control Kit's side of link contract v1.2 (docs/control-point-link.md §6 and §7). Control Point's side is ZOGWORK/control-point#340, and the two must merge together.

Files after a send

  • The STEP zip is now always a reference in the bundle, and so is anything over 4 MB. The panel uploads them right after the send, including a duplicate send, to the import Control Point answered with.
  • Because the zip left the idempotency key, adding STEP later reaches the same import instead of creating a new one.
  • POST /api/control-point/file streams the bytes unread, within the free plan's 10 ms CPU limit:
    • 64 MB cap and Content-Length required;
    • a body longer than it declared errors instead of arriving short;
    • only for the caller's own latest send of that assembly, in the same workspace;
    • it records the name in cp-sent, so the card shows "STEP files … are in Control Point".
  • The card offers Add STEP files (or Export and add STEP files) until the zip is in Control Point.

Part pictures

  • After a send the panel lists Control Point's picture keys and walks pictureTargets: one line per part identity, parts to make first, with Not needed and undrawable lines left out.
  • It sends batches of at most 40 pictures and 6 MB through POST /api/control-point/pictures, streamed unread with an 8 MB cap.
  • controlPointPictureKey is the revision the Worker caches a picture at, plus a line hash, so pictures Control Point already holds are skipped.
  • GET /api/preview?…&cached=1 returns a picture already drawn, or 404 not_cached, without ever asking Onshape.
  • Onshape budget: only parts Control Point has no picture of are drawn, at most PICTURE_FILL_PER_SEND = 30 per send. A part with a newer revision that was never drawn keeps its older picture.
    • A first HORS send (119 drawable unique parts) costs at most 30 billable shaded-view requests, fewer for parts whose drawer was already opened.
    • HORS is fully pictured after at most four sends, at most 119 requests once.
    • Later sends cost nothing unless the robot gained parts.
    • The robot picture is unchanged.

AI review through Control Point

  • When this Worker has no key of its own, a person linked with a workspace gets AI review:
    • /api/ai/status answers {enabled: true, via: 'control-point'}, and the panel asks again when the link or workspace changes;
    • /api/ai/review sends aiReviewAsk(trustedAiRequest(…)) with the link's bearer token, waits at most 190 seconds, and never retries.
  • These stay in Control Kit:
    • the AiAllowance per-person and global limits;
    • the 30-day cache at ai-review:{hash}:control-point;
    • the parseAiReview check of every answer.
  • Control Point's 429, 501, 502 and 504 pass through in plain words. A 401 ends the link and answers 409 revoked, like the other link routes.
  • No key or token reaches the browser, and Control Kit's own keys, if ever set, still take precedence.

Screenshots

Control Point's pages are in its PR. On the Control Kit card, the visible change is the "STEP files are / are not in Control Point" line, the Add STEP files button, and the part picture note shown after a send.

Tests

  • apps/worker/src/control-point.test.ts, against mock Control Point and mock Onshape, covers:
    • the zip going as a reference without changing the key;
    • streaming an upload, recording it, and recognising a duplicate;
    • refusing another import, another workspace, a wrong hash, an oversize or overlong body, and a revoked token;
    • listing and uploading pictures, and the 8 MB cap;
    • cached=1 never reaching Onshape;
    • AI status by state, a review forwarded with only valid items kept and cached, plain-word refusals, and a 401 unlinking.
  • packages/shared/src/control-point.test.ts covers the new key rule, pictureTargets ordering, and picture keys.
  • The mock Control Point and the fixture API serve the new routes.
  • corepack pnpm typecheck, eslint --ignore-pattern '.claude/**', pnpm test (294 tests), pnpm -r build and pnpm test:smoke (11) all pass.

Not verified

  • No live Control Point, Onshape, Gemini or Anthropic request was made, and no secret was set.
  • Real STEP zip sizes for HORS, and the Worker's streaming of a large body on the free plan, are not measured.

… and AI review runs through it when linked

- The STEP zip is always a reference uploaded right after the send, so it never changes the key and adding it
  later reaches the same import. POST /api/control-point/file streams files unread (64 MB) for the caller's own
  latest send; the card offers Add STEP files until the zip is there.
- Part pictures: Control Point's keys are listed, pictures it holds are skipped, cached ones go free, and at most
  30 parts it has no picture of are drawn per send. /api/preview?cached=1 never asks Onshape.
- AI review without this Worker's keys goes to Control Point with the link's token (190 s, no retries); the
  allowance, cache and parseAiReview stay here, a 401 answers 409 revoked, and /api/ai/status reports it.
- Contract v1.2 (docs/control-point-link.md, sections 6 and 7), mock Control Point, tests, CLAUDE.md.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the last review appear safe to merge.

Summary

This PR adds STEP uploads, part pictures, and AI review through a linked Control Point workspace.

Since the last review:

  • STEP files and large exports reach the import returned by a Control Point send.
  • Control Point imports can show part pictures from the linked Onshape scan.
  • AI reviews can use the linked Control Point workspace when Control Kit has no model key.

The earlier fixes remain present: uploads are recorded separately by import, duplicate sends retain their records, changed archive bytes are uploaded again, and picture runs track failures and run one at a time. No new actionable issue was found.

Reviews (4) · Last reviewed commit: "Greptile: allow the upload hash header i..." · Reviewed by Greptile

Comment thread apps/worker/src/control-point.ts Resolved
Comment thread apps/web/src/app/useControlPoint.ts Resolved
Comment thread apps/web/src/app/useControlPoint.ts Resolved
Comment thread apps/web/src/app/useControlPoint.ts Resolved
Comment thread apps/web/src/app/useControlPoint.ts Resolved
…gain, one picture run at a time, failed pictures shown
@sushilm20

Copy link
Copy Markdown
Contributor Author

@greptile review

# Conflicts:
#	CLAUDE.md
#	apps/web/src/app/useControlKit.ts
#	packages/shared/src/index.ts
@sushilm20

Copy link
Copy Markdown
Contributor Author

@greptile review

Comment thread apps/web/src/app/useControlPoint.ts Resolved
Comment thread apps/web/src/app/ControlPoint.tsx Resolved
@sushilm20

Copy link
Copy Markdown
Contributor Author

@greptile review

@sushilm20
sushilm20 merged commit dd21cbf into main Oct 29, 2026
2 checks passed
@sushilm20
sushilm20 deleted the feat/cp-files-pictures branch October 29, 2026 03:53
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