Skip to content

fix(schema): forbid task-only bool fields on task templates#10242

Merged
jdx merged 7 commits into
jdx:mainfrom
risu729:fix/task-template-output-flags
Jun 12, 2026
Merged

fix(schema): forbid task-only bool fields on task templates#10242
jdx merged 7 commits into
jdx:mainfrom
risu729:fix/task-template-output-flags

Conversation

@risu729

@risu729 risu729 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • forbid hide, quiet, raw, interactive, and raw_args on [task_templates.*] in JSON Schema so editors stop suggesting keys that never applied
  • remove the unused TaskTemplate fields for hide/quiet/raw (they parsed but were never merged into tasks)
  • align docs with schema/runtime behavior

Why these flags are not supported on templates

Task templates were added in #7873. From the start, hide, quiet, and raw were never merged from templates into tasks. interactive (#8491) and raw_args (#9118) were added to tasks later and were never wired into template merge either.

All five share the same limitation:

  • Task stores these as plain bool values (default false), so mise cannot tell "unset" from "explicitly set to false"
  • merging a template value would incorrectly override a task that sets quiet = false when the template has quiet = true
  • output/I/O and argument-parsing behavior is per-task; templates are for shared run configuration (scripts, tools, env, deps, etc.)

The struct still parsed hide/quiet/raw (copied from task schema), and JSON Schema inherited all of task_props into task_template, so editors suggested every task flag even though runtime silently ignored the unsupported ones. Docs already said output flags are not carried over; schema disagreed.

This PR fixes that mismatch. Runtime still ignores unknown template keys (no deny_unknown_fields); schema lint catches invalid configs in editors.

Proper inheritance would need tri-state Task fields (tracked separately).

Changes

  • schema/mise.json: forbid hide/quiet/raw/interactive/raw_args on task_template via false property schemas
  • TaskTemplate: remove unused hide/quiet/raw fields; keep merge comment explaining why these bool fields are not merged
  • docs/tasks/templates.md: document all five as not supported on templates
  • e2e/config/test_schema_tombi: schema lint rejects each forbidden field on templates

Test plan

  • cargo test task_template
  • mise run test:e2e test_schema_tombi

Summary by CodeRabbit

  • Documentation

    • Clarified that output-control options (quiet, hide, raw, interactive, raw_args) are not supported on task templates and must be set on each task.
  • Schema

    • Validation tightened so task templates cannot set those output-control options; templates with them will be rejected.
  • Tests

    • End-to-end tests updated to cover the stricter rules and to reject templates that include those flags.

These fields parsed on templates but were never merged into tasks
because Task stores them as plain bools. That mismatch is a bug, not
dead code: schema allowed the keys while runtime silently ignored them.

Reject them at parse time and in JSON Schema so templates cannot
declare output behavior that does not apply.
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Remove output-control flags from TaskTemplate; JSON schema forbids hide/quiet/raw/interactive/raw_args on templates; e2e tests and fixtures updated to reject templates with those flags; docs clarified that templates cannot set these options.

Changes

Output control flags removed from task templates

Layer / File(s) Summary
TaskTemplate struct change
src/task/task_template.rs
Removed TOML-deserializable boolean fields quiet, hide, and raw from TaskTemplate and updated merge_template comment to note boolean fields are bool on Task and are not merged from templates.
JSON schema constraint
schema/mise.json
Added an allOf fragment under $defs.task_template fixing hide, quiet, raw, interactive, and raw_args to false for task templates.
e2e fixtures and test flow
e2e/config/test_schema_tombi
Removed quiet = true from the valid mise.toml fixture, added mise-bad-tmpl-output-flag.toml to schema includes, fixed heredoc termination for the extends rejection test, and added negative tests looping over quiet, hide, raw, interactive, and raw_args asserting lint failure when those flags appear in task_templates.base.
Documentation
docs/tasks/templates.md
Clarified that quiet, hide, raw, interactive, and raw_args are not supported on templates and must be set per task; updated merge-semantics wording accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
Flags once borrowed, now set aside,
Templates lean, no whispers hide.
Each task holds its own bright light,
Configs hop clear in morning light.
Hooray — tiny paws, big delight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: forbidding task-only boolean fields on task templates, which is the core objective across schema, code, and documentation updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
e2e/config/test_schema_tombi (1)

159-166: ⚡ Quick win

Expand schema e2e coverage to include hide and raw too.

This block currently asserts only quiet, so schema regressions on hide/raw would not be caught at e2e level.

Suggested update
-include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-env-directive.toml", "mise-bad-tmpl.toml", "mise-bad-tmpl-quiet.toml", "mise-bad-os.toml", "mise-bad-watch-files.toml"]
+include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-env-directive.toml", "mise-bad-tmpl.toml", "mise-bad-tmpl-output-flag.toml", "mise-bad-os.toml", "mise-bad-watch-files.toml"]
@@
-# Verify that quiet/hide/raw are rejected on task_templates
-cat >"$HOME/workdir/mise-bad-tmpl-quiet.toml" <<'TOML'
-[task_templates.base]
-quiet = true
-TOML
-
-assert_fail "$TOMBI_LINT mise-bad-tmpl-quiet.toml"
+# Verify that quiet/hide/raw are rejected on task_templates
+for flag in quiet hide raw; do
+cat >"$HOME/workdir/mise-bad-tmpl-output-flag.toml" <<TOML
+[task_templates.base]
+$flag = true
+TOML
+assert_fail "$TOMBI_LINT mise-bad-tmpl-output-flag.toml"
+done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/config/test_schema_tombi` around lines 159 - 166, The test only checks
that a task_templates.base file with the "quiet" key is rejected, so add
coverage for "hide" and "raw" by creating similar test inputs and asserting
failure for each; specifically, update the e2e case that writes
"$HOME/workdir/mise-bad-tmpl-quiet.toml" (and the assert_fail invoking
"$TOMBI_LINT mise-bad-tmpl-quiet.toml") to also create equivalents containing
task_templates.base.hide = true and task_templates.base.raw = true (or a single
TOML with all three keys) and call assert_fail "$TOMBI_LINT <filename>" for each
to ensure hide and raw are rejected like quiet.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@e2e/config/test_schema_tombi`:
- Around line 159-166: The test only checks that a task_templates.base file with
the "quiet" key is rejected, so add coverage for "hide" and "raw" by creating
similar test inputs and asserting failure for each; specifically, update the e2e
case that writes "$HOME/workdir/mise-bad-tmpl-quiet.toml" (and the assert_fail
invoking "$TOMBI_LINT mise-bad-tmpl-quiet.toml") to also create equivalents
containing task_templates.base.hide = true and task_templates.base.raw = true
(or a single TOML with all three keys) and call assert_fail "$TOMBI_LINT
<filename>" for each to ensure hide and raw are rejected like quiet.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 79603649-6fc3-4df2-9c74-afd08f2eacea

📥 Commits

Reviewing files that changed from the base of the PR and between ebf4795 and 45d92e0.

📒 Files selected for processing (4)
  • docs/tasks/templates.md
  • e2e/config/test_schema_tombi
  • schema/mise.json
  • src/task/task_template.rs

@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR closes a long-standing mismatch between schema and runtime by forbidding the five task-only boolean flags (hide, quiet, raw, interactive, raw_args) on task_template entries, both in JSON Schema (so editors stop suggesting them) and in the TaskTemplate Rust struct (which already silently ignored most of them).

  • Schema (schema/mise.json): The task_template allOf block gains a second member with "hide": false"raw_args": false, which causes any compliant validator to reject these properties while the existing unevaluatedProperties: false keeps blocking every other unknown key.
  • Struct (src/task/task_template.rs): The three parsed-but-ignored fields (hide, quiet, raw) are deleted; the explanatory comment is extended to cover all five flags.
  • Tests (e2e/config/test_schema_tombi): A new loop fixture tests each forbidden flag individually; the existing mise-bad-tmpl.toml is trimmed to rely on extends being unsupported on templates instead of the now-removed quiet field.

Confidence Score: 5/5

Safe to merge — only removes unused struct fields, tightens the schema, updates docs, and adds targeted tests; no runtime behavior changes.

All three layers (schema, struct, docs/tests) are updated consistently. The five forbidden fields were either already ignored at runtime or never parsed, so removing them from TaskTemplate cannot break existing configs. The JSON Schema false-property + unevaluatedProperties: false pattern is valid and correctly rejects the flags in any compliant validator.

No files require special attention.

Important Files Changed

Filename Overview
schema/mise.json Adds false property schemas for hide, interactive, quiet, raw, and raw_args within the task_template allOf block, correctly forbidding these fields while unevaluatedProperties: false ensures no other unknown fields are accepted.
src/task/task_template.rs Removes the never-used hide, quiet, and raw fields from TaskTemplate; expands the existing comment to name all five unsupported bool flags. interactive and raw_args were never in the struct and remain absent.
docs/tasks/templates.md Updates the merge-behavior table to list all five unsupported flags (quiet, hide, raw, interactive, raw_args) with the clarified note that they are not supported on templates.
e2e/config/test_schema_tombi Removes quiet = true from the mise-bad-tmpl.toml fixture (now tests extends rejection instead), adds a new loop test that individually writes each of the five forbidden flags into mise-bad-tmpl-output-flag.toml and asserts lint failure.

Reviews (6): Last reviewed commit: "Merge branch 'main' into fix/task-templa..." | Re-trigger Greptile

Comment thread schema/mise.json
@risu729 risu729 marked this pull request as draft June 5, 2026 22:24
Remove the no-op struct fields and forbid them in JSON Schema only.
Serde ignores unknown template keys at runtime; schema guides editors.
@risu729 risu729 changed the title fix(task): reject hide/quiet/raw on task templates fix(task): drop hide/quiet/raw from task templates Jun 6, 2026
@risu729 risu729 changed the title fix(task): drop hide/quiet/raw from task templates fix(schema): forbid hide/quiet/raw on task templates Jun 6, 2026
@risu729 risu729 marked this pull request as ready for review June 6, 2026 01:03
@risu729 risu729 marked this pull request as draft June 6, 2026 01:04
Extend task_template schema overrides and docs to cover these task-only
bool fields. Same rationale as hide/quiet/raw: never merged from templates.
@risu729 risu729 changed the title fix(schema): forbid hide/quiet/raw on task templates fix(schema): forbid task-only bool fields on task templates Jun 6, 2026
@risu729 risu729 marked this pull request as ready for review June 6, 2026 01:08
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 2 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 3 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 4 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 5 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 6 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@jdx jdx merged commit fff92e0 into jdx:main Jun 12, 2026
34 checks passed
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.

2 participants