feat: add runtime read-only control-plane commands#1797
Conversation
Add CLI-only get and list commands for runtimes, runtime versions, and runtime endpoints with Harness-style pagination, output, injected Core clients, fixtures, and command coverage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #1797 +/- ##
============================================
+ Coverage 93.61% 93.92% +0.30%
============================================
Files 117 128 +11
Lines 6708 7066 +358
============================================
+ Hits 6280 6637 +357
- Misses 428 429 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AlexanderRichey
left a comment
There was a problem hiding this comment.
Great work on this. I think we should make two changes before merging. First, I think runtime should show in the RouterScreen, even though the TUI isn't there yet. I don't think it's worth it to carve out a special case for runtime when, in the next CR, we'll have to reverse it. Second, I think we should streamline the tests to be more consistent. We now have run(), which manually sets up mocks, and runFixture(), which returns golden file mocks. Let's only use the golden file testing pattern, if possible. So run() should become what runFixture() is and we'll just have to generate fixtures for the couple missing cases. You might have to just create a bunch of runtimes, versions, and endpoints to make this work easily when running the tests in record mode.
| () => command.commands.map((c) => ({ name: c.name(), description: c.description() })), | ||
| () => | ||
| command.commands | ||
| .filter((command) => command.name() !== "runtime") |
There was a problem hiding this comment.
I understand that we haven't built the TUI for Runtime yet, but still I don't think it's worth introducing this edge case. After we build the TUI in the next CR, the original code will work as intended. Even now, I think what would happen is that the help screen would be shown, which is also fine for now.
|
|
||
| export function createRuntimeVersionHandler(core: Core, io: AppIO): Router { | ||
| return new Router("version", "inspect AgentCore Runtime versions") | ||
| .default(createHelpDefault(io)) |
There was a problem hiding this comment.
This makes sense for now, but it will be replaced by withTui().
| const frame = r.lastFrame()!; | ||
| expect(frame).toContain("harness"); | ||
| expect(frame).toContain("manage agentcore harnesses"); | ||
| expect(frame).not.toContain("runtime"); |
There was a problem hiding this comment.
I think we want the main screen to show runtime.
| describe("runtime control reads", () => { | ||
| test("gets a Runtime and renders the complete response", async () => { | ||
| const result = await run(["runtime", "get", "--id", "runtime-1"]); | ||
|
|
There was a problem hiding this comment.
Is there a reason why we're not doing golden file testing for some of these cases? I think that would be both simpler and more robust.
Description
Adds project-free, command-line access to inspect AgentCore Runtimes:
runtime getandruntime listruntime version getandruntime version listruntime endpoint getandruntime endpoint listThe commands follow the Harness handler/Core structure, use the existing JSON output path, and expose one-page pagination through
--max-resultsand--next-token. Endpoint lookup uses--qualifier, mapped to the control-planeendpointName.Runtime remains hidden from the current TUI, and bare Runtime groups print help. Runtime TUI workflows, invocation, mutations, project or deployment resolution, tags and policies, agent-card operations, logs, and traces are outside this change.
Related Issue
N/A
Documentation PR
N/A. README command examples are included in this PR.
Type of Change
Testing
Verified from current HEAD
e63739e6:bun test --coverage --coverage-reporter=lcov(263 passed, 0 failed)bun test src/handlers/runtime src/core(39 passed, 0 failed)bun run lint:checkprettier --check src/handlers/runtime/runtime.test.tsxbun run typecheckbun run buildAdditional verification from production-equivalent commit
22634e54:bun run format:checkbun auditbun pm packbun run compileruntime logsandruntime tracesgroupsus-west-2Live verification used an existing Runtime and did not create, invoke, update, or delete resources. Commit
e63739e6changes tests only, so the production implementation is unchanged from that verification.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.