Skip to content

feat(snapshot ecs): add a hidden --generic flag - #1433

Merged
JonJagger merged 2 commits into
mainfrom
feat/snapshot-ecs-generic
Dec 1, 2026
Merged

JonJagger merged 2 commits into
mainfrom
feat/snapshot-ecs-generic

Conversation

@JonJagger

@JonJagger JonJagger commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

A new runtime should need only a reporter, not a server release. The first step: snapshot ecs --generic sends a version 1 report (a workload per service, an instance per task, a component per container) to the route every environment type shares. It keeps data the typed report drops: container names, service ARNs, and per-task images in a rollout. Like the typed report, it sends running tasks only.

The server reduces it to the typed report, so snapshots do not change (kosli-dev/server#8456). On cyber-dojo ECS the reduced dry run equals the typed one, and a local server made no new snapshot for it.

All new code sits in new files, reached only with the flag; the typed path is untouched bar the flag and one branch.

Checklist

  • Docs are autogenerated from CLI help — make sure the help text reflects your changes (n/a: --generic is hidden, so the help and docs are unchanged)
  • Helm chart (charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR (n/a: the k8s reporter is untouched)
  • Terraform provider and related changes (terraform-provider-kosli, terraform-aws-kosli-reporter) updated, if needed (n/a: they run the typed command, which is unchanged)

A new runtime should need only a reporter, not a server
release. The first step: snapshot ecs --generic sends a
version 1 report (a workload per service, an instance per
task, a component per container) to the route every
environment type shares. It keeps data the typed report
drops: container names, service ARNs, per-task images in a
rollout, and tasks not running, with their status.

The server reduces it to the typed report, so snapshots do
not change (kosli-dev/server#8456). On cyber-dojo ECS the
reduced dry run equals the typed one, and a local server
made no new snapshot for it.

All new code sits in new files, reached only with the flag;
the typed path is untouched bar the flag and one branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added go Pull requests that update go code feat labels Dec 1, 2026
@claude

claude Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @JonJagger's task in 1m 38s —— View job


Follow-up review complete

  • Fetch prior review comments on PR feat(snapshot ecs): add a hidden --generic flag #1433
  • Diff a29f441d..bb9253e4 (the new commit) and read touched hunks
  • Check status of each prior finding against the new commit
  • Resolve/close addressed inline threads (already resolved on GitHub, no action needed)
  • Flag any new bugs/regressions introduced by the fix, within changed lines only (none found)
  • Post summary comment

Summary (full detail posted separately: #1433 (comment)):

  1. Stopping tasks never reach the page — Resolved. ecsWorkload now filters to LastStatus == "RUNNING" after DescribeTasks; non-running tasks are dropped entirely, the draining-task test case was removed, and platform_status was dropped from the report.
  2. Workload components from an arbitrary first task — Resolved. Components are now read from running[0] after filtering to RUNNING tasks; the test now places a pending task before a running one to prove the pending one is skipped.
  3. Sequential per-service fetching (nit) — Not addressed, deliberately deferred by the author while --generic is hidden.
  4. Superfluous else (nit) — Not addressed, deliberate style choice.

No new bugs found in the changed lines. One spot checked closely: ecsInstance now formats task.StartedAt with no nil guard, but it's only called with tasks already filtered to RUNNING, and AWS always sets startedAt by then — safe under the new invariant.

Comment thread internal/aws/ecs_generic.go Resolved
Comment thread internal/aws/ecs_generic.go Resolved
Comment thread internal/aws/ecs_generic.go Resolved
Comment thread internal/aws/ecs_generic.go Resolved
ListTasks lists only tasks whose desired status is RUNNING,
so a draining task is never seen, and an instance is a
running copy of a workload in the v1 report. So --generic
sends RUNNING tasks only, as the typed report does, with no
platform_status; the workload components come from the
first running task (review comments 1 and 2).

The empty-flag audit now covers snapshot ecs --generic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JonJagger
JonJagger enabled auto-merge (squash) December 1, 2026 12:31
@claude

claude Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review of bb9253e (a29f441d..bb9253e4)

Status of prior findings from the previous review:

  1. Stopping tasks never reach the page (ListTasks defaults to desiredStatus=RUNNING) — Resolved. ecsWorkload now filters to tasks with LastStatus == "RUNNING" after DescribeTasks, so non-running tasks (draining/deactivating/pending) are dropped entirely rather than mis-reported. The draining-task test case was removed and platform_status was dropped from the report (server no longer needs it per kosli-dev/server#8574e0031).
  2. Workload components taken from an arbitrary first task — Resolved. Tasks are filtered to RUNNING before indexing running[0] for components, so a PENDING/not-yet-pulled task can no longer become the workload's component source. TestEcsWorkloadTaskNotRunning now puts the pending task first and a running task second to prove it's skipped.
  3. Sequential per-service fetching (concurrency, nit) — Not addressed; acknowledged as an intentional deferral while --generic stays hidden (bounded concurrency to come before it's unhidden).
  4. Superfluous else after return (nit) — Not addressed; deliberate style choice (if/else kept for visibility of both branches).

New issues in the changed lines (internal/aws/ecs_generic.go, internal/aws/ecs_generic_test.go, internal/envreport/envreport.go): none. Note ecsInstance now formats task.StartedAt unconditionally with no nil check, but it's only ever called with tasks already filtered to LastStatus == "RUNNING", and AWS always sets startedAt once a task reaches RUNNING, so this is safe given the new invariant.

All four review threads are already marked resolved on GitHub — no action needed there.

View job run

@JonJagger
JonJagger merged commit 40d29bc into main Dec 1, 2026
27 checks passed
@JonJagger
JonJagger deleted the feat/snapshot-ecs-generic branch December 1, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants