Skip to content

feat: trigger a building block run from the CLI - #11

Draft
JohannesRudolph wants to merge 1 commit into
feat/cli-bb-run-logsfrom
feat/buildingblock-trigger-run
Draft

JohannesRudolph wants to merge 1 commit into
feat/cli-bb-run-logsfrom
feat/buildingblock-trigger-run

Conversation

@JohannesRudolph

Copy link
Copy Markdown
Member

Adds meshstack buildingblock trigger-run <uuid> [--dry-run] [-o yaml|ndjson].

Why: agents and scripts can ask meshStack for a run without a local OpenTofu, e.g. after pushing a fix to a draft definition's branch. The command does not wait and approves nothing. If the definition has approval gates, a human approves in meshPanel.

It writes the building block meshStack answers with (202). The run starts asynchronously, so status.latestRunUuid may still name the previous run. A log line points to meshstack buildingblockrun list --building-block <uuid>.

Client: new TriggerRunWith(ctx, uuid, request). TriggerRun keeps its signature. The provider's mock needs the new method on the next subtree sync.

Stacked on #10.

🤖 Generated with Claude Code

Add `meshstack buildingblock trigger-run <uuid> [--dry-run]`. It asks
meshStack to run a building block and writes the building block that
meshStack answers with. --dry-run asks for a DETECT run.

This lets agents and scripts start a run without a local OpenTofu, for
example after a fix is pushed to a draft definition's branch. The
command does not wait for the run and does not approve anything.
Approval stays with humans in meshPanel.

The client gets TriggerRunWith, which takes the dryRun flag and returns
the answered building block. TriggerRun keeps its signature and calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meshcloud-gh-actions

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 8fb6ccaf9e2f03a630aff64f5b0e6829c2c99101.

Scope Coverage
Unit tests 58.3%
Acceptance tests 14.3%
Combined 58.5%
Uncovered functions
client/api_key.go:48: meshApiKeyClient.Create 0.0%
client/api_key.go:52: meshApiKeyClient.Read 0.0%
client/api_key.go:56: meshApiKeyClient.Update 0.0%
client/api_key.go:60: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:21: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:34: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:50: ApiKeyPermissions.MarkdownString 0.0%
client/api_key_permissions.go:226: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:231: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:73: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:84: DisabledSchedule 0.0%
client/building_block_definition.go:91: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:96: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:101: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:155: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:162: meshBuildingBlockDefinitionClient.ListSeq 0.0%
client/building_block_definition.go:169: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:173: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:177: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:181: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:101: TagInputTargetsFor 0.0%
client/building_block_definition_version.go:247: meshBuildingBlockDefinitionVersionClient.List 0.0%
client/building_block_definition_version.go:253: meshBuildingBlockDefinitionVersionClient.ListSeq 0.0%
client/building_block_definition_version.go:259: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:268: meshBuildingBlockDefinitionVersionClient.Update 0.0%
... and 170 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.

}

func (c meshBuildingBlockV2Client) TriggerRun(ctx context.Context, bbUuid string) (err error) {
// MeshBuildingBlockV2TriggerRunRequest is the body of a trigger-run. DryRun asks for a DETECT run,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

remove useless comment, these are already covered by API docs authoritatively and should not be restated in the clinet code

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