refactor: Get the file filter from the invocation context - #171
Merged
danskmt merged 3 commits intoAug 4, 2026
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
danskmt
force-pushed
the
refactor/CLI-1717-file-filter-from-invocation-context
branch
from
August 3, 2026 14:52
de79939 to
efa9fde
Compare
PeterSchafer
reviewed
Aug 3, 2026
danskmt
marked this pull request as ready for review
August 4, 2026 07:56
This comment has been minimized.
This comment has been minimized.
danskmt
force-pushed
the
refactor/CLI-1717-file-filter-from-invocation-context
branch
from
August 4, 2026 09:06
efa9fde to
709bdc0
Compare
This comment has been minimized.
This comment has been minimized.
danskmt
force-pushed
the
refactor/CLI-1717-file-filter-from-invocation-context
branch
from
August 4, 2026 10:10
709bdc0 to
8d6c74f
Compare
This comment has been minimized.
This comment has been minimized.
danskmt
force-pushed
the
refactor/CLI-1717-file-filter-from-invocation-context
branch
from
August 4, 2026 11:15
8d6c74f to
06e07f5
Compare
This comment has been minimized.
This comment has been minimized.
Comment on lines
+184
to
+190
| invocationContext.EXPECT().GetConfiguration().Return(config).AnyTimes() | ||
| invocationContext.EXPECT().GetNetworkAccess().Return(networkAccess).AnyTimes() | ||
| invocationContext.EXPECT().GetEnhancedLogger().Return(&zerolog.Logger{}) | ||
| invocationContext.EXPECT().GetWorkflowIdentifier().Return(workflow.NewWorkflowIdentifier("code")) | ||
| invocationContext.EXPECT().GetUserInterface().Return(ui.DefaultUi()) | ||
| invocationContext.EXPECT().GetEnhancedLogger().Return(&zerolog.Logger{}).AnyTimes() | ||
| invocationContext.EXPECT().GetWorkflowIdentifier().Return(workflow.NewWorkflowIdentifier("code")).AnyTimes() | ||
| invocationContext.EXPECT().GetUserInterface().Return(ui.DefaultUi()).AnyTimes() | ||
| invocationContext.EXPECT().Context().Return(context.Background()).AnyTimes() | ||
| invocationContext.EXPECT().GetAnalytics().Return(analytics.New()) | ||
| invocationContext.EXPECT().GetAnalytics().Return(analytics.New()).AnyTimes() |
There was a problem hiding this comment.
This injects analysisFunc, so GetUserInterface, Context, and GetAnalytics are never called. Can we remove the stubs and keep exact expectations for the context methods EntryPointNative still uses? So we can get rid of the weak AnyTimes() check
This comment has been minimized.
This comment has been minimized.
danskmt
force-pushed
the
refactor/CLI-1717-file-filter-from-invocation-context
branch
from
August 4, 2026 12:29
21e9329 to
769a8aa
Compare
This comment has been minimized.
This comment has been minimized.
PR Reviewer Guide 🔍
|
apzuk3
approved these changes
Aug 4, 2026
danskmt
deleted the
refactor/CLI-1717-file-filter-from-invocation-context
branch
August 4, 2026 13:35
9 tasks
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
What does this PR do?
Takes the file filter from the invocation context instead of building it from separately passed dependencies.
getFilesForPathnow callsinvocationCtx.GetFileFilter(...), so the filter arrives already wired to the invocation's configuration and logger. Any behaviour the framework gates on configuration — such as the ignore-rule metacharacter fix and the tracked-file handling from CLI-1411 — is picked up centrally rather than needing to be plumbed through this repo.To reach that far down the call chain, the analysis seam now carries the invocation context rather than its decomposed parts:
defaultAnalyzeFunctionderives those six dependencies from the context at the top, anddetermineAnalyzeInputandgetFilesForPathtake it in place ofconfigpluslogger.EntryPointNativewas already handing over values it had pulled off the invocation context, so the values reaching the analysis are the same ones as before — only the plumbing changed.net/httpandpkg/analyticsare no longer needed in the file.No behaviour change and no public API change:
OptionalAnalysisFunctionslives underinternal/, so it is not importable outside this module.Where should the reviewer start?
internal/commands/code_workflow/native_workflow.go— the seam, and the three functions that now take the invocation contextinternal/commands/code_workflow/native_workflow_test.go— newtestInvocationContexthelper; itsGetFileFilterbuilds a realFileFilterthe way the framework does, so filtering is exercised rather than stubbedpkg/code/code_test.go— the five injected analysis closures now take(workflow.InvocationContext, string)One test change is worth a look because the compiler cannot catch it: with a custom analysis function injected,
EntryPointNativeno longer callsGetUserInterface()orGetAnalytics()— those are the analysis function's business now. The affected expectations were relaxed to.AnyTimes()rather than removed, since the default path still needs them.What are the relevant tickets?
https://snyksec.atlassian.net/browse/CLI-1717
Checklist
🚨After having merged, please update the
snyk-lsand CLI go.mod to pull in latest client.