Fix source links for external API references - #1610
Open
David Pine (IEvangelist) wants to merge 1 commit into
Open
Fix source links for external API references#1610David Pine (IEvangelist) wants to merge 1 commit into
David Pine (IEvangelist) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
David Pine (IEvangelist)
September 2, 2026 15:23
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new GitHub release resolver only queries the first 100 releases, which can cause the automation to fail for older versions once the upstream repo exceeds that page size.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves how the PackageJsonGenerator determines and emits source links for externally sourced API references by (1) resolving immutable source commits for certain external packages and (2) hardening PDB-derived source path handling so generated links remain safe and valid.
Changes:
- Add PDB document-path normalization to emit safe repository-relative paths (and fail fast on unmappable absolute paths).
- Treat confirmed 404 source lookups as “missing file” and suppress broken file/line links for inferred filenames.
- Resolve
Aspire.Hosting.AWSpackage versions to the commit behind the matching upstream GitHub release, and plumbGITHUB_TOKENinto the updater workflow.
File summaries
| File | Description |
|---|---|
| tests/PackageJsonGenerator.Tests/PackageJsonGeneratorHelperTests.cs | Adds unit tests for PDB source-path normalization behavior (safe mapping + rejection cases). |
| src/tools/PackageJsonGenerator/README.md | Documents the new external release resolver and PDB path normalization behavior. |
| src/tools/PackageJsonGenerator/PackageJsonGenerator.cs | Suppresses broken links when a source file is confirmed missing (404) at the resolved commit. |
| src/tools/PackageJsonGenerator/Helpers/PdbSourceReader.cs | Normalizes PDB document names into safe repo-relative paths; ignores empty doc names. |
| src/tools/PackageJsonGenerator/generate-package-json.ps1 | Adds AWS external-release commit resolution and GitHub-authenticated reads with retries. |
| .github/workflows/update-integration-data.yml | Exposes an app token as GITHUB_TOKEN for the updater script to increase GitHub API reliability. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+400
to
+418
| $releases = $null | ||
| for ($attempt = 1; $attempt -le 3; $attempt++) { | ||
| try { | ||
| $releases = Invoke-RestMethod -Uri $source.ReleasesApi -Headers $headers | ||
| break | ||
| } | ||
| catch { | ||
| if ($attempt -eq 3) { | ||
| throw | ||
| } | ||
| Start-Sleep -Seconds ([Math]::Pow(2, $attempt - 1)) | ||
| } | ||
| } | ||
|
|
||
| $headingPattern = "(?m)^###\s+$([regex]::Escape($PackageId))\s+\($([regex]::Escape($Version))\)\s*$" | ||
| $matchingReleases = @($releases | Where-Object { | ||
| -not [string]::IsNullOrWhiteSpace($_.body) -and $_.body -match $headingPattern | ||
| }) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aspire.Hosting.AWSpackage versions to the immutable commit behind the matching AWS GitHub releaseValidation
dotnet test tests/PackageJsonGenerator.Tests/PackageJsonGenerator.Tests.csproj --configuration Release --no-restore(48 passed)Aspire.Hosting.AWS13.7.2 andAspire.Hosting.DocumentDB0.114.1 with zero rooted paths and zero missing repository files653c103df4e342a927f7ac0fd533b350ef772c34