Stop skip-flag guards becoming reference rebuilds and assets#367
Open
jmchilton wants to merge 1 commit into
Open
Stop skip-flag guards becoming reference rebuilds and assets#367jmchilton wants to merge 1 commit into
jmchilton wants to merge 1 commit into
Conversation
detectReferenceRebuilds filtered skip-flag guards by testing the raw negated identifier, but nf-core subworkflows rename take slots, so bacass's `if (!val_skip_fastqc)` sailed past the anchored regex. The rule was then resolved back to the real `skip_fastqc` param via the caller binding, and buildReferenceAssets admitted it unfiltered because the rebuild path bypasses both isNonReferenceParam and isPathTypedParam. Fix both ends. The rule is now dropped when the *resolved* asset_param is a boolean (or skip-named); the asset inventory rejects a boolean however it was nominated — reachable independently via a rule's fallback_for. Gate on non-boolean, not path-typed: bacass's baktadb and all five eager assets are declared bare `type: string`, so a path-typed requirement would drop 6 of the 11 legitimate rebuild assets in the corpus. bacass drops from 4 rules / 3 assets to 1 / 1. sarek (6 rules) and eager (5) are unchanged, as is every other fixture. Closes #355 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #355.
Root cause
detectReferenceRebuildsfiltered skip-flag guards by testing the raw negated identifier. nf-core subworkflows conventionally rename take slots, so bacass'sif (!val_skip_fastqc)(subworkflows/nf-core/fastq_trim_fastp_fastqc/main.nf:39, take declaredval_skip_fastqc // value: boolean) sailed past the anchored^(skip|no|disable|disabled)_.resolveAssetParamthen resolved the rule back to the realskip_fastqcparam via the caller's positional binding inworkflows/bacass.nf:176— withconfidence: high.buildReferenceAssetsadmitted it unfiltered, because the rebuild path bypasses bothisNonReferenceParamandisPathTypedParam.Fix
Both ends, as the issue asks:
detectReferenceRebuildsnow takesparams: Param[]rather than a bare name set, and drops a rule when the resolvedasset_paramis boolean-typed (or skip-named).buildReferenceAssetsrejects a boolean param however it was nominated.The raw-identifier pre-filter stays. Instrumenting it across the corpus showed it fires 101 times catching the direct
!params.skip_*and bare!skip_*forms — it's live, just not sufficient alone. It's also defeated in shapes no prefix-stripping would catch: domain-namespaced flags (arg_skip_abricate,bgc_skip_antismash,mapstats_skip_preseq),skipwith no trailing underscore (preprocessing_skippairmerging,longread_qc_skipadaptertrim), and an adjacent class the vocabulary never covered (!params.run_taxa_classification,!params.with_umi,!build_only_index). Those don't currently produce rules only because they fail later gates — luck, not design. So the resolved-param type check is the durable defense; the name filter is a cheap first pass.Deviation from the suggested acceptance criteria
The issue suggests requiring the param be path-typed on the rebuild path. That would break correct output: bacass's
baktadbistype: string, format: null— not path-typed — as are all five eager assets (fasta_fai,fasta_dict,fasta_mapperindexdir). Only sarek's 6 declarefile-path/directory-path. A path-typed gate would drop 6 of the corpus's 11 legitimate rebuild assets, including thebaktadbthe issue's own criterion requires. Gated on non-boolean instead.Tests
Three, all verified red-to-green:
resolver.test.ts— "skips skip-flag guards renamed by a subworkflow take slot": synthetic pipeline mirroring bacass, alongside a legitimatefasta_fairebuild, asserting only the legitimate rule and assets survive. Pre-fix: 2 rules.resolver.test.ts— "keeps a boolean param out of reference_assets when a rebuild nominates it": pins thefallback_forpath, which is independently reachable — the rule legitimately stands withfallback_for: "build_index"and the asset gate must still block it. Pre-fix assets:['build_index', 'fasta', 'fasta_fai']. The asset-side fix is load-bearing, not just belt-and-braces.integration/cli.test.ts— "rebuilds only the Bakta database, not the FASTQC/FASTP skip flags": the real bacass fixture, pinning the headline criterion.Verification
baktadb/BAKTA_BAKTADBDOWNLOAD).summarize-nextflow90/90, rootnpm run test151/151,packages-typecheck,packages-lint,packages-format,validate(0 errors) pass.cast summarize-nextflow --checkclean — no bundle regeneration needed.🤖 Generated with Claude Code