shell: defaults param, fix 3 rendering bugs, add bedtools example#1062
Merged
Conversation
shell.create now accepts `defaults={name: value}` — per-input fallback
values applied when the caller omits an input. Works independently of
`T | None`: required + no default raises, optional + no default suppresses
the flag, either + default uses the default.
Three rendering bugs surfaced while building a bedtools intersect wrapper:
1. Positional-arg indices >= 10 were emitted as bare `$10`, which bash
parses as `$1` followed by literal "0". Any task with 10+ scalar/bool
inputs had its 10..N values silently corrupted. Fixed by always braced
`${10}`.
2. Optional File / Dir flags emitted unconditionally — the renderer
hardcoded `-flag /var/inputs/name` regardless of whether the caller
supplied the file, so omitting an optional file flag pointed the tool
at a missing path. Now guarded with
`if [ -e <path> ]; then ...; else <flag>=""; fi`.
3. Inputs whose names differed only in case (e.g. `c` vs `C`, common in
bio CLIs like bedtools / samtools) collided on the same `_VAL_*` /
`_FLAG_*` bash variable and silently overwrote each other. create()
now rejects this at declaration time with an error naming both
offending inputs.
Adds 28 unit tests across the four-cell defaults matrix, optional
File/Dir flag emission, case-collision detection, and the positional-arg
brace regression.
New examples:
- examples/shell/12_bedtools_intersect_example.py — three intersect
queries in parallel against a small BED fixture.
- examples/shell/modules/bedtools_intersect.py — typed wrapper around
bedtools intersect; reference for bio-CLI shell-extra modules.
Signed-off-by: Kyle Hazen <kyle@union.ai>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
samhita-alla
added a commit
that referenced
this pull request
May 13, 2026
) Stacked on top of #1055 — depends on the shell extra introduced there. ## Summary - New `defaults={...}` parameter on `shell.create()` — per-input fallback values applied when the caller omits an input, independent of `T | None` (which controls flag suppression). - Three rendering bugs found while building a `bedtools intersect` wrapper: - Positional indices ≥ 10 emitted as bare `$10`; bash parses that as `$1` + literal `"0"`. Tasks with 10+ scalar/bool inputs had values 10..N silently corrupted. Fixed by always-braced `${10}`. - Optional File / Dir flags emitted unconditionally — the renderer hardcoded `-flag /var/inputs/name` regardless of whether the caller supplied the file. Now guarded with `if [ -e <path> ]; then …; else <flag>=""; fi`. - Inputs whose names differ only in case (e.g. `c` vs `C`, common in bio CLIs) collided on the same `_VAL_*`/`_FLAG_*` bash variable and silently overwrote each other. `create()` now rejects this at declaration time. - New `examples/shell/12_bedtools_intersect_example.py` + `examples/shell/modules/bedtools_intersect.py` demonstrating a wider-flag-surface bedtools wrapper as a reference. This should probably just go in your plugins but leaving for your reference. ## Test plan - [x] 146 unit tests pass (28 new across the four areas above) - [x] Local Docker run of the bedtools example produces correct output for \`wa\`, \`v\`, \`count_overlaps\` against a small BED fixture - [ ] Remote run against demo cluster (needs the dev wheel to land on the cluster) --------- Signed-off-by: Kyle Hazen <kyle@union.ai> Signed-off-by: Samhita Alla <aallasamhita@gmail.com> Co-authored-by: Samhita Alla <aallasamhita@gmail.com> Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
samhita-alla
added a commit
that referenced
this pull request
May 13, 2026
) Stacked on top of #1055 — depends on the shell extra introduced there. ## Summary - New `defaults={...}` parameter on `shell.create()` — per-input fallback values applied when the caller omits an input, independent of `T | None` (which controls flag suppression). - Three rendering bugs found while building a `bedtools intersect` wrapper: - Positional indices ≥ 10 emitted as bare `$10`; bash parses that as `$1` + literal `"0"`. Tasks with 10+ scalar/bool inputs had values 10..N silently corrupted. Fixed by always-braced `${10}`. - Optional File / Dir flags emitted unconditionally — the renderer hardcoded `-flag /var/inputs/name` regardless of whether the caller supplied the file. Now guarded with `if [ -e <path> ]; then …; else <flag>=""; fi`. - Inputs whose names differ only in case (e.g. `c` vs `C`, common in bio CLIs) collided on the same `_VAL_*`/`_FLAG_*` bash variable and silently overwrote each other. `create()` now rejects this at declaration time. - New `examples/shell/12_bedtools_intersect_example.py` + `examples/shell/modules/bedtools_intersect.py` demonstrating a wider-flag-surface bedtools wrapper as a reference. This should probably just go in your plugins but leaving for your reference. ## Test plan - [x] 146 unit tests pass (28 new across the four areas above) - [x] Local Docker run of the bedtools example produces correct output for \`wa\`, \`v\`, \`count_overlaps\` against a small BED fixture - [ ] Remote run against demo cluster (needs the dev wheel to land on the cluster) --------- Signed-off-by: Kyle Hazen <kyle@union.ai> Signed-off-by: Samhita Alla <aallasamhita@gmail.com> Co-authored-by: Samhita Alla <aallasamhita@gmail.com> (cherry picked from commit f53a8bc)
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 top of #1055 — depends on the shell extra introduced there.
Summary
defaults={...}parameter onshell.create()— per-input fallback values applied when the caller omits an input, independent ofT | None(which controls flag suppression).bedtools intersectwrapper:$10; bash parses that as$1+ literal"0". Tasks with 10+ scalar/bool inputs had values 10..N silently corrupted. Fixed by always-braced${10}.-flag /var/inputs/nameregardless of whether the caller supplied the file. Now guarded withif [ -e <path> ]; then …; else <flag>=""; fi.cvsC, common in bio CLIs) collided on the same_VAL_*/_FLAG_*bash variable and silently overwrote each other.create()now rejects this at declaration time.examples/shell/12_bedtools_intersect_example.py+examples/shell/modules/bedtools_intersect.pydemonstrating a wider-flag-surface bedtools wrapper as a reference. This should probably just go in your plugins but leaving for your reference.Test plan