DRAFT [Feat] Compiler Context to Support Compositions#126
Draft
briankane wants to merge 1 commit intokubevela:mainfrom
Draft
DRAFT [Feat] Compiler Context to Support Compositions#126briankane wants to merge 1 commit intokubevela:mainfrom
briankane wants to merge 1 commit intokubevela:mainfrom
Conversation
Signed-off-by: Brian Kane <briankane1@gmail.com>
9c569c1 to
2792b6f
Compare
This was referenced Nov 20, 2025
jguionnet
reviewed
Nov 20, 2025
Collaborator
jguionnet
left a comment
There was a problem hiding this comment.
ask the gokarna team for review
I included 3 comments that make sense to me from AI review. 1 below and 2 inline
Consider renaming package from context to compilercontext (or similar) to avoid confusion with stdlib.
| func (in *Compiler) CompileStringWithOptions(ctx context.Context, src string, opts ...CompileOption) (cue.Value, error) { | ||
| func (in *Compiler) CompileStringWithOptions(ctx context.Context, src string, opts ...interfaces.CompileOption) (cue.Value, error) { | ||
| var err error | ||
| compilercontext.WithCompiler(ctx, in) // set context for nested compilations |
Collaborator
There was a problem hiding this comment.
// Store compiler in context for nested compilations; capture returned ctx.
ctx = compilercontext.WithCompiler(ctx, in)
| cueCtx := compilercontext.GetCueContext(ctx) | ||
| if cueCtx == nil { | ||
| cueCtx = cuecontext.New() | ||
| compilercontext.WithCueContext(ctx, cueCtx) // set the cue context for nested compilations |
Collaborator
There was a problem hiding this comment.
ctx = compilercontext.WithCueContext(ctx, cueCtx)
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.
Related KubeVela changes: kubevela/kubevela#6989
Summary by cubic
Added a compiler context to share the Cue context and compiler across nested compilations. This enables compositions to reuse state and resolve provider functions reliably.
New Features
Migration
Written for commit 2792b6f. Summary will update automatically on new commits.