Repository navigation
Conversation
storage_test.go imports the v1 crossplane-runtime test package, while go.mod only requires crossplane-runtime/v2. go test ./pkg/context/... fails on main with a missing go.sum entry for the v1 module. Point the import at the same v2 test package the other tests use, which exposes the identical helpers (test.MockClient, test.NewMockGetFn, ...). Signed-off-by: KTEC0230 <354444639+KTEC0230@users.noreply.github.com>
…re removed With EnableInMemoryContext on, contexts are stored under <ns>/workflow-<name>-context (contextKey), but DeleteInMemoryContext built its key without the namespace, so the keys never matched and nothing was ever removed (kubevela#333): the context of every deleted Application stayed in memory for the life of the controller. Build the delete key through contextKey + generateStoreName, the same helpers the reads and writes use, and drop the now-unused duplicate fmt.Sprintf. The signature change needs the call site in kubevela/kubevela (pkg/controller/core.oam.dev/v1beta1/application/application_controller.go) to pass app.Namespace after a bump, per kubevela#333. Signed-off-by: KTEC0230 <354444639+KTEC0230@users.noreply.github.com>
KTEC0230
requested review from
FogDong,
Somefive,
anoop2811,
briankane,
jerrinfrancis,
jguionnet,
leejanee,
roguepikachu and
wonderflow
as code owners
November 21, 2026 08:29
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.
Description of your changes
Fixes #333
inMemoryContextStorage.DeleteInMemoryContextbuilt its key asworkflow-<name>-contextwithout the namespace, while every other operation keys contexts under<ns>/workflow-<name>-context(contextKey). The keys never matched, so nothing was ever removed: withEnableInMemoryContexton, the context of every deleted Application stayed in memory for the life of the controller.The method now takes the namespace and builds the key through the same
contextKey+generateStoreNamehelpers the reads and writes use; the duplicatefmt.Sprintfis gone. An empty namespace resolves todefault, matching create/get/update.Carried as a separate first commit:
storage_test.goimported the v1crossplane-runtimetest package while go.mod only requirescrossplane-runtime/v2, sogo test ./pkg/context/...failed on main with a missinggo.sumentry. It now points at the v2 package like the other tests (identical helpers), which is required to run the test added here.I have:
Fix:title, PR template, tests included).make reviewableto ensure this PR is ready for review. (Partially:makeis unavailable on this Windows machine. Ran instead:go test ./pkg/context/...,go vet ./...,gofmt,goimports -local github.com/oam-dev/kubevela,go build ./....manifests/helm-doc-genhave no input to regenerate from — no API or chart files touched. staticcheck could not run locally: the pinned v0.8.1 cannot read Go 1.27.4 export data (v5 > v4); CI will cover it.)backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
go test ./pkg/context/...passes, including the newTestDeleteInMemoryContext(namespaced delete, another namespace's context survives, empty namespace resolves todefault). Both commits were checked independently: the test-only first commit passes on its own, and the second commit adds the fix plus the test.go vet ./...,gofmt,goimports -local github.com/oam-dev/kubevelaclean;go build ./...ok.Special notes for your reviewer
The signature change affects the caller in kubevela/kubevela (
pkg/controller/core.oam.dev/v1beta1/application/application_controller.go,MemStore.DeleteInMemoryContext(app.Name)), which needsapp.Namespaceafter a bump, per the sequencing noted in #333. Happy to send that one-line PR once this lands.Summary by cubic
Fixes deletion of in-memory Application contexts.
DeleteInMemoryContextbuilt its lookup key without the namespace, so withEnableInMemoryContexton, the context of every deleted Application stayed in memory for the controller's lifetime. The method now takes the namespace and builds the delete key with the samecontextKey+generateStoreNamehelpers the reads and writes use; an empty namespace resolves todefault, matching create, get, and update.Also unblocks the tests:
storage_test.goimported the v1crossplane-runtimetest package whilego.modrequirescrossplane-runtime/v2, sogo test ./pkg/context/...failed on main. The import now points at the v2 package the other tests use.Migration
kubevela/kubevela(application_controller.go) must passapp.NamespacetoDeleteInMemoryContextwhen bumping.Written for commit 21b43f0. Summary will update on new commits.