Skip to content

feat(windchill): add document integration - #6577

Merged
waleedlatif1 merged 10 commits into
stagingfrom
plan-windchill-integration
Aug 12, 2026
Merged

feat(windchill): add document integration#6577
waleedlatif1 merged 10 commits into
stagingfrom
plan-windchill-integration

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Summary

  • add 26 Windchill WT.Document tools with Basic-auth reads and CSRF-protected mutations
  • add secure content upload/download handling and the Windchill block
  • add typed contracts, tests, generated metadata, and integration documentation

Type of Change

  • New feature

Testing

  • 41 focused Windchill tests
  • monorepo type-check, lint, and format checks
  • strict API validation and all repository audits
  • live Windchill smoke test pending installation credentials

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 12, 2026 8:08pm

Request Review

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

PR Summary

High Risk
New executor-facing API accepts customer PLM credentials and can delete documents, change lifecycle state, and move engineering files; mistakes or weak validation could affect production Windchill data despite delegation and file-access guards.

Overview
Adds a PTC Windchill integration so workflows can manage WT.Document objects over WRS 2.7 OData with Basic auth (OAuth called out as unsupported).

A new POST /api/tools/windchill route runs 27 operations: OData reads (list/get/structure/states/content/attachments), CSRF-protected create/update/delete and checkout/check-in/revise/lifecycle/security-label mutations, plus primary content and attachment upload/download as UserFiles with delegation auth (sim:windchill), file ownership checks, and aggregate size limits.

Ships a Windchill workflow block, Zod API contracts, WindchillIcon and catalog/docs wiring, and a large route test suite for auth, payloads, and file paths.

Reviewed by Cursor Bugbot for commit 0b93551. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a complete Windchill document-management integration, including workflow tools, a configurable block, secured API handling, generated registry metadata, tests, and user documentation.

  • Adds document query, creation, update, deletion, lifecycle, checkout, revision, and security-label operations.
  • Adds primary-content and attachment upload/download flows.
  • Registers the Windchill block and tools throughout the application and documentation catalogs.
  • Populates the documentation Input tables for all current Windchill actions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/windchill/route.ts Adds authenticated dispatch for Windchill document mutations and file-transfer operations with protected outbound-request handling.
apps/sim/tools/windchill/utils.server.ts Implements CSRF-aware requests and secure content transfer using validated, pinned destinations and constrained content URLs.
apps/sim/blocks/blocks/windchill.ts Defines the Windchill workflow block, action forms, tool selection, and parameter mappings.
apps/sim/lib/api/contracts/tools/windchill.ts Adds typed request validation for Windchill credentials, service roots, document operations, and file inputs.
apps/docs/content/docs/en/integrations/windchill.mdx Documents the integration and provides populated Input and Output tables for the current action catalog.

Sequence Diagram

sequenceDiagram
  participant Workflow as Workflow executor
  participant Route as Windchill API route
  participant Guard as URL and DNS validation
  participant Windchill as Windchill WRS
  participant Storage as Sim file storage

  Workflow->>Route: Invoke document operation
  Route->>Route: Authenticate delegated executor
  Route->>Guard: Validate service URL and resolve public address
  Guard-->>Route: Return pinned destination
  Route->>Windchill: Authenticate and obtain CSRF token
  alt Metadata or lifecycle operation
    Route->>Windchill: Send OData request
    Windchill-->>Route: Return document result
  else Content download
    Route->>Windchill: Resolve same-origin content URL
    Windchill-->>Route: Return content URL
    Route->>Guard: Validate and pin content destination
    Route->>Windchill: Download content
    Route->>Storage: Store canonical user file
  else Content upload
    Route->>Storage: Read authorized user file
    Route->>Windchill: Complete protected upload handshake
  end
  Route-->>Workflow: Return normalized tool output
Loading

Reviews (3): Last reviewed commit: "feat(windchill): add update common prope..." | Re-trigger Greptile

Comment thread apps/docs/content/docs/en/integrations/windchill.mdx
Bill Leoutsakos and others added 7 commits August 12, 2026 12:48
…leared-field handling

Validated the integration end to end against PTC Windchill REST Services 2.7
documentation and fixed every divergence found.

Protocol correctness:
- Encode OData query spaces as %20 rather than the form-encoded `+` that
  URLSearchParams emits. Every multi-token $filter and $orderby reached
  Windchill as a literal `+` and could not match.
- Download content through the documented typed navigation
  `<content>/PTC.ApplicationData/Content/URL`, which returns a signed vault
  URL, instead of a `$value` segment that WRS does not implement. The
  resolved URL is pinned to the configured HTTPS origin.
- Terminate every Stage 2 CacheDescriptor_array entry with `;` to match the
  documented grammar.
- Raise the $top bound to Windchill's documented 2000 maximum, keeping 200 as
  the default page size.

Cleared-field handling:
- The executor merges raw block inputs before the block's param transform, so
  omitting a key could not clear it. A cleared numeric or boolean field
  reached the URL builder as '' and threw, and cleared optional strings failed
  contract validation. Coercions now emit an explicit undefined, and the
  internal-route body strips blanks centrally.

Robustness and contracts:
- Bound the document-structure walk to the depth actually requested.
- Loosen response schemas that re-applied request-side bounds to
  provider-returned values, which turned committed mutations into opaque
  parse failures.
- Return contract-shaped bodies for oversized, malformed, and unhandled
  request failures.
- Normalize downloaded content types and drop charset parameters.

Presentation and docs:
- Square the icon to a centred tile on white.
- Replace WT.Document and PATCH-compatible jargon with plain language.
- Fix canvas sentence noun stutters on the bulk operations.
- Correct the revision skill's unverified working-copy claim to read the OID
  back rather than assume it, and add retirement and stale-checkout skills.
- Add a manual intro section to the integration docs page.
@waleedlatif1
waleedlatif1 force-pushed the plan-windchill-integration branch from 79a871a to 77cec66 Compare August 12, 2026 19:49
…te baseline

Tool descriptions feed both the integration catalog and the generated docs page,
so the plain-language pass had to reach them too: drop WT.Document and
PATCH-compatible from the operation copy, and correct the $top bound the
descriptions still advertised as 200.

Correct the docs intro's attachment wording, gloss OData on first use, and
attribute the bulk-atomicity claim to PTC's documented behavior.

Raise the API route-count baseline, which staging advanced while this branch
was behind.
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1d51f92. Configure here.

Name, Number, and Organization are rejected by the PATCH-based update
operation, and the rejection message told users to reach for Windchill's
UpdateCommonProperties action that the integration did not expose. Add it.

PTC documents UpdateCommonProperties as a bound DocMgmt action taking an
Updates wrapper, available when hasCommonProperties is set on the Documents
entity, and refused while the document is checked out. The subblock and param
descriptions carry that constraint, and the rejection message now names the
operation that does the job.
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

…operation

Validating the new operation surfaced that nothing enforced the block-to-tool
alignment the review process had been checking by hand. Assert it for all 27
operations instead: every required tool param has a required, non-advanced
input under that operation's condition, and no operation shows an input its
tool cannot accept.

Both fail on a deliberately broken condition or a dropped required flag.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d20ac2f. Configure here.

@waleedlatif1
waleedlatif1 merged commit 2805a8d into staging Aug 12, 2026
29 checks passed
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