Skip to content

feat: basic auth, client/http and the runner API in client - #33

Draft
grubmeshi wants to merge 3 commits into
mainfrom
feature/single-go-bin-runner
Draft

grubmeshi wants to merge 3 commits into
mainfrom
feature/single-go-bin-runner

Conversation

@grubmeshi

@grubmeshi grubmeshi commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Written by AI agent

single-go-bin-runner

building-block-runner moves all its runners into one Go binary. It builds its meshStack client the way the Terraform provider does, through pkg/auth.ResolveClient with its config as a setting source, so it gets the CLI's settings, profiles and OIDC login. This PR adds what the runner needs:

  • Basic auth credential. MESHSTACK_API_USERNAME and MESHSTACK_API_PASSWORD resolve a basic auth credential next to the API key. meshstack login --username stores it in the profile and checks it with one request. An Authorization produces a Credential, which is a BearerToken or a BasicAuth. Basic auth cannot refresh, so a 401 is not retried.
  • client/http. internal/http moves to client/http, so client.New and the other exported client functions no longer take types from an internal/ package and are callable from other modules. A test fails when an exported name of client/... refers to an internal/ type. New client options: WithoutRedirects() and WithRetry(policy), which decides per method on which failures a request is sent again. Without options a client is the shared client with today's behaviour. The runner uses it for the GitHub, GitLab and Azure DevOps APIs.
  • client.Runner. A runner claims a run, then registers as a status source, reports status and downloads or uploads the artifact with the run's token; ForRunUuid reports with the runner's own credentials. A run's implementation is typed, with one pointer per variant as the building block definition has it, decoded from the flat wire format by its type. Input values are decoded by their type, and an INTEGER keeps every digit as *big.Int.

Cross-repo PRs

🤖 Generated with Claude Code

@meshcloud-gh-actions

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

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 5975d78e6bbfb79facb6c59d0312d21b9c858ec3.

Scope Coverage
Unit tests 77.9%
Acceptance tests 52.7%
Combined 79.8%
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:87: meshBuildingBlockRunnerClient.Create 0.0%
... and 133 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/single-go-bin-runner branch from f7111e1 to 73db1b9 Compare October 13, 2026 13:52
@grubmeshi grubmeshi changed the title feat(client): publish the HTTP layer as client/http, with Basic auth feat: basic auth credential and the runner API in client Oct 13, 2026
@grubmeshi
grubmeshi force-pushed the feature/single-go-bin-runner branch from 73db1b9 to ebf91ce Compare October 13, 2026 13:58
@grubmeshi
grubmeshi force-pushed the feature/single-go-bin-runner branch 2 times, most recently from 9ab69a7 to 322b873 Compare October 15, 2026 19:18
@grubmeshi
grubmeshi force-pushed the feature/single-go-bin-runner branch 10 times, most recently from 3a034bf to eb512e3 Compare October 23, 2026 11:53
@grubmeshi grubmeshi changed the title feat: basic auth credential and the runner API in client feat: basic auth, client/http and the runner API in client Oct 23, 2026
grubmeshi and others added 3 commits October 27, 2026 11:33
… is callable

client.New and NewMeshInfoClient took an internal/http.Client, which no
other module can build, and RawClient.DoRequest took its internal
request options. internal/http moves to client/http with a smaller
surface, internal/version to client/types/version, and ListOptions and
Page to client/types, so no exported name of client uses an internal
type. TestPublicApiNamesNoInternalType keeps it that way.

NewClient takes WithoutRedirects and WithRetry, whose RetryPolicy picks
per request which of RetryOnBusy, RetryOnGatewayError and
RetryOnBrokenConnection apply; without options it returns the shared
client as before. WithHeader replaces WithAccept and WithHeaders,
WithBody takes the content type, Send returns the raw response, and an
Error names the method and URL. The client.Authorization alias goes;
the API docs download moves to internal/apidocs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A building block runner claims runs, registers as a status source,
reports status and moves the plan artifact through client.Runner, with
the run token for every request about a run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi
grubmeshi force-pushed the feature/single-go-bin-runner branch from 672c8c5 to 5975d78 Compare October 27, 2026 10:33
@sonarqubecloud

Copy link
Copy Markdown

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