Skip to content

fix: remove promise status block from generated promises - #275

Merged
abangser merged 3 commits into
mainfrom
ab/fix-promise-status-block
Sep 17, 2026
Merged

abangser merged 3 commits into
mainfrom
ab/fix-promise-status-block

Conversation

@abangser

Copy link
Copy Markdown
Member

Status is server-managed and shouldn't exist in a manifest the CLI hands you to kubectl apply. While not a hard failure to include it, the stale block can (and did) drift from the currently-installed Kratix CRD expects, so kubectl apply failed outright with a strict-decoding error in the demos repo.

This fix strips the status key generically at the point of marshaling making it agnostic to future PromiseStatus changes rather than pinning to a specific kratix version or special-casing individual status fields which just reintroduces the same problem the next time PromiseStatus's shape changes.

Test coverage was previously all indirect (golden-file comparisons on init's output); nothing exercised add container, build promise, or update dependencies/api/destination-selector, so this also closes that gap with a couple of fast, local, no-network assertions.

Fixes #274

abangser and others added 3 commits September 15, 2026 11:45
PromiseStatus's Workflows/WorkflowsFailed/WorkflowsSucceeded fields lack
omitempty, so any command that marshals a full Promise struct (init,
build, add container, update api/dependencies/destination-selector)
always wrote a flat status: block, even for a freshly scaffolded
Promise. That block no longer matches the current Kratix CRD and
causes strict-decoding errors on kubectl apply.

Fixes #274

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No functional change — keeps the !splitFile branch first to match
the original code's polarity instead of gratuitously flipping it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a Ginkgo unit test suite for promiseutils.MarshalPromiseWithoutStatus
covering a zero-value status, a populated status, and that the rest of
the Promise round-trips unchanged.

Also extends the existing matchPromise integration test helper (used by
init, build, and update api/dependencies/destination-selector specs) to
assert the raw promise.yaml never has a status key, and adds the same
check to the add-container and update-dependencies flows that don't go
through matchPromise. All added assertions run against local temp dirs
with no network calls, so they're deterministic and fast.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread cmd/update_api.go
}

apiContents := &runtime.RawExtension{Raw: jsonBytes}
var data interface{} = apiContents

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only bit I am concerned about 👀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor looks good 👍

@ChunyiLyu ChunyiLyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Manually tested and saw no 'status: {}'

Comment thread cmd/update_api.go
}

apiContents := &runtime.RawExtension{Raw: jsonBytes}
var data interface{} = apiContents

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor looks good 👍

@abangser
abangser merged commit 7995fad into main Sep 17, 2026
8 checks passed
@abangser
abangser deleted the ab/fix-promise-status-block branch September 17, 2026 12:55
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.

kratix init scaffolds a status block using the removed flat workflows/workflowsFailed/workflowsSucceeded fields

3 participants