Skip to content

fix: keep CLI-owned retry paths at the application layer [IDE-1890] - #7116

Open
basti-snyk wants to merge 1 commit into
mainfrom
feat/IDE-1890-cli-retry-path-defaults
Open

fix: keep CLI-owned retry paths at the application layer [IDE-1890]#7116
basti-snyk wants to merge 1 commit into
mainfrom
feat/IDE-1890-cli-retry-path-defaults

Conversation

@basti-snyk

@basti-snyk basti-snyk commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

  • declare the CLI's unsafe-method retry paths at the CLI application boundary
  • preserve user-supplied path overrides and keep network retries opt-in
  • pin go-application-framework to the unmerged ownership change

Dependency

This draft pins go-application-framework commit 102bfe6ddf2e17c02e5e878ab3744dc296071e23 (v0.14.2-0.20260812074653-102bfe6ddf2e) from go-application-framework #686, which carries current GAF main so module resolution stays tidy. Do not merge this PR until #686 merges and releases; the dependency reference must then be updated to the released GAF version.

Tracking: IDE-1890

Verification

  • targeted CLI application configuration and engine tests pass
  • golangci-lint run ./... passes
  • public CLI build passes
  • Snyk Code reports no new issues
  • full Go suite was run; unrelated existing assertions in GAF presenter snapshots and CLI instrumentation scrubbing are not caused by this configuration-only diff

PR Type

Enhancement, Tests


Description

  • Add CLI-specific retry paths for core endpoints.

  • Update go-application-framework dependency to v0.17.0.

  • Enhance test coverage for network retry mechanisms.


Diagram Walkthrough

flowchart LR
  A["CLI Core (main.go)"] --> B("Configuration");
  B --> C{"Add Default Retry Paths"};
  A --> D("Update Dependency");
  D --> E("go-application-framework v0.17.0");
  F["Acceptance Tests"] --> G("Test GAF retries");
  F --> H("Test exit code with timeouts");
Loading

File Walkthrough

Relevant files
Enhancement
2 files
configuration.go
Define default network request retry allowed paths             
+26/-0   
main.go
Register default retry paths in CLI configuration               
+1/-0     
Dependencies
4 files
go.mod
Update go-application-framework dependency                             
+1/-1     
go.sum
Update go-application-framework checksums                               
+2/-2     
go.mod
Update go-application-framework dependency                             
+1/-1     
go.sum
Update go-application-framework checksums                               
+2/-2     
Tests
3 files
gaf-retry-allowed-paths.spec.ts
Add tests for GAF retry on feature flag evaluation             
+132/-0 
exitcode.spec.ts
Make exit code timeout test deterministic                               
+43/-2   
main_test.go
Add unit and integration tests for retry paths                     
+43/-0   
Miscellaneous
1 files
.gitleaksignore
Add exit code spec to gitleaksignore                                         
+1/-0     

@snyk-io

snyk-io Bot commented Aug 12, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch 2 times, most recently from fea402b to 15e0c70 Compare August 12, 2026 08:14
@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from 15e0c70 to 3b2e3c8 Compare August 20, 2026 14:22
@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (85fed6a)

@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (85fed6a)

@basti-snyk
basti-snyk marked this pull request as ready for review August 21, 2026 06:37
@basti-snyk
basti-snyk requested a review from a team as a code owner August 21, 2026 06:37
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (91fb301)

@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (91fb301)

@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from 91fb301 to e5bc501 Compare August 21, 2026 06:58
@snyk-pr-review-bot

This comment has been minimized.

@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from e5bc501 to 060c8d9 Compare August 21, 2026 07:01
@snyk-pr-review-bot

This comment has been minimized.

@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from 060c8d9 to 264bf88 Compare August 21, 2026 07:04
@snyk-pr-review-bot

This comment has been minimized.

@robertolopezlopez robertolopezlopez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking this PR as GAF 0.17.0 changed timeout behaviour.

Once GAF is fixed + released, dependency in CLI is bumped and acceptance CI is happy, we can unlock this

@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from 264bf88 to 4d1fec2 Compare August 21, 2026 09:41
@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (4d1fec2)

@snyk-pr-review-bot

This comment has been minimized.

@basti-snyk

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (4d1fec2)

Comment on lines 65 to 74
it('Correct exit code when snyk_timeout_secs expires', async () => {
// Response delay exceeds the watchdog's kill window (timeout + grace period), so
// the CLI is always force-killed before any response can arrive -- deterministic
// regardless of how many retries GAF performs underneath.
server.setResponseDelay(10000);

const testEnv = {
...process.env,
SNYK_TIMEOUT_SECS: '1',
...baseEnv,
SNYK_TIMEOUT_SECS: '5',
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this change? I don't think this should be changed.
If the test was failing and this was an attempt to get it to pass, please discard these changes. There is an incident in Slack regarding this, and the failure was due to a rollout of another team.

GAF 0.17.0 narrowed its default network-retry allow-list to only
oauth2/token. Add the paths the CLI relied on as implicit free
defaults before that change (test-dep-graph, verify/token,
feature_flags/evaluation) so unsafe-method requests to them keep
retrying on transient failures.

Also includes go.sum cleanup from `make tidy` removing stale
checksums for the superseded go-application-framework v0.16.1.

Add an acceptance test proving GAF retries feature_flags/evaluation
on a transient failure, and make the snyk_timeout_secs exit-code
test deterministic (it previously raced real backend network timing
against the retry policy).
@basti-snyk
basti-snyk force-pushed the feat/IDE-1890-cli-retry-path-defaults branch from 4d1fec2 to 1fe9e3d Compare August 21, 2026 12:43
@basti-snyk

Copy link
Copy Markdown
Contributor Author

Update: the acceptance-tests failures blocking this PR (SNYK_TIMEOUT_SECS exit-code test racing real backend timing against GAF's retries) have been root-caused and fixed. test_and_release is now green on this branch — see the latest CI run. Also added a regression test proving the feature_flags/evaluation retry-allowed-path actually works (test/jest/acceptance/snyk-code/gaf-retry-allowed-paths.spec.ts).

@robertolopezlopez the acceptance CI condition you flagged is now satisfied — could you take another look when you have a chance?

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Inconsistent Path Trimming 🟡 [minor]

In defaultNetworkRequestRetryAllowedPaths, paths provided via a CSV string are trimmed of whitespace using strings.TrimSpace, but paths provided via []string or []interface{} (standard for JSON/YAML config files) are appended as-is. If a user defines paths in a config file with leading/trailing spaces, the equality check in the network middleware will fail to match the endpoint, silently disabling retries for those paths.

} else if strSlice, ok := existingValue.([]string); ok {
	paths = append(paths, strSlice...)
} else if ifaceSlice, ok := existingValue.([]interface{}); ok {
	for _, v := range ifaceSlice {
		if str, ok := v.(string); ok && str != "" {
			paths = append(paths, str)
		}
	}
}
📚 Repository Context Analyzed

This review considered 13 relevant code sections from 7 files (average relevance: 0.90)

🤖 Repository instructions applied (from AGENTS.md)

Comment on lines +42 to +43
} else if strSlice, ok := existingValue.([]string); ok {
paths = append(paths, strSlice...)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty string filtering is inconsistent across input types. The CSV string handler filters empty strings (if trimmed != ""), and the interface slice handler filters them (if str != ""), but the string slice handler does not filter empty strings.

If a user provides []string{"a", "", "b"} via configuration, the empty string will be added to the retry paths, which could cause GAF's retry middleware to incorrectly match all paths (depending on how it handles empty path segments).

Fix:

} else if strSlice, ok := existingValue.([]string); ok {
	for _, s := range strSlice {
		if s != "" {
			paths = append(paths, s)
		}
	}
}

This ensures consistent empty string filtering across all input type handlers.

Suggested change
} else if strSlice, ok := existingValue.([]string); ok {
paths = append(paths, strSlice...)
} else if strSlice, ok := existingValue.([]string); ok {
for _, s := range strSlice {
if s != "" {
paths = append(paths, s)
}
}

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@danskmt

danskmt commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Update: the acceptance-tests failures blocking this PR (SNYK_TIMEOUT_SECS exit-code test racing real backend timing against GAF's retries) have been root-caused and fixed. test_and_release is now green on this branch — see the latest CI run. Also added a regression test proving the feature_flags/evaluation retry-allowed-path actually works (test/jest/acceptance/snyk-code/gaf-retry-allowed-paths.spec.ts).

@robertolopezlopez the acceptance CI condition you flagged is now satisfied — could you take another look when you have a chance?

@basti-snyk please remove unrelated changes (I might be mistaken and they might be required)

@danskmt
danskmt self-requested a review August 21, 2026 13:33
@robertolopezlopez

Copy link
Copy Markdown
Contributor

@robertolopezlopez the acceptance CI condition you flagged is now satisfied — could you take another look when you have a chance?

@basti-snyk it is actually failing (a couple of linux arm64 acceptance tests, maybe ephemeral failures)

@robertolopezlopez

Copy link
Copy Markdown
Contributor

@basti-snyk also, the branch is off-sync with main

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.

3 participants