fix: keep CLI-owned retry paths at the application layer [IDE-1890] - #7116
fix: keep CLI-owned retry paths at the application layer [IDE-1890]#7116basti-snyk wants to merge 1 commit into
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. |
fea402b to
15e0c70
Compare
15e0c70 to
3b2e3c8
Compare
|
/describe |
|
PR Description updated to latest commit (85fed6a) |
|
/describe |
|
PR Description updated to latest commit (85fed6a) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/describe |
|
PR Description updated to latest commit (91fb301) |
|
/describe |
|
PR Description updated to latest commit (91fb301) |
91fb301 to
e5bc501
Compare
This comment has been minimized.
This comment has been minimized.
e5bc501 to
060c8d9
Compare
This comment has been minimized.
This comment has been minimized.
060c8d9 to
264bf88
Compare
This comment has been minimized.
This comment has been minimized.
robertolopezlopez
left a comment
There was a problem hiding this comment.
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
|
/describe |
264bf88 to
4d1fec2
Compare
|
PR Description updated to latest commit (4d1fec2) |
This comment has been minimized.
This comment has been minimized.
|
/describe |
|
PR Description updated to latest commit (4d1fec2) |
| 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', | ||
| }; |
There was a problem hiding this comment.
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).
4d1fec2 to
1fe9e3d
Compare
|
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. @robertolopezlopez the acceptance CI condition you flagged is now satisfied — could you take another look when you have a chance? |
PR Reviewer Guide 🔍
|
| } else if strSlice, ok := existingValue.([]string); ok { | ||
| paths = append(paths, strSlice...) |
There was a problem hiding this comment.
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.
| } 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
Is this helpful? React 👍 or 👎 to let us know.
@basti-snyk please remove unrelated changes (I might be mistaken and they might be required) |
@basti-snyk it is actually failing (a couple of linux arm64 acceptance tests, maybe ephemeral failures) |
|
@basti-snyk also, the branch is off-sync with main |
User description
Summary
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
golangci-lint run ./...passesPR Type
Enhancement, Tests
Description
Add CLI-specific retry paths for core endpoints.
Update
go-application-frameworkdependency 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");File Walkthrough
2 files
Define default network request retry allowed pathsRegister default retry paths in CLI configuration4 files
Update go-application-framework dependencyUpdate go-application-framework checksumsUpdate go-application-framework dependencyUpdate go-application-framework checksums3 files
Add tests for GAF retry on feature flag evaluationMake exit code timeout test deterministicAdd unit and integration tests for retry paths1 files
Add exit code spec to gitleaksignore