Make disconnect() symmetric with connect(), and cover two remaining wrapper sites - #133
Merged
Merged
Conversation
…rapper sites #131 BeautiDoc: the inner-"mcmc" redirect added in f6a369c was applied to connect() only. scrubAll() calls connect() and disconnect() as the two branches of one decision, so with a wrapper Runnable objects were connected to the inner MCMC but never removed from it again -- disconnect() resolved the wrapper, and getInput(inputName) threw IllegalArgumentException into the catch-and-print, silently doing nothing. Extract the redirect as redirectToInnerMCMC() and use it from both. Also give disconnect(BeautiConnector, PartitionContext) the same targetID='mcmc' -> runnable ID translation connect() already has; this is a no-op for the shipped templates, whose runnable is literally id="mcmc". OperatorListInputEditor and MRCAPriorInputEditor read MCMC inputs off doc.mcmc.get() without a cast ("operatorschedule", "operator"), so they were missed by the cast sweep, but they fail the same way: getInput()/setInputValue() throw IllegalArgumentException for an unknown input name. Route both through doc.getMCMC(). This is what still broke the Operators panel and the tip-date sampling toggle for a PathSampler-style runnable.
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.
Follow-up to #132 (review findings), targeting
mcmcso it lands inside that PR rather than separately. See #131.1.
disconnect()never got the inner-"mcmc"redirectconnect()gained the redirect in f6a369c;disconnect()did not.scrubAll()calls the two as the branches of a single decision:So with a wrapper Runnable, objects get connected to the inner MCMC but are never removed from it again:
disconnect()resolves the wrapper,target.getInput(inputName)throwsIllegalArgumentException, and the surrounding catch-and-print swallows it. The failure is silent — toggling a checkbox off, deleting a partition, or switching a clock model leaves stale operators/loggers on the inner MCMC and the generated XML is wrong rather than crashy.Extracted the redirect as
redirectToInnerMCMC()and used it from both, with a javadoc note that it must stay used by both.Also gave
disconnect(BeautiConnector, PartitionContext)thetargetID='mcmc' -> mcmc.get().getID()translationconnect(BeautiConnector, ...)already has. This is a no-op for the shipped templates —Standard.xmldeclares<run spec="beast.base.inference.MCMC" id="mcmc">, so the translation resolves to the same string — but it matters for a wrapper template whose runnable carries a different ID.2. Two remaining sites that assume MCMC's inputs
These read MCMC inputs off
doc.mcmc.get()without a cast, so the(MCMC)sweep didn't catch them, but they fail the same way —getInput()/setInputValue()throwIllegalArgumentExceptionfor an unknown input name (BEASTInterface.java:413):OperatorListInputEditor:66—getInput("operatorschedule"). The Operators panel is in BEAUti throws ClassCastException in multiple panels when the active Runnable wraps MCMC (e.g. PathSampler) #131's repro list, so this one was still broken.MRCAPriorInputEditor:329/354—setInputValue("operator", ...)andgetInput("operator"), i.e. the tip-date sampling toggle.Both routed through
doc.getMCMC(), following the null-guard style already used elsewhere in #132.Verification
mvn -o -pl beast-fx -am -DskipTests compileclean.BeautiMRCAPriorTest1/1 pass,LinkUnlinkTest14 run / 0 failures / 7 skipped (pre-existing@Disabled). BUILD SUCCESS.Not addressed here
Null handling across #132 is still split roughly half-and-half —
BeautiDoc:1595/:1641(getMCMC().posteriorInput.get()inscrubAll/setUpActivePlugins) and thedeepCopyPlugincall sites will NPE where other sites carefully guard. That's a contract decision for you: either those are bugs, or the guards are dead code andgetMCMC()should throw a namedIllegalStateExceptioninstead of returning null. Left alone deliberately so this PR stays reviewable.