Repository navigation
refactor(synthesis): publish crank_angle_limits - #47
Merged
Merged
Conversation
_compute_crank_limits lived in synthesis.conversion as a private helper, yet nothing in pylinkage called it. Its only caller was the editor's backend in api/, reaching across the underscore. That backend is about to move into its own repository with pylinkage as a dependency, and a dependency should have no private names to lean on. The function is a four-bar classification helper: given the four link lengths, it returns the angular range of a crank that cannot rotate fully, or None when it can. That places it beside grashof_check and is_crank_rocker in synthesis.utils, with their parameter names, exported from pylinkage.synthesis as crank_angle_limits. The old test only asserted "None or a tuple". The new one checks the bounds against the law-of-cosines angles at the collinear positions, checks that positions inside the range let the coupler-rocker dyad assemble, and covers the case where the margin swallows the range. No deprecation shim: the name was private.
This was referenced Sep 12, 2026
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
synthesis.conversion._compute_crank_limitsbecomes the publicpylinkage.synthesis.crank_angle_limits(crank, coupler, rocker, ground).Nothing in pylinkage called the private helper. Its only caller was the editor's backend in
api/, reaching across the underscore. That backend is about to move into pylinkage-editor with pylinkage as a dependency (context in #46), and a dependency should have no private names to lean on.What changes
synthesis/utils.pybesidegrashof_checkandis_crank_rocker, with their parameter names. Same logic; the docstring now states the angle convention (measured from the ground line, positive branch) and the 0.02 rad margin, with a doctest.pylinkage.synthesis.api/services/synthesis_service.pyimports the public name. That was its last private pylinkage import.TestCrankAngleLimitsnow checks the bounds against the law-of-cosines angles at the collinear positions, that positions inside the range let the coupler-rocker dyad assemble, and the case where the margin swallows the range.No deprecation shim: the name was private.
Verification
tests/synthesis/: 243 passed.ruff,mypyclean.api/still imports under--extra api.