Skip to content

feat: show names and states in the plaintext status output - #920

Merged
cchu-ld merged 3 commits into
cchu/aws-devops-2-sso-loginfrom
cchu/aws-devops-3-status
Oct 21, 2026
Merged

cchu-ld merged 3 commits into
cchu/aws-devops-2-sso-loginfrom
cchu/aws-devops-3-status

Conversation

@cchu-ld

@cchu-ld cchu-ld commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

None.

Describe the solution you've provided

  • Problem: The plaintext status output showed the full ARN of each IAM role. The ARN did not tell you if the role was ready.
    • Solution: Each role shows its name and a state.
  • Problem: Each association showed only a service ID and a raw state, such as pending-confirmation. You could not see which service it was.
    • Solution: Each association names its service, for example AWS account 123456789012 or the MCP server name. The state is in plain words, such as ready or waiting for confirmation.
  • Problem: If nothing was set up, the output listed missing roles and gave no next step.
    • Solution: The output says Nothing is set up and names the setup command. It says that only if the account has no roles, no registered services, and no agent spaces, so a registered MCP server still shows.
  • Problem: An agent space can read other AWS accounts. Each of those associations has the service ID aws, so a label from the service ID alone named the wrong account.
    • Solution: status reads the account ID and the account type from the configuration of each AWS account association. Another account shows as Source AWS account <id>.
  • Problem: Service types such as github or remoteagentsigv4 showed as AWS sends them.
    • Solution: Each service type that the SDK knows has a plain name, for example GitHub. Each MCP server type is MCP server. An unknown type shows as AWS sends it.
  • Problem: Scripts read the JSON output, so its fields must not change.
    • Solution: No JSON field changes. The JSON output adds accountId and accountType to each AWS account association.
  • The plaintext output does not show association IDs, because no aws-devops-agent command takes one. The JSON output still has them.

Describe alternatives you've considered

None.

Additional context

Testing: go test ./... and golangci-lint pass on this branch.

🤖 Generated with Claude Code


Note

Overview
Improves human-readable ldcli aws-devops-agent status by restructuring plaintext output into sections (IAM roles, services, agent spaces) with ready/missing role states instead of ARNs, friendly service labels (including MCP servers and multi-account AWS links), and plain-language association states (e.g. waiting for confirmation). When nothing is provisioned—or there are no agent spaces—it points users at ldcli aws-devops-agent setup.

Status data from AWS now populates accountId / accountType on AWS (aws) associations so monitor vs source accounts can be distinguished in output; JSON mode still uses the same printJSON path but association objects can include those optional fields (covered by fixture tests). Broad unit tests lock plaintext formatting and JSON shape.

Reviewed by Cursor Bugbot for commit 17e3475. Bugbot is set up for automated code reviews on this repo. Configure here.

@cchu-ld

cchu-ld commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cchu-ld
cchu-ld requested a review from a team October 20, 2026 18:55
@cchu-ld
cchu-ld marked this pull request as ready for review October 20, 2026 18:55
@cchu-ld
cchu-ld requested a review from a team as a code owner October 20, 2026 18:55
@cchu-ld
cchu-ld requested review from nieblara and removed request for a team October 20, 2026 18:55
@cchu-ld
cchu-ld force-pushed the cchu/aws-devops-3-status branch from ab0787c to aa3c980 Compare October 20, 2026 19:02
@cchu-ld
cchu-ld removed this pull request from stack #926 October 20, 2026 19:13
@cchu-ld
cchu-ld added this pull request to stack #929 October 20, 2026 19:13
assert.True(t, strings.HasSuffix(trimmed, awsdevops.ConsoleURL("us-east-1")), "output must end with the console URL")
}

func TestStatusEmptyNamesSetupCommand(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The status code is correct, but three faults pass every test in cmd/aws_devops_agent and internal/awsdevops. I tried each one in a worktree.

  1. Replace the empty-account condition at status.go:63 with if false. Tests pass. TestStatusEmptyNamesSetupCommand checks for the setup command, the account ID, and the console URL, but the "No agent spaces. Run ldcli aws-devops-agent setup." line also has them. Suggest: assert "Nothing is set up" and assert that "IAM roles:" is absent.
  2. Change anyRole (status.go:59-62) to "all roles exist". Tests pass. No test has one role ready with no services and no spaces. With this fault, a half-finished setup prints "Nothing is set up" and hides the role. Suggest: a test with roles [ready, missing] and nothing else.
  3. Make plainState return "" for pending-confirmation, or return the raw value for invalid. Tests pass. TestStatusAssociationShowsPlainState only asserts that the raw words are absent. Suggest: assert "waiting for confirmation", and add invalid and empty cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Commit 68672dd4 adds tests for all three faults. I ran each fault again, and each one now fails a test.

  1. TestStatusEmptyNamesSetupCommand now asserts "Nothing is set up. Run ldcli aws-devops-agent setup." and asserts that "IAM roles:" is absent.
  2. TestStatusOneRoleShowsTheRoles has roles [ready, missing] and nothing else. It asserts that "Nothing is set up" is absent and that each role shows its state.
  3. TestStatusAssociationShowsPlainState now asserts "waiting for confirmation". TestStatusPlainStateNamesEachState covers valid, invalid, pending-confirmation, an empty state, and an unknown state.

This reply is from Claude.

@Andrewjeska

Copy link
Copy Markdown
Contributor

Two notes from a pass through this PR — both minor but worth catching before it lands.

1. serviceLabel misses the vendor-specific MCP server enums

Besides mcpserver, the SDK enum includes mcpservernewrelic, mcpserverdatadog, mcpserversplunk, mcpservergrafana, mcpserversigv4. They'll render as e.g. "LaunchDarkly mcpservernewrelic (s-ld01)". Consider strings.HasPrefix(kind, "mcpserver") → "MCP server", or a small map, so added vendor-specific service types don't leak the enum string.

2. The JSON golden fixture skips the two fields most likely to be edited

The testdata/status.json fixture leaves operatorAppEnabled and missingSetup at zero values. Those are the two JSON fields most likely to be edited in a follow-up PR. The test — whose stated purpose is to lock the JSON shape — won't notice if someone renames or re-tags either. Either add a second fixture that sets OperatorAppEnabled: true and a non-empty MissingSetup, or extend realisticStatus() so this one does.

via LD Research 🤖

@cchu-ld
cchu-ld force-pushed the cchu/aws-devops-3-status branch 4 times, most recently from e42b508 to 0eec8ae Compare October 21, 2026 18:10
@cchu-ld

cchu-ld commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@Andrewjeska, thank you. Commit 68672dd4 addresses both points.

  1. serviceLabel now uses strings.HasPrefix(kind, "mcpserver"), so each vendor type is "MCP server". The service name tells the vendor, for example "Datadog MCP server (s-ld01)". TestStatusVendorMCPServerHasPlainLabel covers mcpserverdatadog.
  2. TestStatusJSONUnchanged now has a second fixture, testdata/status-partial.json. It is a setup that did not finish, with one missing role and a non-empty missingSetup. operatorAppEnabled comes in feat: read agent space ownership and operator app state #927, and testdata/status.json sets it to true there. Commit 57bbce97 on feat: read agent space ownership and operator app state #927 adds "operatorAppEnabled": false to the partial fixture, so the test covers both values.

This reply is from Claude.

cchu-ld and others added 3 commits October 21, 2026 14:32
The status command names each role with a state, not an ARN. Each
association names its service, not only the service ID. If nothing is
set up, the output names the setup command. The JSON output does not
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK has one service type for each MCP server vendor, for example
mcpserverdatadog. The status output now calls each of them an MCP server.

New tests cover the empty account, an account with only one ready role,
each association state, and the JSON fields that a partial setup sets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An agent space can read other AWS accounts. Each of those associations
has the service ID "aws", so the status output showed the account that
ran the command on every one of them. GetStatus now reads the account ID
and the account type from the configuration of the association. The
output names the account, and calls another account a source account.

The status output also gives a plain name to each service type that the
SDK knows, for example GitHub or PagerDuty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cchu-ld
cchu-ld force-pushed the cchu/aws-devops-3-status branch from 17e3475 to 1f768f4 Compare October 21, 2026 21:32
@cchu-ld
cchu-ld merged commit 4d695a6 into main Oct 21, 2026
8 checks passed
@cchu-ld
cchu-ld deleted the cchu/aws-devops-3-status branch October 21, 2026 21:33
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.

4 participants