Skip to content

Fix AppStack.TemplateURL empty-release guard (#269) - #270

Open
blsmth wants to merge 2 commits into
mainfrom
fix/269-templateurl-empty-release
Open

blsmth wants to merge 2 commits into
mainfrom
fix/269-templateurl-empty-release

Conversation

@blsmth

@blsmth blsmth commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #269.

What: AppStack.TemplateURL now guards release != nil && *release != "", matching the other seven stacks. Adds stacks/template_url_test.go: a table test over all eight implementations (nil / "" / "canary"), plus an AST-based check that fails if any type declaring TemplateURL is missing from the table, so a ninth stack with the wrong guard can't slip in.

Why: an empty release turned /latest/ into //, a URL CloudFormation rejects. Currently masked because cmd/upgrade.go leaves the shared release flag var as "latest". Flag defaults are intentionally untouched.

Before fix (go test ./stacks -run TemplateURL):

--- FAIL: TestTemplateURLConsistentAcrossStacks
    --- FAIL: .../AppStack/empty_release
FAIL	github.com/apppackio/apppack/stacks

Only AppStack/empty_release failed; the other 23 cases passed.

After fix: ok github.com/apppackio/apppack/stacks; make test exit 0.

make fmt/make lint can't run locally (golangci-lint built with go1.26, config targets 1.27.1); I ran gofmt on the changed files instead.

AppStack only guarded release != nil, so an empty release rewrote
/latest/ to //. Masked today by upgrade.go's flag default. Add a
table test asserting all eight TemplateURL implementations agree, plus
an AST check that fails if a new TemplateURL type is not in the table.
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.

AppStack.TemplateURL missing empty-release guard; masked by shared flag state

1 participant