Skip to content

chore: Use context.Context from InvocationContext#578

Open
PeterSchafer wants to merge 1 commit intomainfrom
chore/CLI-1416_terminated
Open

chore: Use context.Context from InvocationContext#578
PeterSchafer wants to merge 1 commit intomainfrom
chore/CLI-1416_terminated

Conversation

@PeterSchafer
Copy link
Copy Markdown
Contributor

@PeterSchafer PeterSchafer commented Mar 30, 2026

Description

This PR includes a couple of refactorings to make use of the context.Context instance provided by the InvocationContext. This requires extending a couple of interfaces.

To keep the changes incremental, it doesn't yet fully use the context and needs to fallback to context.Background() where the context is not directly available yet.

Checklist

  • Tests added and all succeed (make test)
  • Regenerated mocks, etc. (make generate)
  • Linted (make lint)
  • Test your changes work for the CLI
    1. Clone / pull the latest CLI main.
    2. Run go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMIT in the cliv2 directory.
      • Tip: for local testing, you can uncomment the line near the bottom of the CLI's go.mod to point to your local GAF code.
    3. Run go mod tidy in the cliv2 directory.
    4. Run the CLI tests and do any required manual testing.
    5. Open a PR in the CLI repo now with the go.mod and go.sum changes.
    • Once this PR is merged, repeat these steps, but pointing to the latest GAF commit on main and update your CLI PR.

@PeterSchafer PeterSchafer requested review from a team as code owners March 30, 2026 17:05
@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Mar 30, 2026

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.

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Mar 30, 2026

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.

@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch from 58f300c to 85d19c3 Compare April 1, 2026 16:19
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch from 0212397 to 54f50e9 Compare April 20, 2026 10:01
@PeterSchafer PeterSchafer requested review from a team as code owners April 20, 2026 10:01
@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch from 54f50e9 to 5fc0ff8 Compare April 20, 2026 10:03
@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer changed the title chore: add WithContext() option for engine.Invoke() chore: Use context.Context from InvocationContext Apr 20, 2026
@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch 2 times, most recently from d8b965b to dd5cd9e Compare April 20, 2026 10:14
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch 2 times, most recently from 4a70373 to 49f15ef Compare April 20, 2026 10:26
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@PeterSchafer PeterSchafer force-pushed the chore/CLI-1416_terminated branch from 49f15ef to f40d778 Compare April 20, 2026 10:30
@snyk-pr-review-bot
Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 47 relevant code sections from 13 files (average relevance: 0.98)

Comment on lines -69 to 71
settings, err := apiClient.GetOrgSettings(org)
settings, err := apiClient.GetOrgSettings(context.Background(), org)
if err != nil {
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.

Some places are using invocationCtx.Context() and others context.Background(). I also see the latter was replaced by the former in some cases.
What is the difference between them? Should we have a unified way of having the context?

Image

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