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

Don't swallow errors in Lineage package #8401

Merged

Conversation

aliok
Copy link
Member

@aliok aliok commented Jan 8, 2025

Fixes #

Proposed Changes

  • Don't swallow errors in Lineage package
  • I was having hard time understanding why the Backstage backend was returning 200 with corrupt auth
  • Introduced a field called Lenient:bool (wanted to have the default to false, thus, a positive field name versus FailFast). If this field is set to false, there will be no behavior changes, except one place (noted below).

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

:page_facing_up: The event lineage package does not swallow the 400 and 401 errors anymore. Callers should handle those errors themselves.

Docs

@aliok aliok requested review from Cali0707 and pierDipi January 8, 2025 09:23
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 8, 2025
@knative-prow knative-prow bot requested a review from creydr January 8, 2025 09:23
Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

@aliok can we make this behavior configurable? It will enable tools to either configure "skip unauthorized resources" (so that we could build partial graphs scoped to the user access) or "fail fast on unauthorized resources" (the latter seems a good default)

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

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

Project coverage is 64.12%. Comparing base (81a37ff) to head (32e36bf).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/graph/constructor.go 0.00% 93 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8401      +/-   ##
==========================================
- Coverage   64.22%   64.12%   -0.11%     
==========================================
  Files         388      388              
  Lines       23302    23339      +37     
==========================================
  Hits        14965    14965              
- Misses       7542     7579      +37     
  Partials      795      795              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 8, 2025
Comment on lines 525 to 534
for i := range sourcesList.Items {
unstructuredSource := sourcesList.Items[i]
duckSource, err := duckSourceFromUnstructured(&unstructuredSource)
if err == nil {
duckSources = append(duckSources, duckSource)
if err != nil {
return nil, fmt.Errorf("failed to convert unstructured source to duck source: %w", err)
}

duckSources = append(duckSources, duckSource)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I made a behavior change here.

Before:

  • Ignore the issue that the unstructrued source cannot be converted to a duck source

After:

  • Do not ignore it, even with Lenient=true

@aliok
Copy link
Member Author

aliok commented Jan 8, 2025

@pierDipi

I've introduced a field called Lenient:bool (wanted to have the default to false, thus, a positive field name versus FailFast). If this field is set to false, there will be no behavior changes, except one place (noted below).

Behavior change: #8401 (comment)

Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 8, 2025
Copy link

knative-prow bot commented Jan 8, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aliok, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit bb6c53c into knative:main Jan 8, 2025
35 of 36 checks passed
@aliok aliok deleted the 2025-01-08-dont-swallow-errors-in-lineage branch January 8, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants