Repository navigation
refactor(planning): remove dead branches in layer_strategies - #110
Merged
Merged
Conversation
Two dead-code removals in layer_strategies.py (no behavior change): - build_layer_summary: the `if isinstance(layer, HelicalLayer)` returned the identical string in both branches; collapse to a single return. - plan_helical_layer: drop the `num_circuits % pattern_number` warn-and-return guard. It is unreachable on every production path — plan_wind always calls validate_helical_layer() before dispatch, which raises LayerValidationError on that exact predicate. The two direct test callers pass divisible inputs. LOGGER is retained (still used by LOGGER.debug above the removed block). Closes #105
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.
What
Two dead-code removals in
fiberpath/planning/layer_strategies.py, no behavior change.build_layer_summary— theif isinstance(layer, HelicalLayer): return base/return basereturned the identical string in both branches. Collapsed to a single return.plan_helical_layer— removed thenum_circuits % pattern_number != 0warn-and-silently-returnblock.Why
The divisibility guard is unreachable on every production path.
plan_windcallsvalidate_helical_layer()unconditionally beforedispatch_layer()for helical layers, and that validator raisesLayerValidationErroron the exact same predicate (validators.py:81) — strictly dominating the silent-skip guard. The only two direct callers ofplan_helical_layerare tests, both passing divisible inputs (proven by their full-fixture G-code match). No test exercises the silent-skip path; every divisibility test asserts the upstream raise.The
build_layer_summaryconditional was a pure no-op.How / verification
LOGGER/import loggingretained — still used byLOGGER.debug(...)above the removed block.ruff check,ruff format --check,mypy fiberpath(strict): all clean.pytest: 111 passed, zero fixture regeneration, no test changes needed.Closes #105