8000 fix(mfile): warn on the deprecated harness table and refuse a task with two actions by norrietaylor · Pull Request #1938 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(mfile): warn on the deprecated harness table and refuse a task with two actions - #1938

Merged
norrietaylor merged 5 commits into
mainfrom
fix/mfile-harness-deprecation-and-multi-action
Oct 6, 2026
Merged

norrietaylor merged 5 commits into
mainfrom
fix/mfile-harness-deprecation-and-multi-action

Conversation

@norrietaylor
@norrietaylor norrietaylor commented Oct 4, 2026 •
Copy link
Copy Markdown
Member

Summary

Two minimal.toml validation gaps in crates/mfile:

  • [harness] parsed silently. It was a serde alias for [stack], and an alias leaves no trace of which spelling was used, so nothing could warn before the alias is removed. harness is now a separate, never-serialized field. File's Deserialize impl (via #[serde(remote = "Self")], so every load path is covered: disk, bytes, and wire) moves it into stack and records that the deprecated spelling was used. warn_unknown_fields then warns once: "[harness] is deprecated; rename it to [stack] in minimal.toml". A file that sets both [stack] and [harness] is an error.
  • A task with two actions ran one and misreported the other. TaskAction is flattened into Task, so serde takes one action key and the other lands in Task::extra. It was then reported as unknown fields in task <name>: exec with the "update to a newer version of minimal?" hint. File::validate now refuses the task with the new Error::MultipleTaskActions: "task both sets more than one action (exec, bash); set exactly one". The check runs before the unknown-field warning, so the upgrade hint no longer fires for an action key. TaskAction::KEYS / TaskAction::key() expose the action-key list from tasks.rs.

The reference docs for [stack] and task actions describe both behaviours.

Tests

New tests in crates/mfile/src/lib.rs:

  • harness_loads_as_stack_and_warns_deprecated: [harness] gives the same stack as [stack], serializes back as [stack], and the disk load emits the deprecation warning exactly once, with no upgrade hint.
  • harness_and_stack_together_is_an_error
  • task_with_two_actions_is_refused: an error naming the task and both keys, with no unknown-field warning or upgrade hint.
  • task_with_one_action_passes_validate: each of exec, bash, echo, and cmdcmd alone still validates.

Verification

  • just ci (macOS): green
  • cross clippy -p mfile --all-targets --target aarch64-unknown-linux-musl --locked -- -D warnings: clean
  • cross test -p mfile -p mctx --target aarch64-unknown-linux-musl --locked: mfile 69 passed, mctx 35 passed (mctx testdata still uses [harness])
  • scripts/clippy-strict.sh "" -p mfile: clean
  • just lint-prose on the two touched docs: no alerts on changed lines

Refs gominimal/inbox#837

Summary by CodeRabbit

  • Configuration
    • Configurations must now use [stack]; [harness] is no longer accepted and produces an unknown-key warning.
  • Task Validation
    • Each task must define exactly one action. Files with multiple actions now fail to load with an error identifying the task and conflicting keys.
  • Documentation
    • Updated migration guidance and configuration and task references to reflect these requirements.

…th two actions

`[harness]` was a serde alias for `[stack]`, which left no trace of the
spelling, so a project using it got no notice before the alias is dropped.
It is now a separate field that deserialization folds into `stack`; the
disk load warns "`[harness]` is deprecated; rename it to `[stack]`", and a
file setting both is an error.

A task with two action keys (e.g. `exec` and `bash`) ran one and reported
the other as an unknown field with an upgrade hint. `File::validate` now
refuses it with "task `both` sets more than one action (exec, bash); set
exactly one". The check runs before the unknown-field warning, so the
upgrade hint no longer fires for an action key.

Refs gominimal/inbox#837
@norrietaylor
norrietaylor requested a review from a team as a code owner October 4, 2026 05:26
@coderabbitai
coderabbitai Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 05ec3da5-a85d-442b-b228-19e9036a30c7
📥 Commits

Reviewing files that changed from the base of the PR and between 8c47366 and 0c23a07.

📒 Files selected for processing (8)
  • crates/mctx/testdata/fake-ancestor/minimal.toml
  • crates/mctx/testdata/fakerepo-with-stack/minimal.toml
  • crates/mfile/src/error.rs
  • crates/mfile/src/lib.rs
  • crates/mfile/src/tasks.rs
  • docs/guide/migrate-to-minimal-session.md
  • docs/reference/minimal-dot-toml.md
  • docs/reference/tasks.md

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The parser no longer accepts [harness] as an alias for [stack]. Task validation now rejects tasks with multiple recognized action keys and reports the task name and keys.

Changes

Stack Table Configuration

Layer / File(s) Summary
Stack table handling
crates/mfile/src/lib.rs, crates/mctx/testdata/*/minimal.toml, docs/guide/migrate-to-minimal-session.md, docs/reference/minimal-dot-toml.md
[harness] is treated as an unknown key, with a warning that points to [stack]. Tests, fixtures, and documentation reflect this behavior.

Task Action Validation

Layer / File(s) Summary
Action keys and error
crates/mfile/src/tasks.rs, crates/mfile/src/error.rs
TaskAction defines the recognized action keys and their mapping to variants. MultipleTaskActions stores the task name and action keys and formats an error message.
Task action validation
crates/mfile/src/lib.rs, docs/reference/tasks.md
File::validate rejects tasks with multiple recognized actions before unknown-field warnings. Tests cover multiple actions and each individual action.

Priority: ⬇️ Low

Estimated code rev 8000 iew effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant FileValidate as File::validate
  participant TaskAction
  participant MultipleTaskActions
  FileValidate->>TaskAction: check recognized action keys
  TaskAction-->>FileValidate: return action key mapping
  FileValidate->>MultipleTaskActions: return error when multiple keys are present
Loading

Suggested reviewers: bryan-minimal

Merge Risk: ⚪ Minimal · up to 0c23a

The validation change and documented configuration behavior are ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title covers both the [harness] change and rejection of tasks with multiple actions. However, it says the deprecated table is warned on, while the final change removes [harness] support and wa…
Description check ✅ Passed The description clearly explains the changes and provides detailed test and verification results. It omits the template’s Checklist section and does not include a BREAKING CHANGE: footer, although r…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the stack table,
And nibbles action keys with care.
One task, one action—that is the rule,
Two keys bring an error there.
The rabbit hops through tests and docs,
Then tucks the change beneath its chair.

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

@minimal-foundry
minimal-foundry Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Approved: every review thread resolved at 0c23a07d9506.

@norrietaylor resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@minimal-foundry minimal-foundry 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.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Comment thread crates/mfile/src/tasks.rs Resolved
Comment thread crates/mfile/src/lib.rs Resolved
@mitodrummer mitodrummer left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approved with one comment around whether we still want to gracefully handle [harness] backwards compat. Code comment says to remove after July 2026

@norrietaylor
norrietaylor commented Oct 5, 2026  8000 226;
Copy link
Copy Markdown
Member Author

approved with one comment around whether we still want to gracefully handle [harness] backwards compat. Code comment says to remove after July 2026

Good catch. I say we remove it. It is a brave new world and the old nomenclature will just breed confusion.

@norrietaylor
Copy link
Copy Markdown
Member Author

/revise as per Karls comment lets remove [harness] backwards comapt

@minimal-foundry
minimal-foundry Bot commented Oct 5, 2026 •
Copy link
Copy Markdown
Contributor

Round 1 of 1 is on this pull request.

branch fix/mfile-harness-deprecation-and-multi-action

Updated 2026-10-05T22:00:34.244Z.

`[harness]` was the pre-v0.5.0 name of `[stack]`, and its removal was
scheduled for after July 2026; that date has passed, so the alias is
gone. A file that still spells the table `[harness]` now warns that the
key is unknown — pointed at `[stack]` through misplaced_top_level_key
instead of the generic upgrade hint — and sets no stack.

The two mctx fixtures that still spelled the table `[harness]` are
renamed, and the reference and migration docs now say the spelling is
no longer accepted.

BREAKING CHANGE: minimal.toml files that spell the stack table
`[harness]` no longer load a stack; the table must be renamed to
`[stack]`.
TaskAction::KEYS and TaskAction::key each enumerated the action keys,
and only key() was enforced by the compiler: adding a TaskAction
variant without also adding its key to KEYS would compile, and
File::validate would silently stop catching that key as a second
action. Both are now generated from the one list in action_keys!,
whose exhaustive match fails to compile when a variant is missing from
it (PR #1938 review).
@minimal-foundry
Copy link
Copy Markdown
Contributor

Round 1 of 1 on a /revise note, pushed as 0c23a07d9506.

No test: line was run.

Review threads the coder judged:

  • 👍 valid — crates/mfile/src/tasks.rs: KEYS and key() are now both generated from the one list in action_keys!, whose exhaustive match fails to compile if a TaskAction variant is missing from it, so the second-action check can no longer go stale.
  • 👍 valid — crates/mfile/src/lib.rs: Removed: [harness] no longer parses — it warns as unknown with a did-you-mean [stack]? pointer, the reference and migration docs say so, and the mctx fixtures still using it were renamed.

On the PR's head, the [harness] backwards compatibility is gone: a minimal.toml that spells the stack table [harness] no longer loads a stack and instead warns "harness is unknown at the top level of minimal.toml; did you mean [stack]?", the mctx fixtures that still used the old spelling are renamed, and TaskAction::KEYS and TaskAction::key() now come from one exhaustive list that fails to compile if a new action variant is left out — with mfile (68) and mctx (43) suites green at the head.

Notes from the agent: Revise round on PR #1938. Per the /revise note and mitodrummer's thread, removed [harness] support entirely: the remote="Self" machinery, the custom Serialize/Deserialize impls, both private fields, the deprecation warning and the two tests pinning the old acceptance; a new test (harness_table_no_longer_parses) pins the removal. New code this round, not a revert: a misplaced_top_level_key arm maps "harness" to "[stack]" so a straggler config gets a did-you-mean pointer instead of the generic upgrade hint. The two mctx fixtures had to be renamed to [stack] or task_inherits_stack would break (the PR's own verification section had flagged them); docs/guide/migrate-to-minimal-session.md was touched although the original PR did not touch it, because its [harness] row said "functionality unchanged", which reads as the spelling still parsing — one clause changed. TaskAction::KEYS changed type from [&'static str; 4] to &'static [&'static str] as part of the single-list change; it was introduced by this PR and has no consumers outside mfile. Could not run on this box: just lint-prose (vale missing) and doctests (rustdoc missing); both are environment gaps, not code failures — the two doc edits are plain declarative sentences and the rustdoc comments changed add no code examples.

@minimal-foundry minimal-foundry 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.

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — mitodrummer crates/mfile/src/lib.rs. No findings.

@minimal-foundry minimal-foundry 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.

minimal-review — approved

Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of 0c23a07d9506 withheld this approval on the threads open then.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 6, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit a19539d Oct 6, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the fix/mfile-harness-deprecation-and-multi-action branch October 6, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0