Repository navigation
fix(mfile): warn on the deprecated harness table and refuse a task with two actions - #1938
Conversation
…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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
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. 📝 WalkthroughWalkthroughThe parser no longer accepts ChangesStack Table Configuration
Task Action Validation
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
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The validation change and documented configuration behavior are ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit checks the stack table, Comment |
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
There was a problem hiding this comment.
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. |
|
/revise as per Karls comment lets remove [harness] backwards comapt |
|
Round 1 of 1 is on this pull request. branch Updated 2026-10-05T22:00:34.244Z. |
…recation-and-multi-action
`[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).
…recation-and-multi-action
|
Round 1 of 1 on a /revise note, pushed as No Review threads the coder judged:
On the PR's head, the Notes from the agent: Revise round on PR #1938. Per the /revise note and mitodrummer's thread, removed |
There was a problem hiding this comment.
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.
Summary
Two
minimal.tomlvalidation gaps incrates/mfile:[harness]parsed silently. It was a serdealiasfor[stack], and an alias leaves no trace of which spelling was used, so nothing could warn before the alias is removed.harnessis now a separate, never-serialized field.File'sDeserializeimpl (via#[serde(remote = "Self")], so every load path is covered: disk, bytes, and wire) moves it intostackand records that the deprecated spelling was used.warn_unknown_fieldsthen warns once: "[harness]is deprecated; rename it to[stack]in minimal.toml". A file that sets both[stack]and[harness]is an error.TaskActionis flattened intoTask, so serde takes one action key and the other lands inTask::extra. It was then reported asunknown fields in task <name>: execwith the "update to a newer version of minimal?" hint.File::validatenow refuses the task with the newError::MultipleTaskActions: "taskbothsets 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 fromtasks.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 samestackas[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_errortask_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 ofexec,bash,echo, andcmdcmdalone still validates.Verification
just ci(macOS): greencross clippy -p mfile --all-targets --target aarch64-unknown-linux-musl --locked -- -D warnings: cleancross 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: cleanjust lint-proseon the two touched docs: no alerts on changed linesRefs gominimal/inbox#837
Summary by CodeRabbit
[stack];[harness]is no longer accepted and produces an unknown-key warning.