feat: add task envelope with tags, when, and loop#225
Merged
josegonzalez merged 1 commit intomainfrom Apr 27, 2026
Merged
Conversation
Replaces the legacy `len(t) > 2` cap on task entries with an envelope-key allowlist (`name`, `tags`, `when`, `loop`, plus four keys reserved for #210), introduces a `TaskEnvelope` wrapper, ships `--tags` / `--skip-tags` filtering for `apply` and `plan`, evaluates `when:` predicates via `expr-lang/expr` with a per-program cache, and expands `loop:` literals or expressions into per-iteration envelopes. Loop bodies render through a second sigil pass with `.item` and `.index` injected; `.item` references outside a loop are rejected at parse and validate time.
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.
Summary
Closes #205. Replaces the legacy
len(t) > 2cap on task entries with an envelope-key allowlist, introduces aTaskEnvelopewrapper, and ships three end-user features that exercise the new pipeline:tagsfiltering,when:predicates, andloop:iteration. Body templating continues to use sigil; envelope predicates useexpr-lang/exprwith a per-program cache so loop iterations re-evaluate without recompiling.The full envelope-key allowlist is
name,tags,when,loop,register,changed_when,failed_when,ignore_errors. The last four are reserved for #210 - the loader recognises and decodes them so #210 does not have to revisit the cap. Unknown envelope keys are rejected with a "did you mean" hint.when: falseproduces a[skipped]task line and contributes to a new "skipped" summary count on bothapplyandplan.loop:accepts a list literal or an expr expression returning a list; expansions render the body with.itemand.indexinjected via a per-task second-pass sigil render. References to.item/.indexoutside aloop:body are rejected at parse time and reported byvalidate.The
validateExprPredicatesstub from #205's planning landed earlier is now populated:when:,changed_when:,failed_when:and scalar-formloop:are compiled at validate time and any compile error is anchored to its source line / column. The reserved envelope keys (register,changed_when,failed_when,ignore_errors) continue to emit the existing "envelope key reserved but not yet supported" diagnostic until #210 lands.