3d62a95d82
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 KiB
37 KiB
SDK defects found while migrating the examples to notebooks
Each entry: symptom, trigger, root cause, status, fix direction. The example that surfaced it is in brackets.
1. Expression ids were random, so content_hash was not reproducible [flange_plate]
- Symptom: two fresh
sca run --no-cacheof the same notebook gave differentcontent_hashvalues. - Trigger: any notebook whose geometry takes a
scad.var(or anExpr). - Root cause:
Const/Var/Exprdefaultedexpr_idto auuid4; the ids land in the feature graph, so the definition bytes changed per process. - Status: fixed. A default id is now a digest of the node's content
(
params/expr.py,_structural_expr_id); testtest_default_expression_ids_derive_from_content. - Fix direction: done. Any id that ends up in a hashed artifact must be
derived from content, never from
uuid/id()/a counter.
2. A cached body encoded to other BRep bytes than the built one [flange_plate]
- Symptom: the second
sca run(all cellscached) gave anothercontent_hashthan the first and the--no-cacheruns; only the body blob differed, by three bytes. - Trigger: a shape with zeros that OCCT reads back as
-0.0, e.g. a radial pattern of 4 or 8 holes (a 90° rotation). - Root cause: BinTools reading is not byte-idempotent (
+0.0comes back-0.0). The cell cache pickles a shape as BinTools bytes, so a restored body writes different bytes than the body that was built. - Status: fixed.
artifacts/brep.write_brep_byteswrites the decoded shape, which is a fixed point; testtest_brep_bytes_are_a_fixed_point_of_decoding. Not every shape has one after a single round; see defect 10. - Fix direction: done. Hash the canonical form (the fixed point of decode→encode), never the first encoding of an in-memory object.
3. Overriding one variable of a multi-variable cell gave an opaque error [flange_plate]
- Symptom:
run_notebook(nb, overrides={"BOLT_PCD": ...})failed inside marimo withIncompleteRefsError, listing setup-cell names. - Trigger: a params cell that defines several variables, overriding only some of them.
- Root cause: an overridden cell does not run, so it cannot supply its other variables; the runtime did not check for this.
- Status: fixed.
runner._check_overridesraises aValueErrornaming the variables to override together. The guide and FTC convention now say to group parameters into cells by what is overridden together. - Fix direction: done.
4. radial_pattern_rsolidlist(count=...) does not accept a Var [flange_plate]
- Symptom: passing
BOLT_COUNT(ascad.var) ascountfails; the notebook writescount=int(float(BOLT_COUNT)). - Trigger: any pattern count kept as a parameter.
- Root cause: integer-valued operator parameters are typed
intand are not lifted to expressions, unlike lengths and angles. - Status: worked around (
int(float(...))); the expression link to the count is lost in the feature graph. - Fix direction: accept
Var/Exprfor integer parameters, checking the value is integral, and record the expression like the other parameters.
5. A later cell could not tag a shape made by an earlier cell [caplcd_enclosure]
- Symptom:
scad.apply_tag(shape=corner_rounds, ...)in the product cell failed with "assignment scope is not produced by the active GraphSession". - Trigger: any tag, selection or role operation on a shape that another notebook cell produced.
- Root cause: every cell records into a session of its own. Operator
inputs from earlier cells are adopted (
GraphSession.owned_node), but_active_graph_node_for_shape, which the tagging and selection paths use, only looked the node up and returnedNonefor a foreign one. - Status: fixed. The lookup adopts a node of the same graph when the
session shares lineage (
operators/_support.py); testtest_a_later_cell_tags_a_shape_from_an_earlier_one. - Fix direction: done. Every path that turns a shape into a graph node
must go through
owned_node, notgraph.get_node.
6. A cut with many tools recorded a run-dependent topology delta [caplcd_enclosure]
- Symptom:
sca run --no-cachegave anothercontent_hashon every run; only thetopo_deltaof multi-toolcut_rsolidnodes differed (extra or missing entries, other face ids). - Trigger:
cut_rsolid(body, [tool, tool, ...])where a later tool modifies faces an earlier tool made (overlapping or adjacent tools). The same loop is inintersect_rsolid. - Root cause: the cut runs one tool at a time and merges the step deltas. Step entries name faces by kernel hash, which comes from the shape's address. The intermediate results were freed while their entries were still pending, so an output face could reuse a freed face's address and a stale step entry resolved to it, depending on the heap.
- Status: fixed. Both loops keep every intermediate result alive until
the merged delta is recorded (
operators/boolean.py); testTestMultiToolCut.test_the_merged_delta_is_the_same_on_every_run. The flange plate's hash changed with it (its 8-hole cut had stale entries). - Fix direction: done for the boolean loops. Longer term, topology ids should not be addresses at all; any code that keeps a kernel hash as a string must keep the shape alive as long as the string is used.
7. The cell cache outlives an SDK change [caplcd_enclosure]
- Symptom: after fix 6, cached runs still returned the old
content_hash; only--no-cacheshowed the new one. - Trigger: changing or upgrading
simplecadapiwithout changing the notebook or its local modules. - Root cause: the cache key covers the notebook's code, its local modules and the notebook id, not the library that computes the values.
- Status: open. Workaround: delete
__marimo__/simplecad/(or run with--no-cache) after changing the SDK. - Fix direction: put the SDK version, and in a source checkout a digest
of the package sources, into
dependency_digest.
8. An assembly could not be built over several cells [external_reference_gear_train]
- Symptom:
ProductNotFoundError: several top-level values have the notebook idfor an assembly notebook with a components cell, a constraints cell and a solve cell. - Trigger: any assembly split into one cell per step, as the FTC "one block per cell" rule asks for.
- Root cause:
make_assembly_rassemblyfixes the assembly id, so every intermediate assembly has the notebook id, and the product rule demanded exactly one such value. (Parts do not hit this: their intermediates are solids.) - Status: fixed. Of several values with the notebook id, the ones another
cell reads are intermediates; the product is the one left
(
runtime/projection.find_product); testtest_an_assembly_built_over_several_cells_is_the_last_one. - Fix direction: done.
9. A non-primitive override can return another run's cached cells [u_link_motor_mount]
- Symptom:
run_notebook(nb, overrides={"P": Spec(a=5.0)})after a default run returned the default run's values;cache=Falsegave the right ones. - Trigger: overriding a variable with a value marimo cannot hash by
content: a dataclass instance, a
scad.var/Expr, any custom object. Numbers, strings and containers of them are safe. - Root cause: marimo keys a cell on the content of its primitive refs and on the code of the defining cell for every other ref. An overridden variable has no run of its defining cell, so the key is the one of the default value and the cache restores the default run's result.
- Status: open. Workaround: override only with numbers and strings (the examples look specs up in a plain module by a string key).
- Fix direction:
runner._runshould hash every override value itself (canonical bytes, or the pickle digest) into the cell-cache key, or turn the cache off for the cells downstream of a non-primitive override; at minimum reject such overrides with a clear error.
10. Decoding a BRep can cycle instead of reaching a fixed point [u_link_motor_mount]
- Symptom: the cached run of
u_link.pygave anothercontent_hashthan the fresh and--no-cacheruns, with fix 2 in place; only the body blob differed. - Trigger: chamfered or filleted bodies (here: chamfered triangular ribs). A few doubles move by an ulp on every BinTools read; the encodings settle only after two rounds, or alternate between two encodings forever.
- Root cause: fix 2 assumed one decode round reaches a fixed point. A restored body has been decoded once more than the built one, so on a shape whose orbit has a longer lead-in or a 2-cycle the two still wrote different bytes.
- Status: fixed.
write_brep_bytesdecodes until an encoding repeats and returns the smallest encoding of the cycle (bounded to 8 rounds); testtest_brep_bytes_settle_when_decoding_cycles. Content hashes of bodies that already settled after one round are unchanged. - Fix direction: done. Longer term, a canonical form that does not depend on reader round-trips (e.g. normalising doubles while writing) would be cheaper than iterating.
11. ql.and_ was typed to return a plain callable [u_link_motor_mount]
- Symptom:
ty checkrejectedql.faces().where(ql.and_(...)), the documented selector idiom:wheretakes aSerializablePredicate, andand_was annotated-> Predicate(Callable[[Any], bool]). - Trigger: any type-checked script that combines predicates with
and_/or_/not_beforeShapeSelector.where. - Root cause: the combinators return a
SerializablePredicatewhen every input is one, but the annotation only named the general case. - Status: fixed.
and_,or_andnot_carry overloads mapping serializable inputs to a serializable result (ql.py). - Fix direction: done.
12. Scripts must narrow run.product before using it [u_link_motor_mount]
- Symptom:
run_notebook(...).product.bodyand.product.component_ids()fail type checking:productisPart | Assembly. - Trigger: every export or verify script.
- Root cause:
NotebookRun.producthas the union type; the script knows which kind the notebook makes, the type does not. - Status: open. Workaround:
assert isinstance(run.product, scad.Part). - Fix direction: typed accessors on the run (
run.part,run.assembly) that raise a clear error on the other kind.
13. build_ball_bearing(fuse_rolling_elements=False) always failed [compact_two_stage_planetary_reducer]
- Symptom: the durable standard bearing with separate balls raised
definition_id_mismatch: expected '<id>_ball_00', got '<id>_ball'; past that,duplicate assembly id in active GraphSession. - Trigger: any
scad.std.bearing.build_ball_bearing(..., fuse_rolling_elements=False)call. Only the fused default was tested. - Root cause: the ball definition was named after the component
(
ball_00) instead of the part the factory makes (<id>_ball), and the assembly body called the factory again to read the ball layout, which added a second assembly with the same id to the build session. - Status: fixed (
std/bearing.py): the ball definition id is the factory's part id, and the layout is computed with the factory's own helpers. Testtest_durable_bearing_keeps_separate_balls. - Fix direction: done.
14. build_ball_bearing(material=...) rejected a material made in a notebook cell [integrated_bldc_joint_actuator]
- Symptom:
assign_material_rpartfailed withvalue contains graph node '...' from graph 'integrated_50mm_bldc_joint_actuator', active graph is 'rear_motor_8x16x5_outer_ring'. - Trigger: an assembly notebook cell that makes a material and passes it
to
scad.std.bearing.build_ball_bearing(material=...). More generally: any material recorded in aGraphSession. Planetary passes no material, and the old module code made its material outside any session, so neither case hit it. - Root cause: the factory builds each ring in its own build graph, but the material still carried the caller's graph node, and graph ownership checks reject foreign lineage.
- Status: fixed (
std/bearing.py): the factory passes the material by value, as a copy without lineage. Testtest_durable_bearing_accepts_material_recorded_in_caller_graph. - Fix direction: in general, any standard-library factory that opens its
own build graph must take plain semantic inputs (materials, specs) by
value. A shared helper in
stdwould keep the next factory from repeating this.
15. Shape transforms and apply_tag lose the shape kind in their types [planetary, integrated_bldc_joint_actuator]
- Symptom:
ty checkon the example modules reportsexpected Solid, found Vertex | Edge | Wire | ...wherever a helper returns, or passes tounion_rsolid/cut_rsolid, the result ofrotate_shape,translate_shape,mirror_shapeorapply_tag. - Trigger: any typed helper
-> scad.Solidthat rotates or tags a solid. The code is correct at runtime; only the static types are wrong. - Root cause: these functions are annotated
(shape: AnyShape, ...) -> AnyShape, so the caller'sSolidwidens to the whole shape union. - Status: open (not blocking: examples are not type-check gated).
- Fix direction: a
TypeVarbound toAnyShape(def rotate_shape(shape: S, ...) -> S), so the kind passes through.
16. BRep decode orbits can be longer than the settle bound, or never settle [l_link_motor_mount]
- Symptom:
sca run l_link.pyfailed at projection withbrep_invalid at /body: BRep encoding did not settle within 8 decode rounds. With the bound raised, thecenter4adapter plate still failed at 32 rounds. - Trigger: the chamfered cross ribs on the swept L rod need 9 decode
rounds before they enter their 2-cycle (earlier stages settle in 1–2
rounds). The
center4plate (filleted disk plus the star key) never settles: three near-zero doubles (~1e-16, ~1e-32) keep drifting, still after 200 rounds. The old pre-notebook chains give the same orbits, so this is the geometry, not the conversion. - Root cause: fix 10 assumed every orbit reaches a cycle, and bounded the search at 8 rounds on the assumption that it does so within two. A restored shape only encodes like the built one if both orbits reach the same cycle.
- Status: fixed. A wrapper decoded from bytes (cell-cache pickle in
_internal/shape_pickle.py, package blob inread_brep_solid) remembers them, andwrite_brep_bytesstarts the orbit there, so a restored shape walks the built shape's orbit. A shape that does not settle within 32 rounds is written as its first encoding. Re-pickling a restored shape stores the remembered bytes. Testtest_brep_bytes_agree_when_decoding_never_settles. Hashes of shapes that settled before are unchanged. - Fix direction: the same as for 10: a canonical encoding that does not depend on reader round trips would remove the iteration entirely. A cell that re-runs on a restored input (a changed override downstream of cached cells) still computes from the decoded shape, which can differ by an ulp from the built one.
17. A cell with branch-local temporaries is silently not cached [l_link_motor_mount]
- Symptom: a run logged
Cache save failed for <cell>: ... Cache expected a reference to a variable that is not present (_cell_<id>_relief)and went on; the cell re-ran on every run. - Trigger: a cell that binds a
_-prefixed temporary in only one branch of anif(here_reliefonly for thestar3preset), run with the other branch taken. - Root cause: marimo's persistent cell cache collects the cell's local names statically and expects every one of them when it saves; the runtime passes the warning through.
- Status: worked around in the example: the branch-only tools moved to
@app.functionhelpers, so the cell binds the same names on every path. - Fix direction: have the runtime report a cell that could not be cached (in the run report and the CLI), and teach the rule in the FTC skill: a cell binds the same names on every path.
18. sca run --no-cache cannot run from a read-only notebook directory [flange_plate]
- Symptom:
sca run flange_plate.py --no-cachein a read-only copy of the example fails withPermissionError: ... __marimo__/simplecad/flange_plate.py/flange-plate/deps.json(exit 2). With a read-onlyHOMEand a writable notebook directory the run succeeds; marimo and matplotlib only warn and fall back. - Trigger: any run (
cache=Falseincluded) where the notebook directory is not writable: a mounted read-only checkout, an installed package, a sandbox. - Root cause:
runtime/runner.py_runcallswrite_dependencies(config, ...)unconditionally;cache=Falseskips only the cell cache, not the dependency record understate_dir(config). - Status: not fixed (found while answering a runtime question; not blocking).
- Fix direction: with
cache=False, skip writingdeps.json(nothing reads it without the cache), or treat a failed state write as a warning; optionally let the state directory be relocated (e.g. an env var or a--state-dir).
19. The executor raised on any cell that is not in the notebook [editor]
- Symptom: in the editor kernel, every scratch snippet (the bridge's
execute) failed withKeyError: '__scratch__'. - Trigger: a notebook with
[tool.simplecadapi]running under marimo's editor, then any cell marimo runs that the notebook does not contain. - Root cause:
SimpleCadExecutorlooked the cell's key up in the notebook cells without checking that the cell belongs to the notebook. - Status: fixed.
NotebookCells.__contains__; the executor delegates such cells to marimo's default executor. Test:test_scratch_cells_are_not_recorded. - Fix direction: done. The headless runner only ever runs notebook cells, so only the editor kernel could hit it; test in a kernel, not only headlessly.
20. ql.vertices() found nothing on a solid or a face [editor]
- Symptom:
scad.ql.vertices().resolve(solid)returned no vertices, so a selector for a picked vertex raised "expected exactly 1 vertex(s), got 0". - Trigger: resolving
ql.vertices()against a Solid, Face or Wire; only an Edge scope worked. - Root cause:
_resolve_scope_itemslooked only at the scope's direct children for vertices, and a solid's children are shells. - Status: fixed. It falls back to the vertices of the scope's edges
(
_boundary_items); testtest_vertices_resolve_through_a_solid_and_a_face. - Fix direction: done. Every
qlfactory should resolve against any scope that contains its kind; check each (kind, scope) pair when adding a factory.
21. Surface points and sketch positions cannot be expressions; the cylinder's U is radians [types-surface-sketch]
- Symptom:
make_bezier_surface_rface,fit_point_grid_rfaceand thepointsofmake_surface_patch_rfacerefuse ascad.varcoordinate, and so do the(x, y)positions oftrim_rsketch/add_bspline_rsketchcontrol points; the origin ofmake_cylindrical_surface_rfaceandadd_point_rsketchaccept one.make_cylindrical_surface_rfacetakesu_rangein raw radians, where every other angle of the SDK (Angle) is degrees. - Trigger: typing the surface and sketch signatures (
simplecadapi.types.Point3/Point2): the same meaning has two loaders,scad::Vec3(doubles) andstd::array<Scalar, 3>(expressions). - Root cause:
PointGrid/SurfacePatchOptions::pointsareVec3, andSketchPosition/SketchControlPointhold doubles; the cylinder range is passed to OCCT unconverted. - Status: open. The signatures now say what each parameter means; the loaders are unchanged (no behaviour change).
- Fix direction: make the surface grids
std::vector<std::vector<ScalarVec3>>(evaluate at build time, as the cylinder does) and let sketch positions takeScalar; give the cylinder a degreeAnglerange (keepu_rangeas a deprecated alias).
22. phase_offset of the gear, belt and rack-pinion constraints is a length, and nothing said so [catalog]
- Symptom: next to
drive_angle_degrees,phase_offsetreads like an angle; a GUI or agent would pass degrees. - Trigger:
add_gear_constraint_rassembly(..., phase_offset=...)(also belt, rack_pinion). - Root cause: the coupling phase is
r_a * theta_a + r_b * theta_b(coupling.cpp: phase_from_supports), an arc length on the pitch circle in mm; the binding tookpy::objectand the docstring did not say. - Status: the signature now says
phase_offset: Length | None. - Fix direction: say "pitch-circle arc length (mm)" in the docstrings too;
consider renaming to
phase_offset_lengthin a major version.
23. The std bindings are registered before the product classes [catalog]
- Symptom:
simplecadapi._cpp.std.bearing.make_ball_bearing_rassemblyprints its return type asscad::product::Assembly(the C++ name); aMaterialargument cannot take its name from the registered class. - Trigger:
bind_std(m)runs beforebind_product(m)inmodule.cpp; pybind writes the signature when the function is defined. Likewisebind_semanticruns beforebind_ql, soapply_tag_rselectionspells outShapeSelector. - Root cause: registration order.
- Status: open; the names are written out where needed. The C++
std.bearing.make_ball_bearing_rassemblyis also shadowed by the Python one insimplecadapi.std.bearing(two implementations of one operation). - Fix direction: bind the value classes (product, ql) before any operation that uses them; drop one of the two bearing factories.
24. catalog.classify read a union that starts with Literal[ as one Literal [catalog]
- Symptom:
Literal['auto', ...] | tuple[Angle, Angle]gave the choices"rear_left'] | tuple[Angle"and'Angle'. - Root cause: the
Literal[...]/Sequence[...]/Annotated[...]regexes werefullmatched on the whole union text. - Status: fixed. Unions are split first; a union of bracketed members is
the members' kinds joined (
enum|numbers,query|shape,solidmany forSolid | Sequence[Solid]). Also new:path,scalar_limit,<kind>_mapfordict[str, X], and str-enum defaults (<E.X: 'x'>->'x'). - Fix direction: done.
25. Style and view strings are case-insensitive, the signatures list one spelling [catalog]
- Symptom:
make_bolt_rsolid(head_style="HEX"),render_screenshot_rpath(view="Top")work, yet the signature saysLiteral['hex', ...]/Literal['top', ...]. - Root cause:
stdlib::choiceandview_presetlower-case the value before matching. - Status: open by choice: the Literal lists the canonical spellings (what a form offers); the runtime still
accepts any case.
apply_tag_rselection's enums are case-sensitive. - Fix direction: pick one rule for every string enum of the SDK.
26. Angle units and expression support are not uniform across operations [types]
- Symptom:
make_angle_arc_redge/_rwiretakestart_angleandend_anglein radians, while every other angle (revolve_rsolid,rotate_shape,chamfer_rsolid(angle=),draft_rsolid, patterns, sweeps) is in degrees.chamfer_rsolid(angle=)andoffset_rsolid(tolerance=),union_rsolid(tol=)take a plain float: ascad.varis read as its current value. - Trigger: passing
90(meant as degrees) to an angle arc gives a different arc; ascad.vargiven as a chamfer angle is recorded as its value, not as the expression. - Root cause: the arc follows OCC's
GC_MakeArcOfCircleparameter directly;ChamferOptions::angleisstd::optional<double>. - Status: open. The signatures now say it: the arc angles are a plain
number (not
Angle) and the docstring says radians; the chamfer angle printsAnglebut is loaded as a float. - Fix direction: a breaking change for the arc (degrees, with a
deprecation path), and
Scalarfor the chamfer angle so it records an expression like the other parameters.
27. Compound([solids]) silently drops the solids' tags [multi-solid research]
- Symptom:
scad.Compound([a, b])of two tagged boxes has no face tags;compound._copy_semantic_state_from(a)copies nothing either. - Trigger: any code that bundles solids into a Compound and later selects by tag (the first multi-body spike stored a part's bodies as one Compound).
- Root cause: a Compound is a new shape root with its own entity registry; the semantic state of the input roots is not carried over, and the copy helper only works within one root.
- Status: open. Multi-body parts keep their bodies as separate Solid roots
(
Part.bodies), so they are not affected;product.bodies.part_shapedocuments that its Compound is a geometry view without tags. - Fix direction: either carry tags into a Compound built from tagged
roots (sub-shapes are shared, so the mapping is exact), or refuse
_copy_semantic_state_fromacross roots instead of doing nothing.
28. Value pickling reads constructor arguments back by attribute name [multi-solid research]
- Symptom: adding
Part(bodies=...)broke pickling of multi-body parts: the reducer calledpart.body, which (rightly) raises for several bodies. - Trigger: any product value whose constructor parameter is not a plain readable attribute of the same name.
- Root cause:
_glue/values.pyparses the parameter names out of the pybind11__init__docstring and reads each back withgetattr. - Status: worked around:
_ARGUMENTSmaps a class to per-parameter readers (Part:body/bodies). - Fix direction: give the C++ values an explicit
__getstate__/py::pickle(asqlselectors have) instead of docstring parsing.
29. "One solid per definition" is spelled into ids and kinds [multi-solid research]
- Symptom: a second body of a part has nowhere to live in the existing
names: entity ids are
entity/<definition>/<kind>/<topo>with root-local topo ids (every body has aface_0), preview nodes are one per part, and the definition kind is calledsingle_solid(about 20 places in Python). - Trigger: any part with more than one solid.
- Root cause: "is a part" and "has one solid" were the same fact until now.
- Status: worked around: bodies get an id segment
body:<body_id>(entity/<part>/body:<id>/...,node/<part>/body:<id>), one-body parts keep their old ids byte for byte; the kind stayssingle_solid. - Fix direction: treat
single_solidas the name of the part kind (rename at the next package schema bump) and keep thebody:segment the only way to address a body.
30. Error guidance is frozen by parity goldens [multi-solid research]
- Symptom: the
make_part_rpartguidance still says "Union intended multiple bodies into one Solid before creating the Part.", which is wrong now thatbodies=exists; changing it failssrc/cpp/tests/python/test_product_values.py::test_part_creation_and_errors. - Root cause: the C++ port compares every error's
what_happened/possible_causes/how_to_fixwith goldens captured from the old Python SDK (tests/golden/product_*.json), so guidance cannot follow the API. - Status: open; the old text is kept.
- Fix direction: compare error codes and kinds against the goldens, and let guidance text change with the API (or regenerate the goldens on a deliberate API change).
31. Face tags died at the next operation, op-kwarg ones at blends and copies [stable-refs research]
- Symptom: a plain
apply_tag_rselectionface tag was gone after any later operation; an op-kwarg face tag (top_face_tag=) survived booleans but not fillet, chamfer, translate, mirror or patterns, although those nodes record a witness for every face. - Root cause: tags were copied forward per operation (
autotag.cpp) through channel-specific gates (the face-source gate, the face channel of blends), and the effective scope excluded lineage. - Status: fixed. Tags are a view over the recorded history (
scad/reactive/tag_view.hpp): a recorded tag assignment reaches every entity its targets became, per lineage policy, and effective includes lineage. Audit:test_element_ref_history.py::test_audit_tag_channels_and_history_per_family(every family 1/1).
32. OperationGraph::from_value header said deltas are not restored; they are [stable-refs research]
- Symptom:
include/scad/reactive/graph.hppcommented "topology/semantic deltas are not restored" whilegraph.cppfrom_valueparsestopo_deltaandsemantic_delta. - Status: fixed (comment), and pinned:
test_tags_and_references_resolve_on_values_restored_from_the_cell_cacherestores a cell's lineage record in a fresh process and resolves a tag and a reference through its deltas.
33. A shell's kept faces had no successor witness [stable-refs research]
- Symptom: after
shell_rsolid(box, [bottom], t), the untouched top face had only ageneratedwitness (its offset face); history could not say the top face was still there, andbody_faces_tagalways raised. - Root cause:
tracking::query_historyemittedpreservedonly when an input had neitherModifiednorGeneratedimages; a kept shell face generates its offset face. - Status: fixed (owner decision, option a):
preservedis also emitted when the input is still in the result. Goldens and assertions reviewed one by one (design 7.2): shell kept faces and rim edges, and the profile edges that bound an extrude / loft start cap, gain a preserved witness.
34. transform_rsolid, offset_rsolid, draft and scale recorded no topology delta [stable-refs research]
- Symptom: a face reference or tag through these ops could not be followed (
lost(no_history)in the resolver). - Root cause: they finish through
finish_solid, which recorded no delta, although the OCCT makers behind them (BRepBuilderAPI_Transform/GTransformafter aCopy,BRepOffsetAPI_MakeThickSolid,BRepOffsetAPI_DraftAngle) exposeModified/Generated. - Status: fixed.
modification_delta(src/semantic/tracking_modify.cpp) turns the retained OCCT history into face and edge witnesses (copy and transform merged into one history; an offset or drafted face, which OCCT reports as generated, continues its source);finish_solidrecords it. Tests:test_modification_delta.cpp,test_element_ref_history.py::test_history_through_operations_that_had_noneand the draft test. The helical sweep was never a gap: inside a session it records its helix, face and sweep nodes, and the sweep is tracked (test_a_helical_sweep_cap_is_anchored_by_the_sweep_it_records).
35. Two spellings of one topo id [stable-refs research]
- Symptom: a recorded delta names a face
face_face_5; the entity's owntopo_idisface_5;get_metadata( "topo_ref")re-prefixes on the fly (bind_topo.cpp) andindex_output_entitiesbuilds the long form. - Root cause: the Python SDK's text form was kept for parity.
- Status: open, harmless but every consumer must know which form it holds (
subshapes_by_recorded_idtakes the recorded form). - Fix direction: one canonical form at the next graph schema version.
36. A reference into a face, shell or edge body could not resolve [nurbs editing]
- Symptom:
element_ref.resolve(anchor, face)on a bare Face (a surface body, not a solid) raisedTypeError: cannot resolve QL selector scope for target_kind=solid. - Root cause:
_bodies_of(topology/element_ref.py) askedql.solids()of every non-Solid shape to find the body of each resolved entity; a Face or Shell has no solid scope at all. - Status: fixed: only a Solid or a Compound is searched for bodies; the entities of a Face / Shell / Wire / Edge
report body
None. Test:test_surface_editing.py::test_tags_and_references_follow_a_face_and_its_edges_through_edits.
37. Curve / surface edits existed only as unrecorded in-place mutation [nurbs editing]
- Symptom: a control-point edit had to go through
simplecadapi._cpp.occt(Geom_BSplineSurface.SetPole...) on the handle the shape shares, mutating it in place: not recorded, not replayable, and every other shape sharing that geometry changed with it (design-docs/nurbs-editing-capability.md). - Status: fixed for the core edits:
set/move_*_poles,set_*_weights,insert_*_knot,elevate_*_degree,convert_to_bspline_*,rebuild_*are recorded operations returning a new shape on an edited copy of the geometry (src/cpp/src/surface/editing). The private OCCT setters are still reachable and still mutate shared geometry; they should be hidden from the compat layer once nothing internal uses them. - Open: a face that is part of a shell or solid is edited alone (the result is a free face); propagating an edit to the neighbouring faces of a body (keeping the shell closed) needs a whole-body rebuild op.
38. A colour's colour space was never written down [body appearance]
- Symptom:
Material.color=(0.9, 0.2, 0.1)came out of STEP asCOLOUR_RGB(0.955, 0.485, 0.349), and the old editor ignored material colours (a fixed tint permaterial_id). - Root cause: the STEP writer hands the numbers to OCCT as
Quantity_TOC_RGB(linear RGB), which STEP stores as sRGB; nothing said which space the SDK means, and the reader (import_step) gives linear values back, so a round trip is consistent while a person who typed sRGB numbers sees a lighter colour. - Status: documented, not changed: an SDK colour (
simplecadapi.types.Color,Material.color, a body colour) is linear RGB in [0, 1], as OCCT and three.js (its working space) read it. The editor's picker converts its sRGB#rrggbb. Changing to sRGB would move every existing STEP colour. - Fix direction: if sRGB is wanted (what people type), switch the writer and reader to
Quantity_TOC_sRGBtogether and say so in the type.
39. apply_tag_rselection returned an untyped object [body appearance]
- Symptom: the only operation in
sca opswhose result kind wasobject; the editor could not tell what the "name a face" form makes. - Status: fixed: the binding names the result
AnyShape.
40. The generic op form dropped picked selections [body appearance]
- Symptom:
op.fillet_rsolid(and everyop.*with aselectslot) wrote the call without its edges/faces. - Root cause: the builder skipped every slot without a value; a selection is picked, not a value.
- Status: fixed (
editor/op_specs.py);test_a_picked_selection_is_passed_to_the_operationcovers every such op.
41. Person-facing face names and package names are two tiers of one tag system [body appearance]
- Symptom: a face named
lid_seatin the editor is kept on its entity in the package, but onlyinterface.*tags enter the package's publicname_index. - Status: by design (no second naming system); the skill says to name a face other tools read
interface.<name>. - Fix direction: if people need public names without the prefix, a
public=Trueon the tag op rather than a new naming scheme.
42. A one-body Part pickles its default body as a bare Solid [body appearance]
- Symptom: a one-body Part whose body has a name or colour lost them through pickle (the cell cache).
- Root cause:
_glue/values.pyrebuilt a one-body Part fromPart.body(the Solid), not itsBody. - Status: fixed: such a Part is rebuilt from
bodies; a plain one-body Part keeps the old reduction (same bytes).
Heuristics
- Run every notebook three times: fresh, all cached,
--no-cache. The threecontent_hashvalues must be equal; any difference is a determinism bug. Diff the definition blobs to find which artifact moved. - When a value is cached by serializing it, check that
encode(decode(encode(x))) == encode(x); floats (signed zeros, NaN payloads, printed precision, ulp drift) are the usual culprits. Iterate a few rounds: an orbit can need more than one round, or cycle (defect 10). - Grep for
uuid,id(,time, and module-level counters on any path that feeds a hashed artifact. - When a parameter cannot be passed as a
scad.var, the operator is missing expression lifting for that parameter type; note the cast as a defect. - Run a notebook twice in one process with
cache=False: heap-dependent identities (addresses,hash()of kernel shapes) show up as different hashes there, where separate fresh processes may happen to agree. - Override with a non-primitive value once with and once without the cache: a different result is a cache-key hole (defect 9).
- After changing the SDK, clear the notebook state before comparing hashes (defect 7).
- Use values from one cell in another cell's tags, selections and connectors, not only in operators: those paths look up graph nodes too.