Skip to content

refactor(planning): remove dead branches in layer_strategies - #110

Merged
CameronBrooks11 merged 1 commit into
mainfrom
refactor/planning-remove-dead-code
Jun 24, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
refactor/planning-remove-dead-code

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

Two dead-code removals in fiberpath/planning/layer_strategies.py, no behavior change.

  1. build_layer_summary — the if isinstance(layer, HelicalLayer): return base / return base returned the identical string in both branches. Collapsed to a single return.
  2. plan_helical_layer — removed the num_circuits % pattern_number != 0 warn-and-silently-return block.

Why

The divisibility guard is unreachable on every production path. plan_wind calls validate_helical_layer() unconditionally before dispatch_layer() for helical layers, and that validator raises LayerValidationError on the exact same predicate (validators.py:81) — strictly dominating the silent-skip guard. The only two direct callers of plan_helical_layer are 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_summary conditional was a pure no-op.

How / verification

  • LOGGER / import logging retained — still used by LOGGER.debug(...) above the removed block.
  • ruff check, ruff format --check, mypy fiberpath (strict): all clean.
  • Full pytest: 111 passed, zero fixture regeneration, no test changes needed.

Closes #105

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
@CameronBrooks11 CameronBrooks11 added the python Pull requests that update Python code label Jun 24, 2026
@CameronBrooks11
CameronBrooks11 merged commit ade38f5 into main Jun 24, 2026
24 checks passed
@CameronBrooks11
CameronBrooks11 deleted the refactor/planning-remove-dead-code branch June 24, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dead/unreachable code in layer_strategies.py

1 participant