Skip to content

feat: make use_parallel_embedding reachable instead of deleting the code behind it - #134

Merged
isayev merged 1 commit into
mainfrom
phase19/parallel-embedding-option
Aug 3, 2026
Merged

feat: make use_parallel_embedding reachable instead of deleting the code behind it#134
isayev merged 1 commit into
mainfrom
phase19/parallel-embedding-option

Conversation

@isayev

@isayev isayev commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Resolves the decision left open by #132/#133: connect the feature rather than delete it.

The gap

Parallel conformer embedding existed as a constructor argument on the isomer engine with no route from Auto3DOptions. No main() or smiles2mols run could turn it on, so isomers/parallel_embed.py was reachable only from tests — which is why audit M53 listed it as ~138 lines of dead code. The factory already accepted all three parameters; only the config layer and the two call sites were missing.

Three fields, not one

Wiring only the boolean would have half-plumbed it. isomer_engine.py gates on use_parallel_embedding and len(smi_name_tuples) >= parallel_embedding_threshold, so the other two are read by the same code path and would have stayed at their constructor defaults — leaving the worker count and the batch-size gate untunable from anywhere.

field default purpose
use_parallel_embedding False opt in
parallel_workers 4 worker processes
parallel_embedding_threshold 10 stay serial below this many molecules — spawning processes for a handful costs more than it saves

They flow Auto3DOptionsCLIConfig → both IsomerEngineFactory.create sites. CLIConfig is not optional here: test_cliconfig_covers_all_auto3doptions_fields requires every user-facing Auto3DOptions field to be reachable from the CLI/YAML layer, which is also what makes these settable from a config file rather than Python only.

Default stays off. Enabling it changes a run's resource profile, and that should be the caller's choice rather than something they discover.

A self-review catch worth recording

I first declared the bounds as Field(default=4, ge=1) on the pydantic model. _check_bounds' own docstring warns that a second hand-maintained constraint set is exactly the drift it exists to prevent — it enforces Auto3D.config.FIELD_BOUNDS precisely so the two schemas cannot disagree. The Field constraints were removed and the single table extended instead.

Testing

The tests assert what the factory is called with, not what the dataclass holds. Auto3DOptions(use_parallel_embedding=True).use_parallel_embedding is True would pass with the plumbing still entirely missing — it tests the dataclass, not the wiring. That is the trap this codebase has hit repeatedly, so the test stubs IsomerEngineFactory.create, drives smiles2mols, and asserts the three values arrived.

Mutation-verified both ways:

  • un-wiring the smiles2mols call site → the reachability test fails
  • dropping the FIELD_BOUNDS entries → both bounds cases fail

Plus a test that the default is still serial, so this cannot silently become opt-out.

1297 passed, 9 skipped; ruff clean.

Consequence for the deletion list

M53's "test-only" claim for isomers/parallel_embed.py no longer holds, and the module is off that list — recorded in the plan doc. #132's diagnostics fix now protects a path a user can actually take.

…ode behind it

Parallel conformer embedding existed as a constructor argument on the isomer
engine with no route from Auto3DOptions, so no main() or smiles2mols run could
turn it on and isomers/parallel_embed.py was reachable only from tests -- which is
why audit M53 listed that module as ~138 lines of dead code. Given the choice
between deleting a working feature and connecting it, this connects it.

Three fields, not one. Wiring only the boolean would have half-plumbed it:
parallel_workers and parallel_embedding_threshold are read by the same code path
(isomer_engine.py gates on `use_parallel_embedding and len(mols) >= threshold`) and
would have stayed at their constructor defaults, leaving the worker count and the
batch-size gate untunable from anywhere.

They flow Auto3DOptions -> CLIConfig -> both IsomerEngineFactory.create sites.
CLIConfig is not optional here: test_cliconfig_covers_all_auto3doptions_fields
requires every user-facing Auto3DOptions field to be reachable from the CLI/YAML
layer, which is also what makes these settable from a config file rather than
Python only.

Bounds live in FIELD_BOUNDS, not in Field(ge=1) on the pydantic model. I wrote the
Field constraints first; _check_bounds' own docstring warns that a second
hand-maintained constraint set is exactly the drift it exists to prevent, so they
were removed and the single table extended instead.

Default stays off: enabling it changes a run's resource profile, which should be
the caller's choice rather than something they discover.

The tests assert what the factory is CALLED with, not what the dataclass holds --
`Auto3DOptions(use_parallel_embedding=True).use_parallel_embedding is True` would
pass with the plumbing still missing, since it tests the dataclass and not the
wiring. Mutation-verified both ways: un-wiring the call site fails the reachability
test, and dropping the FIELD_BOUNDS entries fails both bounds cases.

M53's "test-only" claim for isomers/parallel_embed.py no longer holds and the
module is off that deletion list; #132's diagnostics fix now protects a path a
user can actually take.

Verified: 1297 passed, 9 skipped; ruff clean.
@isayev
isayev merged commit 1970ebd into main Aug 3, 2026
8 checks passed
@isayev
isayev deleted the phase19/parallel-embedding-option branch August 3, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant