fix(explorer): let the outbound self-check accept the modelChemistry line the inbound guard admits - #200
Merged
Merged
Conversation
…line the inbound guard admits The inbound source guard learned to accept `modelChemistry = LevelOfTheory(...)`, but the outbound self-check was never taught the same. Because that line is spliced verbatim from source to generated file, it passed on the way in and was refused on the way out, so the explorer input file was never written. Share one accept-test (`_is_model_chemistry_call_assignment`) between both guards so they cannot drift apart again, and correct the outbound error message, which asserted "no validated source statement can become" this line -- now false. Adds focused outbound-acceptance/refusal unit tests, turns the pinned xfail(strict) real-hybrid test into an ordinary passing test, and updates the seed-barrier test that pinned the old stop-point.
There was a problem hiding this comment.
Pull request overview
Aligns the explorer input writer’s outbound “self-check” with the inbound source guard so that a validated modelChemistry = LevelOfTheory(...) / CompositeLevelOfTheory(...) directive can be spliced source→generated without being rejected at write time.
Changes:
- Extracts shared acceptance logic for the
modelChemistry = LevelOfTheory(...)/CompositeLevelOfTheory(...)assignment into_is_model_chemistry_call_assignment(...)and uses it in both_validate_source_statementsand_validate_generated_statements. - Updates the outbound self-check error message to reflect the now-allowed
modelChemistrydirective shape. - Updates tests to (1) explicitly cover outbound acceptance/refusal symmetry for
modelChemistryand (2) remove the previously-pinnedxfailnow that the defect is fixed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
t3/pdep/explorer/input_file.py |
Introduces a shared helper for modelChemistry call-assignments and uses it in both inbound and outbound guards; adjusts outbound error messaging accordingly. |
tests/test_pdep/test_explorer_input_file.py |
Adds explicit tests for outbound modelChemistry acceptance/refusal symmetry and converts the formerly-xfailed real-artifact path to passing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Stacked on #199 → #198 → #197. Base is
i019-seed-label, so this diff shows only its own change; GitHub retargets as each parent merges. Review in order.What this fixes
t3/pdep/explorer/input_file.pyguards one boundary twice:_validate_source_statementson the way in (the untrusted network file it reads) and_validate_generated_statementson the way out (a self-check on the explorer input it is about to write). #198 taught the inbound guard to acceptmodelChemistry = LevelOfTheory(...); the outbound one was not changed. Since that line is spliced verbatim source → generated, it became accepted on entry and refused on exit, so nothing was written at all:That message's second clause had silently become false — which is the readable tell that the pair had drifted.
The change
The accept-decision is extracted into one shared helper,
_is_model_chemistry_call_assignment(target, value), and both guards call it. The inbound guard's private copy is gone. The outbound guard now accepts exactly what the inbound guard accepts and no more: amodelChemistrybound to any other value, or a structurally invalid call, still falls through to theRuntimeError.Sharing one helper rather than repeating the exception is the point of the change — an unexplained second copy is how the pair drifted in the first place.
The outbound error message no longer asserts that no validated source statement can become this line, and names the
modelChemistry = LevelOfTheory/CompositeLevelOfTheory(...)directive as belonging there.Testing
modelChemistry = LevelOfTheory(method='wb97xd2023',basis='def2tzvp',software='gaussian')at line 9 andexplorer(source=['[O]C=O(1)'], ...)— the seed resolved by fix(pdep): resolve the explorer seed to the round's own species label #199 — at line 165. No cluster, no quantum chemistry.xfail(strict=True)test fix(pdep): resolve the explorer seed to the round's own species label #199 left pinned to this defect is now an ordinary passing test, marker removed.Falseturns nine tests red across both guards, including all three real-artifact tests. Restored, green.tests/test_pdep: 1929 passed, 133 s.Known next defect, not chased
The run now reaches Arkane itself and stops there:
FileNotFoundError: 'qm/TS2.py'atarkane/statmech.py:372. The hybrid'stransitionState('TS2', 'qm/TS2.py')is relative to the hybrid's own directory, but the generated explorer input lives elsewhere, and Arkane opens that path against the process working directory. Tracked separately.Worth noting the loop degrades well here: it reports
status 'failed'with Arkane's stderr quoted, rather than crashing.