Skip to content

feat: add task envelope with tags, when, and loop#225

Merged
josegonzalez merged 1 commit intomainfrom
205-refactor-task-entries-into-envelopes-add-tags-when-and-loop
Apr 27, 2026
Merged

feat: add task envelope with tags, when, and loop#225
josegonzalez merged 1 commit intomainfrom
205-refactor-task-entries-into-envelopes-add-tags-when-and-loop

Conversation

@josegonzalez
Copy link
Copy Markdown
Member

Summary

Closes #205. Replaces the legacy len(t) > 2 cap on task entries with an envelope-key allowlist, introduces a TaskEnvelope wrapper, and ships three end-user features that exercise the new pipeline: tags filtering, when: predicates, and loop: iteration. Body templating continues to use sigil; envelope predicates use expr-lang/expr with 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: false produces a [skipped] task line and contributes to a new "skipped" summary count on both apply and plan. loop: accepts a list literal or an expr expression returning a list; expansions render the body with .item and .index injected via a per-task second-pass sigil render. References to .item / .index outside a loop: body are rejected at parse time and reported by validate.

The validateExprPredicates stub from #205's planning landed earlier is now populated: when:, changed_when:, failed_when: and scalar-form loop: 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.

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.
@josegonzalez josegonzalez merged commit e7e132f into main Apr 27, 2026
10 checks passed
@josegonzalez josegonzalez deleted the 205-refactor-task-entries-into-envelopes-add-tags-when-and-loop branch April 27, 2026 21:28
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.

Refactor task entries into envelopes; add tags, when, and loop

1 participant