Skip to content

feat(cli): selftest command and a compatibility report form (#179) - #217

Merged
andrewbartels1 merged 4 commits into
mainfrom
feat/selftest
Nov 9, 2026
Merged

andrewbartels1 merged 4 commits into
mainfrom
feat/selftest

Conversation

@andrewbartels1

Copy link
Copy Markdown
Owner

Adds a selftest command that checks the server against the user's own SolidWorks, plus a compatibility report form and a Compatibility docs page to collect the results. Closes #179.

What it does

With SolidWorks open, run uvx solidworks-mcp-python selftest (--selftest works too). It calls the same MCP tools a client does, in process, across four areas. Each is checked against a hand calculation in selftest/expected.py:

Area Builds Checks
Part 40 × 20 × 10 mm block, Ø10 hole through it, 2 mm fillet; Ø9.5 × 20 mm pin Volume and bounding box after each feature (via verify_model)
Assembly Block and pin, a concentric and a coincident face mate 2 components, 2 mates, no interference
Drawing One isometric view of the block 1 view
Export The block as STEP File exists and isn't empty

It prints PASS, FAIL or SKIP per area, then a Markdown summary and a link that opens the new Compatibility report form already filled in. --report FILE also writes the summary to a file. Exit codes: 0 all pass, 1 any fail or skip, 2 can't run.

How it protects the user's work

  • It never starts SolidWorks. If no SLDWORKS.exe is running (checked with tasklist, no COM call), it exits with code 2.
  • Files are saved only into a temporary folder, which is deleted afterwards.
  • It closes only documents it opened itself, without saving them. A document that was open before the run is never activated or closed.
  • The report shows template file names only, never full paths.

Changes

  • New src/solidworks_mcp/selftest/ package: cli, runner, areas, expected, documents, report, results, environment.
  • New adapter read get_application_info, which returns the revision, language and default templates. It's in base, the pywin32 adapter (inside _handle_com_operation), the mock, and the circuit-breaker and connection-pool pass-throughs.
  • server.cli_main routes selftest / --selftest.
  • New .github/ISSUE_TEMPLATE/compatibility.yml form, labelled compatibility. feedback.yml and the README's "Tested on" line point to it.
  • New docs/compatibility.md, added to the nav. The install guide mentions the command. CHANGELOG entry added.
  • OpenSpec change selftest-and-compatibility-report.

Verification

  • Full mock suite: 3,773 passed at 100% coverage. Ruff clean; mkdocs build --strict clean.
  • Live, SolidWorks 2026 SP4.0 (34.4.0):
    • tests/live/test_live_sw_selftest.py passed in 2 min 06 s. It opened an unsaved user part first, then ran all four areas. Every area passed. Afterwards the user part was still unsaved, with the same features, and it was the only document left open.
    • The maintainer ran the real command by hand and all 4 areas passed (13/13 checks). This is the first row on the Compatibility page.

solidworks-mcp-python selftest (or --selftest) builds a part, an assembly,
a drawing view and a STEP export through the MCP tools, checks each
against a hand calculation, and prints a report with a link that opens
the new compatibility issue form filled in. It never starts SolidWorks,
and never touches a document that was open before it started.

Adds one adapter read, get_application_info (revision, language, and the
default templates by file name), on every adapter layer.
@andrewbartels1
andrewbartels1 merged commit cca8907 into main Nov 9, 2026
15 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.

feat(cli): --selftest command and a compatibility-report issue template

1 participant