Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jjuliano
Copy link
Member

@jjuliano jjuliano commented Jun 7, 2025

In this release, the goal it towards a high coverage score for higher robustness and producibility.

jjuliano added 29 commits June 6, 2025 21:54
…s for cmd, data, docker, logging, template, texteditor, version, and workflow packages
…implementations, modify item handling, update ktx constants, improve resource testing, enhance utils functionality, and update workflow implementation
…implementations, modify item handling, update ktx constants, improve resource testing, enhance utils functionality, and update workflow implementation
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Race Condition in Schema Version Retrieval

Replacing sync.Once with sync.Map in SchemaVersion() introduces a race condition. When UseLatest is true, concurrent calls to SchemaVersion() can cause multiple goroutines to simultaneously fetch the schema version via utils.GitHubReleaseFetcher(). This leads to redundant API calls, as the sync.Map caching mechanism does not guarantee single-execution initialization like sync.Once did.

pkg/schema/schema.go#L20-L42

// SchemaVersion(ctx) fetches and returns the schema version based on the cmd.Latest flag.
func SchemaVersion(ctx context.Context) string {
if UseLatest { // Reference the global Latest flag from cmd package
// Try to get from cache first
if cached, ok := versionCache.Load("version"); ok {
return cached.(string)
}
// If not in cache, fetch it
version, err := utils.GitHubReleaseFetcher(ctx, "kdeps/schema", "")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: Unable to fetch the latest schema version for 'kdeps/schema': %v\n", err)
exitFunc(1)
}
// Store in cache
versionCache.Store("version", version)
return version
}
// Use the specified version if not using the latest
return specifiedVersion
}

Fix in Cursor


Bug: Function Pointer Called Without Nil Check

The dr.LoadResourceFn function pointer is called without a nil check. If uninitialized, this will cause a runtime panic, which is inconsistent with other function pointers introduced in this change that include nil checks and fallbacks.

pkg/resolver/resource_http.go#L93-L94

res, err := dr.LoadResourceFn(dr.Context, pklPath, HTTPResource)

pkg/resolver/resources.go#L100-L101

// Load the resource file
res, err := dr.LoadResourceFn(dr.Context, file, Resource)

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@jjuliano jjuliano merged commit 0f4a344 into main Jun 18, 2025
6 checks passed
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.

2 participants