Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
311b717
refactor(di): remove process-global singletons to enable t.Parallel()…
basti-snyk Jun 3, 2026
85e336d
fix: address verification findings in IDE-2036 parallelization refactor
basti-snyk Jun 3, 2026
cf005b9
fix: replace sync.Once with init() for DefaultOpenBrowserFunc in test…
basti-snyk Jun 3, 2026
e74282f
fix: move browser no-op init() to test-only file and fix stale comment
basti-snyk Jun 3, 2026
fb07c6e
fix: restore browser no-op for server tests and clean up lint issues
basti-snyk Jun 3, 2026
b69e4be
fix: add browser_noop_test.go to codelens and oss test packages
basti-snyk Jun 3, 2026
abb0c10
fix: move endpoint env setup before t.Parallel() in smoke tests
basti-snyk Jun 3, 2026
2e26d1a
fix: use os.Setenv for SNYK_API in parallel smoke tests
basti-snyk Jun 3, 2026
0906f32
fix: use TestInit deps struct in Test_GetCodeLensForPath [IDE-2036]
basti-snyk Jun 10, 2026
dd87001
fix: replace t.Setenv with os.Setenv+Cleanup in parallel smoke tests …
basti-snyk Jun 10, 2026
7cc3240
fix: replace t.Setenv with os.Setenv+Cleanup in Test_Concurrent_CLI_R…
basti-snyk Jun 10, 2026
11ab992
style: fix nolint comment alignment in parallelization_test.go [IDE-2…
basti-snyk Jun 10, 2026
794a923
refactor(di): thread CommandService through withContext injection [ID…
basti-snyk Jun 10, 2026
3ebeb24
refactor(server): reduce validateMandatoryDeps cyclomatic complexity …
basti-snyk Jun 10, 2026
d4f4cf7
fix(di): eliminate env race + add per-server ProgressChannel [IDE-2036]
basti-snyk Jun 10, 2026
c3c05ae
style: fix nolint comment placement in smoke test helpers [IDE-2036]
basti-snyk Jun 10, 2026
4195d4f
style: add explanation to gochecknoglobals nolint directives [IDE-2036]
basti-snyk Jun 10, 2026
7c30217
fix: eliminate xdg.ConfigHome race in parallel precedence smoke tests…
basti-snyk Jun 10, 2026
5f479bb
fix: replace t.Setenv with os.Setenv in unauthenticated OrgSelection …
basti-snyk Jun 10, 2026
d4209d4
fix: remove INTEGRATION_ENVIRONMENT dependency from setupTestConfigIs…
basti-snyk Jun 10, 2026
76ad44f
fix: create parent dir in setupTestConfigIsolation before setting Set…
basti-snyk Jun 10, 2026
413d5bd
fix: remove t.Parallel from Test_Concurrent_CLI_Runs — incompatible w…
basti-snyk Jun 10, 2026
d3864ab
refactor(di): add RealDependencies for parallel-safe test DI [IDE-2036]
basti-snyk Jun 10, 2026
2c69250
fix(test): use os.Setenv save-and-restore in Test_SmokeSecretsScan [I…
basti-snyk Jun 10, 2026
a350ef4
fix(test): limit concurrent Code API calls + serialize unmanaged scan…
basti-snyk Jun 11, 2026
6416af1
fix(test): reduce Code API semaphore to 1, extend to SHARD_3 [IDE-2036]
basti-snyk Jun 11, 2026
34f28e9
fix(test): cap=2 semaphore + use SNYK_TOKEN for Code scan precedence …
basti-snyk Jun 11, 2026
1b5965c
fix(test): serialize SHARD_3 Code scans + cap=1 + fix starvation [IDE…
basti-snyk Jun 11, 2026
7e0e263
refactor(context): fix Clone whitelist bug — use context.WithoutCance…
basti-snyk Jun 11, 2026
70982ce
refactor(di,code,context): isolate Code scanner progress channel + de…
basti-snyk Jun 11, 2026
966bc26
fix(code): thread progressChannel into TrackerFactory for full isolat…
basti-snyk Jun 11, 2026
580ae5b
refactor(di): eliminate RealDependencies duplication via buildDepende…
basti-snyk Jun 11, 2026
b8b1d6d
chore(lint): enable gochecknoglobals linter + whitelist existing glob…
basti-snyk Jun 11, 2026
2f42e0c
fix(test,di): eliminate config.Version race + per-server progress cha…
basti-snyk Jun 11, 2026
eb973bb
fix(test): replace CleanupChannels with non-blocking drain to fix par…
basti-snyk Jun 11, 2026
1c42d6d
fix(server): cancel server-lifetime scan context on shutdown to preve…
basti-snyk Jun 11, 2026
35ef636
fix(scanner,iac,oss): fix detached reference scan context + complete …
basti-snyk Jun 11, 2026
d2db8ed
Merge branch 'main' into chore/IDE-2036
basti-snyk Jun 15, 2026
a6817c9
refactor(progress,di,server): eliminate process-global progress chann…
basti-snyk Jun 15, 2026
3e13561
Merge remote-tracking branch 'origin/chore/IDE-2036' into chore/IDE-2036
basti-snyk Jun 15, 2026
0df9634
Merge remote-tracking branch 'origin/main' into chore/IDE-2036
basti-snyk Jun 15, 2026
44966cf
fix(test,lint): Windows scanCtx test path + reflect.Pointer + golangc…
basti-snyk Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,28 @@ brain/
.verify-agent-progress
.pr-review-*.md
.verify-metrics-pending
.verify-complete
.verify-precommit-hash
.verify-agents
.verify-counts
.verify-staged-hash
*_????????_??????_*.log
.snyk-sca-output.json
.snyk-sca-output.err
.snyk-code-output.json
.snyk-code-output.err
.verification-result.*
.security-scan-progress
.security-scan-scope
.verify-staged-diff
.verify-branch-diff
.verify-pr-context
.verify-oracle.json
.verify-oracle.log
.verify-oracle-scope.txt
.verify-triage.json
.verify-source-map.json
.verify-dedup-findings.json
.verify-oracle.pid
.verify-reranked.json
*_implementation_plan.md
10 changes: 10 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ linters:
- exhaustive
- forbidigo
- forcetypeassert
- gochecknoglobals
- gocyclo
- goprintffuncname
- misspell
Expand Down Expand Up @@ -135,6 +136,15 @@ linters:
path: internal/types/config_writers\.go
- linters: [forbidigo]
path: _test\.go
- linters: [gochecknoglobals]
path: _test\.go
- linters: [gochecknoglobals]
path: fake_.*\.go|mock_.*\.go|.*_mock\.go
# govet 'inline' analyzer false-positive on generic stdlib calls (slices.Contains/ContainsFunc);
# analyzer reports "not yet supported" with no available fix.
# Real inline findings (e.g. reflect.Ptr deprecation) are still enforced.
- linters: [govet]
text: "inline: cannot inline: type parameter inference is not yet supported"
paths:
- docs
- licenses
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LDFLAGS_DEV := "-X 'github.com/snyk/snyk-ls/application/config.Development=true'

TOOLS_BIN := $(shell pwd)/.bin

OVERRIDE_GOCI_LINT_V := v2.10.1
OVERRIDE_GOCI_LINT_V := v2.12.2
GOLICENSES_V := v1.6.0
PACT_V := 2.4.2

Expand Down
14 changes: 7 additions & 7 deletions application/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ const (
)

var (
Version = "SNAPSHOT"
LsProtocolVersion = "development"
Development = "true"
LicenseInformation = "License information\n FILLED DURING BUILD"
analyticsPermittedEnvironments = map[string]bool{
Version = "SNAPSHOT" //nolint:gochecknoglobals // package-level constant; cannot use const because it is set at link time
LsProtocolVersion = "development" //nolint:gochecknoglobals // package-level constant; cannot use const because it is set at link time
Development = "true" //nolint:gochecknoglobals // package-level constant; cannot use const because it is set at link time
LicenseInformation = "License information\n FILLED DURING BUILD" //nolint:gochecknoglobals // package-level constant; cannot use const because it is set at link time
analyticsPermittedEnvironments = map[string]bool{ //nolint:gochecknoglobals // effectively a package-level constant — immutable after init
"api.snyk.io": true,
"api.us.snyk.io": true,
}
loggingMu sync.Mutex
currentLogFile *os.File
loggingMu sync.Mutex //nolint:gochecknoglobals // required guard for mutable package state
currentLogFile *os.File //nolint:gochecknoglobals // legacy process-global state
)

// GetLogLevel returns the current zerolog global level as a string.
Expand Down
27 changes: 27 additions & 0 deletions application/di/browser_noop_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* © 2026 Snyk Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Package di — test-only init for DefaultOpenBrowserFunc.
// This file is compiled only into test binaries (suffix _test.go, package di).
// It sets DefaultOpenBrowserFunc to a no-op so that tests never open a real
// browser window, without affecting the production binary.
package di

import "github.com/snyk/snyk-ls/internal/types"

func init() {
types.DefaultOpenBrowserFunc = func(url string) {}
}
299 changes: 178 additions & 121 deletions application/di/init.go

Large diffs are not rendered by default.

50 changes: 46 additions & 4 deletions application/di/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
package di_test

import (
"sync"
"testing"

"github.com/snyk/go-application-framework/pkg/workflow"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/snyk/snyk-ls/application/config"
"github.com/snyk/snyk-ls/application/di"
"github.com/snyk/snyk-ls/internal/testutil"
)
Expand Down Expand Up @@ -48,10 +52,9 @@ func TestDependencies_AllFieldsPopulated(t *testing.T) {
assert.NotNil(t, deps.ScanPersister, "ScanPersister must be set")
assert.NotNil(t, deps.ScanNotifier, "ScanNotifier must be set")
assert.NotNil(t, deps.CodeActionService, "CodeActionService must be set")
// Installer and Initializer are process-lifecycle deps not in di.Dependencies;
// verify their global accessors are still populated after Init.
assert.NotNil(t, di.Installer(), "di.Installer() must be non-nil after Init")
assert.NotNil(t, di.Initializer(), "di.Initializer() must be non-nil after Init")
assert.NotNil(t, deps.Installer, "Installer must be set")
// Initializer is a process-lifecycle dep intentionally absent from di.Dependencies;
// it is only set by di.Init() (production path), not di.TestInit().
}

// TestTestInit_ReturnedDepsAreIndependent verifies that two consecutive TestInit
Expand All @@ -75,3 +78,42 @@ func TestTestInit_ReturnedDepsAreIndependent(t *testing.T) {
assert.NotSame(t, deps1.ErrorReporter, deps2.ErrorReporter,
"each TestInit call must return an independent ErrorReporter, not a shared global")
}

// TestRealDependencies_ParallelSafe confirms that concurrent calls to
// RealDependencies() with separate engines do not race on any shared global
// state. Uses unit-test engines (no network required) because the test is
// exercising constructor isolation, not end-to-end scanning.
func TestRealDependencies_ParallelSafe(t *testing.T) {
t.Parallel()
const N = 3
type pair struct {
engine workflow.Engine
tokenService *config.TokenServiceImpl
}
pairs := make([]pair, N)
for i := range pairs {
e, ts := testutil.UnitTestWithEngine(t)
pairs[i] = pair{engine: e, tokenService: ts}
}

var wg sync.WaitGroup
results := make([]di.Dependencies, N)
for i := 0; i < N; i++ {
wg.Add(1)
go func() {
defer wg.Done()
results[i] = di.RealDependencies(pairs[i].engine, pairs[i].tokenService)
}()
}
wg.Wait()

for i, deps := range results {
require.NotNil(t, deps.Scanner, "Scanner nil for instance %d", i)
require.NotNil(t, deps.Notifier, "Notifier nil for instance %d", i)
require.NotNil(t, deps.AuthenticationService, "AuthService nil for instance %d", i)
for j := i + 1; j < N; j++ {
require.NotSame(t, deps.Notifier, results[j].Notifier,
"instances %d and %d share the same Notifier — global state leak", i, j)
}
}
}
Loading
Loading