Repository navigation
Conversation
…vela#336) DeleteInMemoryContext built its key as "workflow-<app>-context", while every write and read goes through contextKey(name, namespace), which is "<namespace>/workflow-<app>-context". The keys could never match, so the delete was a no-op and the context of a deleted Application stayed in memory for the life of the controller. Take the namespace the same way GetInMemoryContext does and build the key with contextKey and generateStoreName. The KubeVela call site has to pass app.Namespace after it bumps this repo. Signed-off-by: Marcus Beauregard <marcus.beauregard.developer@gmail.com> (cherry picked from commit 593f538) release-0.8 has no kubevela#262, so the store is still a plain map: contextKey is added here and used by getKey, GetInMemoryContext and DeleteInMemoryContext, and the test file is new, carrying only TestDeleteInMemoryContext. Signed-off-by: Brian Kane <briankane1@gmail.com>
briankane
requested review from
FogDong,
leejanee and
wonderflow
as code owners
November 26, 2026 19:42
briankane
requested review from
anoop2811,
jerrinfrancis,
jguionnet and
roguepikachu
as code owners
November 26, 2026 19:42
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-0.8 #343 +/- ##
==============================================
Coverage ? 80.49%
==============================================
Files ? 88
Lines ? 7046
Branches ? 0
==============================================
Hits ? 5672
Misses ? 1374
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Backport of #336 to
release-0.8, for workflow v0.8.0 (KubeVela 1.12.0). The fix is @marcus-beauregard's; the commit keeps him as author and is cherry-picked with-x.What it fixes
DeleteInMemoryContextbuilt its key asworkflow-<app>-context, while every write and read keys the store as<namespace>/workflow-<app>-context. The keys never matched, so the delete did nothing and a deleted Application's context stayed in memory for the life of the controller. It now takes the namespace and builds the key the same way the writes do.How it differs from #336
release-0.8doesn't have #262, so the store is still a plain map rather thanpkg/cache. The intent is unchanged:contextKey(name, ns)is added here (on main it came with Refactor: Migrate optional in-memory context storage to pkg/cache #262), defaulting an empty namespace todefault, andgetKey,GetInMemoryContextandDeleteInMemoryContextall build their keys with it.pkg/context/storage_test.godoesn't exist on this branch, so it's new, with Fix: delete an in-memory context under the key it was stored as #336'sTestDeleteInMemoryContextunchanged and two small helpers for the map-backed store.As on main,
DeleteInMemoryContextnow takes(appName, namespace), so KubeVela's call site has to passapp.Namespacewhen it bumps to this release.Testing
go build ./...andgo vet ./...clean.go test ./pkg/context -run TestDeleteInMemoryContext: passes (deletes the stored context, leaves another namespace's alone, defaults an empty namespace both ways, no-op on a missing key).go test ./pkg/...: everything passes except the two email packages, which fail on macOS arm64 with or without this change (gomonkey can't patch the binary there).Summary by cubic
Fixes
DeleteInMemoryContextso it deletes in-memory contexts under the same key format used by reads and writes.Previously it built the key as
workflow-<app>-contextwhile all other operations used<namespace>/workflow-<app>-context, so the delete never matched and stale contexts lingered in memory for the controller's lifetime. It now takes the namespace and builds the key through the sharedcontextKeyhelper. Callers must passapp.Namespacewhen invoking the method.Written for commit c2bef41. Summary will update on new commits.