Skip to content

bb-run-approve-abort: approve and abort building block runs - #27

Merged
grubmeshi merged 4 commits into
mainfrom
feature/bb-run-approve-abort
Oct 22, 2026
Merged

grubmeshi merged 4 commits into
mainfrom
feature/bb-run-approve-abort

Conversation

@grubmeshi

@grubmeshi grubmeshi commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Written by AI agent

bb-run-approve-abort

Two interactive commands let a person approve or abort a building block run without meshPanel:

  • meshstack buildingblock approve-run <building-block-uuid> shows the plan of the waiting run and asks "Approve this plan? [y/N]". The approval names the predecessor run that made the shown plan, so meshStack answers 409 when the run was planned again. The CLI then asks you to review the new plan.
  • meshstack buildingblock abort-run <building-block-uuid> takes the newest dry run when there is one, else the latest run, shows it and asks "Abort this run? [y/N]". A 409 means the run can no longer be aborted.

Both run only on a terminal, because the decision belongs to a person who saw the run. They follow HAL links only, from the building block to its run and from the run to its actions, and stop before asking when a link is missing. Afterwards they print the building block, because run v1 shows WAITING_FOR_APPROVAL as IN_PROGRESS and ABORTED as FAILED.

The backend, meshcloud/meshfed-release#11281, is released in v2026.43.0.

Reading order

  1. feat(client): the client follows run links; the token goes only to links below the endpoint.
  2. refactor: Prompt.Confirm, now used by profile delete.
  3. feat: approve-run.
  4. feat: abort-run.

For the Terraform provider

Nothing to do on the next bump. The new methods sit on a new Client.BuildingBlockRunAction field, so the mocks keep compiling, and the new Links field is on MeshBuildingBlockRun, which the provider does not map to a schema.

Tests

The acceptance suite here has no terminal, so it cannot drive these commands. The building-block-runner testacc cases TestAccPlanApproval, TestAccStalePlan and TestAccAbort (meshcloud/building-block-runner#86) cover approve and abort end to end. Unit tests cover what those cannot: the token stays below the endpoint, the terminal check, the approve prompt, the approved plan is the shown one, and 409 on approve.

Cross-repo PRs

  • meshcloud/meshstack-cli — this PR
  • meshcloud/meshfed-release#11281 — the approve and abort run endpoints and their links (released)
  • meshcloud/meshfed-release#11282 — the Panel's trigger and abort follow run transparency
  • feat: basic auth, client/http and the runner API in client #33 — stacks on this branch

🤖 Generated with Claude Code

@grubmeshi
grubmeshi force-pushed the feature/bb-run-approve-abort branch from 53f3c58 to 6186f13 Compare October 5, 2026 14:29
@meshcloud-gh-actions

meshcloud-gh-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on a20d6f4da9b15ae60ba64cc519c8abc8f7d42733.

Scope Coverage
Unit tests 78.1%
Acceptance tests 53.7%
Combined 80.1%
Uncovered functions
client/api_key.go:55: meshApiKeyClient.Create 0.0%
client/api_key.go:59: meshApiKeyClient.Read 0.0%
client/api_key.go:63: meshApiKeyClient.Update 0.0%
client/api_key.go:71: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:20: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:33: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:295: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:299: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:71: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:82: DisabledSchedule 0.0%
client/building_block_definition.go:89: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:93: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:97: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:166: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:173: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:177: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:181: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:185: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:100: MeshBuildingBlockType.TagInputTargets 0.0%
client/building_block_definition_version.go:245: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:254: meshBuildingBlockDefinitionVersionClient.Update 0.0%
client/building_block_definition_version_implementation.go:80: MeshBuildingBlockDefinitionImplementation.InferType 0.0%
client/building_block_definition_version_implementation.go:94: MeshBuildingBlockDefinitionImplementation.MarshalJSON 0.0%
client/building_block_definition_version_implementation.go:107: *MeshBuildingBlockDefinitionImplementation.UnmarshalJSON 0.0%
client/building_block_runner.go:82: meshBuildingBlockRunnerClient.Create 0.0%
... and 126 more

covdata func names a method without its receiver, so an entry can belong to an implementation nothing selects rather than to a function the tests never reached. Open the file and line before reading one as a coverage gap.

@grubmeshi
grubmeshi force-pushed the feature/bb-run-approve-abort branch from 6186f13 to 93de0b6 Compare October 14, 2026 19:13
…bort them

The CLI approves and aborts a run through the approve and abort links that
meshStack puts on a run while the caller may take the action. The client
reads a run and its logs from a link, and sends the token only to a link
below the endpoint.

The methods sit on a new Client field, so the mocks of the Terraform
provider keep compiling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi
grubmeshi force-pushed the feature/bb-run-approve-abort branch from 93de0b6 to e0a5d60 Compare October 22, 2026 06:54
grubmeshi and others added 3 commits October 22, 2026 09:06
profile delete asked its question and read the answer itself. The commands
that approve and abort building block runs ask the same way, so the question
moves to the prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gblock approve-run

The command finds the run that waits for approval through the building block,
shows the plan that its predecessor run made, and asks before it approves.
The approval names that predecessor, so meshStack refuses it when the run was
planned again after the person saw the plan. Because the decision belongs to a
person, the command runs only on a terminal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gblock abort-run

The command takes the dry run when it is newer than the latest run, and the
latest run otherwise. It shows the run and asks before it aborts, so it runs
only on a terminal, as approve-run does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi
grubmeshi force-pushed the feature/bb-run-approve-abort branch from e0a5d60 to a20d6f4 Compare October 22, 2026 07:09
@grubmeshi
grubmeshi marked this pull request as ready for review October 22, 2026 07:09
@sonarqubecloud

Copy link
Copy Markdown

@grubmeshi
grubmeshi merged commit a20d6f4 into main Oct 22, 2026
13 checks passed
@grubmeshi
grubmeshi deleted the feature/bb-run-approve-abort branch October 22, 2026 08:12
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.

1 participant