Repository navigation
refactor(pipeline): extract pkg/pipeline store from cmd (#326a) - #341
Merged
Merged
Conversation
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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.gotalked to DynamoDB directly in 5 functions (launch/status/collect/list/cancel), with an ad-hocmap[string]interface{}write and mixed map/struct reads. Addedpipeline.Store(in the existingpkg/pipeline, mirroringpkg/alerts.Client: wraps*dynamodb.Client, injectable table name viaNewStore/NewStoreWithTableName) withPut/Get/ListByUser/SetCancelRequested. Rewired all 5 cmd sites to it; removed the now-deadgetStringField/getFloatFieldhelpers.Wire format preserved (the #326 invariant)
The launch write previously marshaled a hand-built
map[string]interface{}; it now marshals the typedPipelineState. Since thepipeline-orchestratorLambda (same module) and dashboard readers share this item format,TestPipelineStore_WireFormatMatchesLegacyMapasserts 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,gofmtclean.pkg/pipeline/store_substrate_test.gopasses against the Substrate emulator: Put/Get round-trip (incl.MaxCostUSDpointer + missing→nil), ListByUser filtering, SetCancelRequested, and the wire-format equivalence check.go test ./cmdgreen (excl. pre-existingTestCatalogValid/ feat(plugin): permissions declaration block (#388) #392).bin/spawn; recursive command+flag tree byte-identical vsmain.Next: pkg/team (#326b), sweep store + collect account-fix (#326c), pkg/bot (#326d).