Skip to content

refactor(pipeline): extract pkg/pipeline store from cmd (#326a) - #341

Merged
scttfrdmn merged 1 commit into
mainfrom
audit/326a-pipeline-store
Jul 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
audit/326a-pipeline-store

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Part of #326 (store-layer extraction, audit #328). First of 4 domain PRs. No behavior change; wire format preserved and asserted.

What changed

cmd/pipeline.go talked to DynamoDB directly in 5 functions (launch/status/collect/list/cancel), with an ad-hoc map[string]interface{} write and mixed map/struct reads. Added pipeline.Store (in the existing pkg/pipeline, mirroring pkg/alerts.Client: wraps *dynamodb.Client, injectable table name via NewStore/NewStoreWithTableName) with Put / Get / ListByUser / SetCancelRequested. Rewired all 5 cmd sites to it; removed the now-dead getStringField/getFloatField helpers.

Wire format preserved (the #326 invariant)

The launch write previously marshaled a hand-built map[string]interface{}; it now marshals the typed PipelineState. Since the pipeline-orchestrator Lambda (same module) and dashboard readers share this item format, TestPipelineStore_WireFormatMatchesLegacyMap asserts the emitted DynamoDB attribute key set is byte-identical to the old map. Table name unchanged (spawn-pipeline-orchestration).

Verification

  • go build ./..., go vet ./cmd ./pkg/pipeline, gofmt clean.
  • New pkg/pipeline/store_substrate_test.go passes against the Substrate emulator: Put/Get round-trip (incl. MaxCostUSD pointer + missing→nil), ListByUser filtering, SetCancelRequested, and the wire-format equivalence check.
  • go test ./cmd green (excl. pre-existing TestCatalogValid / feat(plugin): permissions declaration block (#388) #392).
  • Rebuilt bin/spawn; recursive command+flag tree byte-identical vs main.

Next: pkg/team (#326b), sweep store + collect account-fix (#326c), pkg/bot (#326d).

First of the store-layer extractions (#326). cmd/pipeline.go talked to
DynamoDB directly in 5 functions with an ad-hoc map write and mixed
map/struct reads. Added pipeline.Store (mirrors pkg/alerts.Client:
wraps *dynamodb.Client, injectable table name) with Put/Get/ListByUser/
SetCancelRequested, and rewired launch/status/collect/list/cancel to it.
Removed the now-dead getStringField/getFloatField cmd helpers.

Wire format preserved: the launch write now marshals the typed
PipelineState (was a map[string]interface{}); a substrate test asserts
the emitted DynamoDB attribute set is identical to the old map, so the
pipeline-orchestrator Lambda (same module, shares the struct) and other
readers are unaffected. Table name unchanged (spawn-pipeline-orchestration).

Verified: go build ./..., go vet, gofmt clean; new pkg/pipeline substrate
tests pass (Put/Get/List/Cancel + wire-format equivalence); cmd tests
green; command tree byte-identical vs main.
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 38.79310% with 71 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/pipeline.go 0.00% 49 Missing ⚠️
pkg/pipeline/store.go 67.16% 15 Missing and 7 partials ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 3316582 into main Jul 12, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the audit/326a-pipeline-store branch July 12, 2026 02:37
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