Skip to content

v1.1.95 — purpose checks on the design as used, and redacted diagnostics

Choose a tag to compare

@DMontgomery40 DMontgomery40 released this 15 Nov 11:23
0e9fa42

Added

  • A design's purpose is now data the code engine evaluates (scan-to-make #608). A cad_run script declares PURPOSE (what it is for, the bought product it follows, what it holds, what carries the load, where its user's eye is) and use(), which returns the part as used with held:<name> and world:<name> bodies. The inspection process compiles the purpose into requirements, adding those its words imply (a holder must name what it holds and mounts to; a vehicle takes 1.5 g jolts; a held screen faces the user), computes the force and moment at each mount from the geometry, and checks tape against 3M VHB's published stresses and that a resting part does not tip, lift or slide. It returns purpose, ready and renders.use. final: true is recorded only when the design is ready; otherwise final_refused gives the reasons. It fails closed where it cannot compute (tape on a contact that is not one flat patch, a mount declared other that carries a held body), still checks tape within a mix of mount kinds, holds the designer's numbers to floors (a held mass that fits the held body's size, at least a 1.5 N press, at most 25° off the user's eye for a screen), and needs each tape or rest surface to be a real slab rather than a block shaped to the part. Mesh mode and 3MF projects are unchanged. Three cookbook examples (desk_edge_cable_holder, desk_clamp_hook, phone_stand) carry a purpose and use().
  • cad_run takes role ("design" by default, "check" for a fit-check part or reference export) and records it on every receipt; a check run is never final and evaluates no purpose. Every valid run that is not final carries draft_reasons, plain sentences saying why, for a client that keeps the last valid run as a draft (scan-to-make #790). Receipts without role are design runs. Tested with build123d fixtures of the Nov 11 phone holder (a phone square to the cabin on a 30 mm taped strip is refused; the same phone aimed on a 60 mm pad is ready), a stand that tips, a mount not modelled and no purpose, and with a Sonnet-class capability test; nothing was printed or sliced.
  • counterpart_diagnostics (counterpart/1) returns this server's own redacted diagnostics bundle for a tester's bug report, {package, version, files: [{name, content, truncated}], notes}, so a client's Export Diagnostics can include the MCP's logs without knowing their paths: the configured printer (model, serial, connection route; firmware is not read), its settings, slicer path and version (never by running the slicer), CAD runtime status, recent tool errors, this run's stderr (MQTT and connection messages), redacted as it is captured. The Bambu network plug-in and native helper logs are left out: other programs write them, and they can hold secrets this server cannot recognise. Redaction fails closed: the configured secrets and secret tool arguments go wherever they appear, also URL-encoded, JSON-escaped or base64 (and before a long line is cut); a logged object is redacted by key before it is written, and an object whose field names a secret loses its other values; JSON files are redacted by structure and stay valid; settings show values only for known non-secret settings; and any log line that names a secret, in any spelling or encoding, is withheld whole with the lines that continue it, keeping its time and level. Serial numbers, error codes, firmware versions and whether a secret is set stay. Names, contents and notes never exceed max_bytes (default 4 MiB, at most 8 MiB); a missing file is a note. counterpart_printer_info advertises it as capabilities.diagnostics. Sends nothing to the printer; tested with mocked logs and no printer. src/counterpart/diagnostics.ts is shared verbatim with mcp-3D-printer-server. Refs DMontgomery40/scan-to-make#799.

Fixed

  • cad_run's purpose check fails a held body that sits inside the part (more than 1 mm³ and 0.5 mm deep, or more than half of the body) rather than on it, and a part in use() that has build()'s volume but not its shape (surface area and principal moments of inertia, within 2%).

Validation limits:

  • The purpose checks were validated against pinned build123d 0.13.0 geometry fixtures: the purpose suite 25/25 and the cookbook through cad_run. No physical print is claimed.
  • The redactor in counterpart_diagnostics fails closed. Configured secrets are removed as written, URL- and JSON-encoded, with HTML entities, and as base64 at any offset. Any log line that names a secret is withheld whole, and the marker names its auth reasons from a fixed list only.
  • The packed tarball was installed and driven over stdio with planted secrets. Each planted form had 0 hits in the returned bundle, and the HMS codes, firmware version and last tool error stayed readable.
  • Known residual: a secret this server never held, on a line that names no secret word, is caught only when it has a recognisable shape. The re-check's remaining next-variant notes are tracked in #165.
  • The Bambu network plug-in and native helper logs are not included in the bundle.
  • No printer was contacted during validation.

Code: @DMontgomery40 (#160, #161); prior contributors remain credited in CONTRIBUTORS.md.