Regenerate class diagrams from source and fix contribution guides - #812
Open
daniel-locatelli wants to merge 10 commits into
Open
Regenerate class diagrams from source and fix contribution guides#812daniel-locatelli wants to merge 10 commits into
daniel-locatelli wants to merge 10 commits into
Conversation
Switch the mermaid superfence formatter from mermaid2's non-escaping fence_mermaid_custom to pymdownx.superfences.fence_code_format. The non-escaping variant let the browser parse class-diagram stereotypes like <<abstract>> as HTML tags, rendering them as empty <> on the published site. mermaid.js reads the element's text content, so escaped entities arrive intact. Also enable the panzoom plugin for zoomable diagrams (mirrors the pending fix/zoomable-mermaid-diagrams PR; the plugin dependency is installed in the build environment). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deterministic extract -> curate -> render -> validate pipeline behind docs/contribution/class_diagrams.md: extract_classes.py parses the package with ast into graph.json; diagram_spec.py holds the curated partitioning, prose and edges (composition edges are asserted against the extracted attributes); gen_diagrams.py renders the doc; validate_mermaid.py lints the mermaid blocks; compare_doc_to_graph.py diffs any diagrams doc against the extracted graph to catch hallucinated classes, edges or members. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the hand-maintained diagrams with output generated by scripts/docs_class_diagrams: an ast-based extractor produces a class graph (bases, attributes with @Property getters folded in, method signatures), and a generator renders it into subsystem-partitioned mermaid blocks, so inheritance and members can no longer be invented or drift. Changes to the diagrams doc: - Split the Connections subsystem into three diagrams (topology solving, beam joints, plate/panel joints) and add the previously undocumented solver machinery (JointTopology, ConnectionSolver, PlateConnectionSolver, solver results, Cluster). - Split Fabrication into infrastructure and processings diagrams and add the parameter enums (OrientationType, StepShapeType, etc.), MachiningLimits, and a note on the *Proxy companion classes. - Add Planning (nesting + assembly sequencing) and Structural subsystem sections, which were entirely undocumented. - Correct members that didn't exist as public API (butt_plane_spec / back_plane_spec are constructor params stored privately; BTLxWriter private _create_* methods; PanelFeature.name/transformation) and suppress members redeclared from in-package bases. Changes to the joints guide: - Document all nine JointTopology values (TOPO_Y, TOPO_K, TOPO_EDGE_EDGE, TOPO_EDGE_FACE, TOPO_UNKNOWN were missing). - Fix the check_elements_compatibility example: it is a classmethod receiving (elements, raise_error), not an instance method. - Cross-link the class diagrams page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The example omitted the remove-first step every shipped joint performs (ButtJoint, LMiterJoint): process_joinery() may run repeatedly on the same model (e.g. Grasshopper recompute), and without removing the joint's previously registered features first, each run applies them again. Also reassign self.features instead of extending, and expand the note: element registration applies the feature, joint registration is the undo record; blank extensions need no equivalent because they are keyed by joint guid on the element. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The retroactive fix for 2.2.0 only corrects the diagrams that already existed (Timber Element, Connections, Fabrication, Errors), restoring the original one-diagram-per-subsystem layout. The Model Overview, Planning and Structural diagrams and the Connections/Fabrication sub-diagram splits move to docs/class-diagrams-additions for the next release. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The title was accurate when the diagrams were authored (v1.0.x, where every element inherited from TimberElement) but became misleading in the 2.0 refactor, when Fastener and Panel were rebased directly onto compas_model Element. The section documents the whole compas_timber.elements package, so name it accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop the Data anchor and the legacy Feature classes (CutFeature, DrillFeature, MillVolume, BrepSubtraction) from the Elements diagram: they are neither Element subclasses nor connected to one, and the legacy features are unused internally. They remain exported and are now mentioned in prose only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Data carried no information in the Connections diagram (every class derives from it) and little in Fabrication; the prose now states the convention and its exceptions instead. Orphan blocks (MachiningLimits, the constants classes, BTLxFromGeometryDefinition) got usage edges verified against the source, and the Connections/Fabrication intros are split into short paragraphs. The page header now links to the regeneration pipeline in scripts/docs_class_diagrams/. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
daniel-locatelli
force-pushed
the
class-diagrams-2.2.0
branch
from
July 27, 2026 12:38
0c2aa07 to
7e559e7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #812 +/- ##
==========================================
- Coverage 82.67% 82.64% -0.04%
==========================================
Files 83 83
Lines 12005 12005
==========================================
- Hits 9925 9921 -4
- Misses 2080 2084 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
chenkasirer
reviewed
Jul 31, 2026
Contributor
There was a problem hiding this comment.
mmh dunno if this suite of scripts should end up as part of compas timber. if it can be generalized, perhaps it's worth packaging this as some kind of a developer tool. otherwise, I would just remove it from here.
Contributor
Author
There was a problem hiding this comment.
Agree, I removed the scripts and have them here. I've been thinking about how to keep the diagrams from drifting long-term. Ideally they would be generated as part of the docs CI. If you think that makes sense I can write it as an issue.
…BTLx standard, remove diagram pipeline from repo - CutPlaneSpec/MiterPlaneSpec removed from the Connections diagram and prose (mechanism contested in #803); LMiterJoint's miter_plane attribute keeps its extracted type. - Fabrication intro links the BTLx standard specification. - The generation pipeline moves out of the repo to https://github.com/daniel-locatelli/compas_timber-class-diagrams; the page header no longer points at in-repo scripts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…its, union mkdocs.yml changes # Conflicts: # docs/contribution/class_diagrams.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the four pre-existing class diagrams (Elements, Connections, Fabrication, Errors) so they match the actual v2.2.0 code, and makes them reproducible:
src/with Python'sast(ground truth), while subsystem partitioning, prose and cross-class edges are curated indiagram_spec.py. Curated composition edges are asserted against the extracted attributes so they fail loudly when the code changes; see that repo's README for usage.docs/contribution/class_diagrams.mdfrom that pipeline; the page header now states it is generated and must not be edited by hand.Database-class nodes (they carried no discriminating information — the prose states the convention and its exceptions instead).OrientationType,StepShapeType,TenonShapeType,AlignmentType,EdgePositionType,LimitationTopType) andMachiningLimitsas explicit blocks with source-verified usage edges — previously the constants classes appeared in the diagrams only as attribute types, andMachiningLimitsnot at all.BTLxFromGeometryDefinitiongains aninstantiatesedge toBTLxProcessingin place of the droppedDatalink.CutPlaneSpec/MiterPlaneSpecare left out of the Connections diagram while that mechanism is reworked in Add BTLxUserReferencePlanesupport, removeCutPlaneSpec/MiterPlaneSpec#803, and the Fabrication intro links the BTLx standard specification.mkdocs.yml: the superfence formatter is switched from mermaid2's non-escapingfence_mermaid_customtopymdownx.superfences.fence_code_format, because the non-escaping variant let the browser parse class-diagram stereotypes like<<abstract>>as HTML tags and render them as empty<>. (The panzoom enablement originally bundled here landed separately via Make mermaid class diagrams zoomable in docs #788; this branch has been rebased onto main accordingly.)Jointbase-class API: corrects theJointTopologyvalues (the old page misdescribedTOPO-X/TOPO-Iand was missingTOPO_Y,TOPO_Kand the plate topologies), replaces the outdatedelements/restore_beams_from_keys()requirements with the automatic GUID restoration and the_set_unset_attributes()hook, documentscheck_elements_compatibility()as a classmethod, and makes theadd_featuresexample idempotent on re-run. This API is unchanged on current main, so the guide stays correct after the merge; the one thing to revisit for the next release is the example's manual remove-features-first step, which post-2.2.0 code supersedes with the newJoint.clear_features().Docs-only change, no CHANGELOG entry ("no changelog" label).
Heads-up: post-2.2.0 hand-edits to the diagrams are superseded
mainreceived hand-edits toclass_diagrams.mddocumenting post-2.2.0 additions (e.g.CompositeJointfrom the composite-joint work). This PR replaces the page with the generated 2.2.0 snapshot, so those entries are intentionally not included — the diagrams document the released version, and new classes will re-enter the diagrams when they are regenerated for the next release (the compare script in the pipeline repo reports any unplaced classes). Going forward the page should not be edited by hand; the header now says so.Note for maintainers: updating the published 2.2.0 docs
The docs workflow only deploys the mkdocs site on version tags, so merging this PR does not update the live site by itself — the fixes would first appear with the next release tag. If we want the published "2.2.0 (latest)" docs to show the corrected diagrams before then, someone with push rights needs to run, from the merged
main:This rewrites only the 2.2.0 folder on
gh-pages(no git tag is created or moved).🤖 Generated with Claude Code