Skip to content

fix(explorer): let the outbound self-check accept the modelChemistry line the inbound guard admits - #200

Merged
alongd merged 1 commit into
i019-seed-labelfrom
i020-generated-modelchem
Aug 25, 2026
Merged

fix(explorer): let the outbound self-check accept the modelChemistry line the inbound guard admits#200
alongd merged 1 commit into
i019-seed-labelfrom
i020-generated-modelchem

Conversation

@alongd

@alongd alongd commented Aug 23, 2026

Copy link
Copy Markdown
Member

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.py guards one boundary twice: _validate_source_statements on the way in (the untrusted network file it reads) and _validate_generated_statements on the way out (a self-check on the explorer input it is about to write). #198 taught the inbound guard to accept modelChemistry = 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:

RuntimeError: Refusing to write '.../round_0/explorer/input.py': the generated explorer input file
text failed its own self-check. Line 9 is a top-level Assign statement ("modelChemistry =
LevelOfTheory(...") that this module never emits and no validated source statement can become

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: a modelChemistry bound to any other value, or a structurally invalid call, still falls through to the RuntimeError.

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

  • Driven on the real artifact, end to end. Seeding a loop run with the pilot's own round-0 hybrid now writes the explorer input (7963 bytes), carrying modelChemistry = LevelOfTheory(method='wb97xd2023',basis='def2tzvp',software='gaussian') at line 9 and explorer(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.
  • The 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.
  • Mutation: forcing the shared helper to return False turns 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' at arkane/statmech.py:372. The hybrid's transitionState('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.

…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_statements and _validate_generated_statements.
  • Updates the outbound self-check error message to reflect the now-allowed modelChemistry directive shape.
  • Updates tests to (1) explicitly cover outbound acceptance/refusal symmetry for modelChemistry and (2) remove the previously-pinned xfail now 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.

@alongd
alongd merged commit b0be7fb into i019-seed-label Aug 25, 2026
1 check passed
@alongd
alongd deleted the i020-generated-modelchem branch August 25, 2026 05:30
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.

2 participants