Skip to content

refactor: rename the apply action off "provision" - #36

Merged
NovusEdge merged 1 commit into
mainfrom
rename-apply
Aug 10, 2026
Merged

refactor: rename the apply action off "provision"#36
NovusEdge merged 1 commit into
mainfrom
rename-apply

Conversation

@NovusEdge

@NovusEdge NovusEdge commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Part 1 of the plan (rename → automate → runtimes). Renames the user-facing action from "provision" to "apply" and unifies the two CLI commands on apply.

TUI: the p key reads "apply"; the detail pane is "last apply"; the toasts say "recipes applied" / "recipes already applying"; the cloud-init and no-recipes messages are reworded off "provision".

CLI: stoat apply is the keeper (goes through core.Apply, has --only and the per-VM lock). stoat provision stays as a hidden alias that dispatches to runApply, and runProvision is deleted (confirmed runApply already takes the same lock and writes the same log). up --no-provision becomes --no-apply, with --no-provision a hidden alias. One deliberate behavior change: stoat provision <cloud-vm> now exits 1 with ErrAppliedAtBoot like apply does, instead of the old exit-0 message.

Scope: user-facing only. Internal identifiers (sshx.Provision, WithProvisionLock, NeedsProvision), the last-provision.log filename, the === recipe NAME === marker, and the recipe stage = "provision" schema value stay.

Toast test: TestToastOverlayKeepsScreenShape compared raw rendered width, which the lipgloss v2 compositor shifts by trimming trailing spaces when the footer label width changes. Relaxed to compare each line after trimming trailing spaces, keeping the real invariants (no wrap, no added row).

just check and just test pass. stoat --help shows apply / --no-apply; provision / --no-provision still parse but stay hidden.

Summary by CodeRabbit

  • New Features

    • Added --no-apply to skip applying recipes after starting a VM.
    • Retained --no-provision as a hidden compatibility alias.
    • The hidden provision command now operates as an alias for apply.
  • Improvements

    • Updated CLI, TUI, progress messages, logs, and troubleshooting guidance to use clearer “apply recipes” terminology.
    • Improved messaging for skipped, concurrent, completed, and unavailable recipe applications.
    • Updated help text and detail views to refer to applying recipes.

Every user-facing string now says "apply" instead of "provision": TUI
key hints, toasts, the detail pane title, and CLI progress lines.
Internal identifiers (sshx.Provision, ErrProvisionInProgress, the
last-provision.log filename, the recipe stage schema) stay unchanged;
only parsers and wire formats depend on those.

The CLI drops runProvision and its divergent output strings. `provision`
becomes a hidden command that shares applyCmd's fields and dispatches to
runApply, so it gains --only and matches apply's JSON shape. `up`'s
--no-provision flag is renamed to --no-apply, with --no-provision kept
as a hidden alias for scripts that already pass it.

TestToastOverlayKeepsScreenShape compared rendered lines byte for byte,
which broke on the shorter "apply" footer label: lipgloss v2's
compositor trims trailing whitespace when it draws the toast over a
line, so a label-length change alone shifted trailing spaces without
changing anything visible. The test now trims trailing spaces before
comparing width, keeping the real invariant (no added row, no wrap).
@NovusEdge NovusEdge added the enhancement New feature label Aug 10, 2026
@NovusEdge NovusEdge self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The CLI now uses apply as the primary recipe operation. The hidden provision alias remains supported. Post-start VM behavior, TUI messages, troubleshooting content, and tests use apply terminology.

Changes

Recipe application flow

Layer / File(s) Summary
CLI apply and provision alias
internal/cli/cli.go, internal/cli/grammar.go, internal/cli/*_test.go
The CLI renames NoProvision to NoApply, routes provision through apply, preserves legacy aliases, and hides provision from help output.
Shared apply execution
internal/cli/run_access.go, internal/cli/run_apply.go, internal/core/lock.go
The duplicate provisioning runner and helpers are removed. Apply handles execution, logging, and concurrent-operation responses.
Post-start apply behavior
internal/cli/run_vm.go, internal/cli/run_vm_test.go
Post-start VM handling uses --no-apply and reports recipe application status while retaining skip and concurrency behavior.
TUI and troubleshooting terminology
docs/troubleshooting.md, internal/tui/*
User-facing messages, help text, log labels, troubleshooting content, and related tests use apply terminology. Toast width tests trim trailing spaces before comparison.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • NovusEdge/stoat#12: Modifies the VM recipe provisioning flow, CLI dispatch, logs, and TUI behavior.
  • NovusEdge/stoat#22: Reroutes provisioning through the apply flow and retains sshx.Provision for recipe application.

Poem

A rabbit saw recipes hop into line,
While apply made the workflow shine.
The old name stayed, hidden and small,
New toasts told the tale to all.
“Recipes applied!” the burrow cheered. 🐇

🚥 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 clearly identifies the main change: renaming the user-facing action from “provision” to “apply.”
Docstring Coverage ✅ Passed Docstring coverage is 81.82% 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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename-apply

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@docs/troubleshooting.md`:
- Around line 112-114: Tag the troubleshooting status example’s fenced Markdown
block as text, and update the concurrent-apply message in the TUI app to use
complete wording such as “recipes are already being applied” or the
CLI-compatible “an apply is already running.”

In `@internal/tui/provision.go`:
- Line 81: Update the toast message returned by the provision flow around
showToast to replace “cloud VMs” with “VMs using cloud-init,” preserving the
rest of the warning and its behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f691c0a-015c-42f3-8792-6856c17892bb

📥 Commits

Reviewing files that changed from the base of the PR and between 099bc6c and 639ad5a.

📒 Files selected for processing (16)
  • docs/troubleshooting.md
  • internal/cli/cli.go
  • internal/cli/cli_test.go
  • internal/cli/grammar.go
  • internal/cli/kong_test.go
  • internal/cli/run_access.go
  • internal/cli/run_apply.go
  • internal/cli/run_vm.go
  • internal/cli/run_vm_test.go
  • internal/core/lock.go
  • internal/tui/app.go
  • internal/tui/detail.go
  • internal/tui/keymap.go
  • internal/tui/provision.go
  • internal/tui/provstep_test.go
  • internal/tui/toast_test.go
💤 Files with no reviewable changes (1)
  • internal/cli/run_access.go

Comment thread docs/troubleshooting.md
Comment on lines 112 to 114
```
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to provision
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to apply recipes
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Specify a language for the fenced block.

Add a language tag to the status example so Markdown lint passes and renderers treat it as literal text.

Proposed fix
-```
+```text
 <name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to apply recipes
</details>





</review_comment>
</file_review>

<file_review path="internal/tui/app.go">


<review_comment line_ranges="361-363">
**Use a complete concurrent-apply message.**

`recipes already applying` is grammatically incomplete. Use `recipes are already being applied` or match the CLI wording, `an apply is already running`.

<details>
<summary>Proposed fix</summary>

```diff
-			cmd := m.showToast(msg.name+": recipes already applying", false)
+			cmd := m.showToast(msg.name+": recipes are already being applied", false)

</review_comment>

<review_comment line_ranges="368-368">
LGTM!

</review_comment>

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to provision
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to apply recipes
```
Suggested change
```
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to provision
<name>: installing itself; wait for it to finish and reboot, then stoat notices the install and offers to apply recipes
```
cmd := m.showToast(msg.name+": recipes are already being applied", false)
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 112-112: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 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 `@docs/troubleshooting.md` around lines 112 - 114, Tag the troubleshooting
status example’s fenced Markdown block as text, and update the concurrent-apply
message in the TUI app to use complete wording such as “recipes are already
being applied” or the CLI-compatible “an apply is already running.”

Source: Linters/SAST tools

Comment thread internal/tui/provision.go
// shows the user the refusal before anything starts, instead of
// after a failed attempt.
return m.showToast(v.Name+": cloud VMs provision at first boot via cloud-init. Recipes are applied automatically; recreate the VM to change them", true)
return m.showToast(v.Name+": cloud VMs apply recipes at first boot via cloud-init. Recreate the VM to change them", true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Match the toast wording to the backend condition.

The condition at Lines [68-71] intentionally handles backend=="cloudinit" even when v.Mode=="disk". The toast says “cloud VMs”, which is inaccurate for that reachable state. Use “VMs using cloud-init” so the message matches the condition.

The supplied branch comment confirms that this backend state is reachable.

Proposed wording
-		return m.showToast(v.Name+": cloud VMs apply recipes at first boot via cloud-init. Recreate the VM to change them", true)
+		return m.showToast(v.Name+": VMs using cloud-init apply recipes at first boot. Recreate the VM to change them", true)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return m.showToast(v.Name+": cloud VMs apply recipes at first boot via cloud-init. Recreate the VM to change them", true)
return m.showToast(v.Name+": VMs using cloud-init apply recipes at first boot. Recreate the VM to change them", true)
🤖 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 `@internal/tui/provision.go` at line 81, Update the toast message returned by
the provision flow around showToast to replace “cloud VMs” with “VMs using
cloud-init,” preserving the rest of the warning and its behavior.

@NovusEdge
NovusEdge merged commit 945b332 into main Aug 10, 2026
7 of 8 checks passed
@NovusEdge
NovusEdge deleted the rename-apply branch August 10, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant