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 license display when it comes from a File #5296

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

martinrrm
Copy link
Contributor

@martinrrm martinrrm commented Jul 5, 2023

Bug

Fixes: NuGet/Home#12060
Fixes: NuGet/Home#10670
Regression? Last working version:

Description

NuGetPackageFileService.GetEmbeddedLicenseAsync tries to get a URI from an in-memory cache, but the cache is never updated. With this change, I'm adding the correct information to the cache when the link is being created. This issue only occurs when the License comes from a file.

Fix for NuGet/Home#10670:
display-license-local

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@martinrrm martinrrm requested a review from a team as a code owner July 5, 2023 19:00
jeffkl
jeffkl previously approved these changes Jul 5, 2023
zivkan
zivkan previously approved these changes Jul 6, 2023
@zivkan
Copy link
Member

zivkan commented Jul 6, 2023

@martinrrm can you check if there is any telemetry emit before your change to let us know that getting an embedded licence has failed? If not, please add some, because if the cache decides its too full and decides to evict the data in the short time between adding it to the cache and then reading it from the cache, we're still going to have problems.

If we're not going to fix the fundamental design flaw, we should at least have telemetry.

@martinrrm
Copy link
Contributor Author

@zivkan Sorry for the late response, we do emit telemetry for faults here.

var exception = new CacheMissException();
await _nuGetTelemetryProvider.PostFaultAsync(exception, typeof(NuGetPackageFileService).FullName, nameof(NuGetPackageFileService.GetEmbeddedLicenseAsync));
return null;

image

@martinrrm martinrrm force-pushed the dev-martinrrm-fix-display-license branch from 629ec93 to acf0051 Compare July 10, 2023 21:34
@donnie-msft
Copy link
Contributor

Since this change is to the utilities, might the PR also fix NuGet/Home#10670 ?

public IReadOnlyList<IText> LicenseLinks => PackageLicenseUtilities.GenerateLicenseLinks(this);

@martinrrm martinrrm dismissed stale reviews from jeffkl and zivkan via 1efc497 July 11, 2023 20:13
@martinrrm martinrrm requested review from zivkan and jeffkl July 11, 2023 20:45
@martinrrm
Copy link
Contributor Author

@donnie-msft Confirmed that this PR also fixes that issue, added a gif to demonstrate.

jeffkl
jeffkl previously approved these changes Jul 11, 2023
donnie-msft
donnie-msft previously approved these changes Jul 11, 2023
Copy link
Contributor

@donnie-msft donnie-msft left a comment

Choose a reason for hiding this comment

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

🎉 Thanks for checking on the other bug. "2 bugs with 1 PR"!

I left some comments which I believe are techdebt. Ideally, fix them in this PR. Otherwise, please create a follow-up issue to address them.

@martinrrm martinrrm merged commit 607ed0f into dev Jul 19, 2023
@martinrrm martinrrm deleted the dev-martinrrm-fix-display-license branch July 19, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants