Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: context provider's ignoreErrorOnMissingContext parameter is misleading #33875

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 22, 2025

In ContextProvider.getValue(), ignoreErrorOnMissingContext is a request to the CLI's context provider to not fail the lookup, but return the dummy value instead.

The operation doesn't have anything to do with missing context, and missing context isn't an error. Deprecate that parameter and add ignoreFailedLookup instead.

Also explain the dummyValue field and this one a bit better.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@rix0rrr rix0rrr requested a review from a team as a code owner March 22, 2025 14:48
@github-actions github-actions bot added the p2 label Mar 22, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team March 22, 2025 14:48
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 22, 2025
@rix0rrr rix0rrr force-pushed the huijbers/explain-contextprovider-dummy-value branch from ead00e7 to ade07ed Compare March 22, 2025 14:49
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@rix0rrr rix0rrr force-pushed the huijbers/explain-contextprovider-dummy-value branch from ade07ed to cc112a9 Compare March 22, 2025 14:51
…sleading

In `ContextProvider.getValue()`, `ignoreErrorOnMissingContext` is a
request to the CLI's context provider to not fail the lookup, but return
the dummy value instead.

The operation doesn't have anything to do with missing context, and
missing context isn't an error. Deprecate that parameter and add
`ignoreFailedLookup` instead.

Also explain the `dummyValue` field and this one a bit better.
Copy link

codecov bot commented Mar 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.36%. Comparing base (2dc5d70) to head (100e16b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #33875      +/-   ##
==========================================
- Coverage   82.38%   82.36%   -0.03%     
==========================================
  Files         120      120              
  Lines        6938     6940       +2     
  Branches     1170     1171       +1     
==========================================
  Hits         5716     5716              
- Misses       1119     1120       +1     
- Partials      103      104       +1     
Flag Coverage Δ
suite.unit 82.36% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk ∅ <ø> (∅)
packages/aws-cdk-lib/core 82.36% <0.00%> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rix0rrr rix0rrr added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-codecov The PR linter will not require codecov checks to pass labels Mar 22, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 22, 2025 18:08

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 22, 2025
Co-authored-by: Kenta Goto (k.goto) <24818752+go-to-k@users.noreply.github.com>
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 100e16b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

ignoreFailedLookup

vs.

The dummy value should not be returned for all SDK lookup failures. For example, "no network" or "no credentials" or "malformed query" should not lead to the dummy value being returned. Only the case of "no such resource" should.`

Why not call it ignoreResourceNotFound (or similar) then?

And then because ignore always implies you know what the standard behavior is, we might be better off calling it failOnResourceNotFound (with a value defaulting to true). Or even something like mustReturnResource.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-codecov The PR linter will not require codecov checks to pass pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants