Skip to content

Make Integration Data Updater tolerate package failures and track them in one issue - #2047

Merged
David Pine (IEvangelist) merged 2 commits into
mainfrom
ievangelist-nonfatal-api-failures
Nov 4, 2026
Merged

David Pine (IEvangelist) merged 2 commits into
mainfrom
ievangelist-nonfatal-api-failures

Conversation

@IEvangelist

Copy link
Copy Markdown
Member

Summary

Follow-up to #1961. After its fix, the Integration Data Updater gets past apiReference but aborts because 3 CommunityToolkit packages (Hosting.Chroma, Hosting.Keycloak.Extensions, Hosting.Kind at 17.0.0-beta.994) depend on Aspire.Hosting >= 17.0.0-preview.1.26552.6, which is not on nuget.org (NU1102). One failing package blocked every data update.

  • generate-package-json.ps1: a failed package no longer exits 1 or deletes the staged output; its existing generated files are kept instead of being removed as stale.
  • update-integration-data.ps1: C# and TypeScript package failures warn and continue; failing package names are emitted as the api_failures output and listed in the PR body.
  • update-integration-data.yml: new "Track API generation failures" step maintains a single issue. Its body lists the current failing packages; a comment is added only when that set changes, and the issue closes when nothing fails, so identical failures never create duplicates.

Third-party links and affiliations

None.

Validation

  • PowerShell parser on both scripts: 0 errors.
  • generate-package-json.Tests.ps1: passed (209 included, 1 excluded).
  • Full updater and the issue step were not run; run workflow_dispatch after merge. Semantic validation for packages kept at old data is unverified.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 12:02
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

🟡 Changes recommended

Critical gaps in failed-package preservation, version validation, and batch reconciliation can abort updates before failure reporting or publish inconsistent artifacts.

4 open issues
What changed in this PR

Following #1961, this PR aims to let the Integration Data Updater refresh successful packages despite individual API-generation failures and track failures in one GitHub issue.

Changes:

  • Replaces the C# generator’s failure abort with preservation of existing files for failed packages.
  • Adds updater warnings, PR-body details, and an api_failures output.
  • Adds workflow logic to create, update, or close a failure-tracking issue.
File Description
src/​tools/​PackageJsonGenerator/​generate-package-json.ps1 Allows partial generation and exempts failed packages from stale-file deletion.
src/​frontend/​scripts/​update-integration-data.ps1 Collects package failures and includes them in workflow outputs and PR descriptions.
.github/​workflows/​update-integration-data.yml Adds issue tracking based on reported API-generation failures.

Review effort: Balanced

Stop-ApiRegeneration "C# API generation reported $($Matches.Failed) package failure(s). Aborting; no PR will be opened."
$pkgFailedLine = ($pkgLog -split "`n" | Where-Object { $_ -match '^\s*Failed packages:' } | Select-Object -First 1)
$pkgFailedPackages = if ($pkgFailedLine) { ($pkgFailedLine -replace '^\s*Failed packages:\s*', '').Trim() } else { "$($Matches.Failed) unnamed package(s)" }
Write-Warning "C# API generation failed for: $pkgFailedPackages. Continuing; existing data for these packages is kept."
Comment on lines 1231 to +1232
if ($failCount -gt 0) {
Remove-Item -Path $OutputDir -Recurse -Force -ErrorAction SilentlyContinue
exit 1
Write-Warning "Skipping $failCount package(s) that failed to generate; their existing data is kept."
if ($isFullReconciliation) {
foreach ($existingFile in Get-ChildItem -Path $FinalOutputDir -Filter "*.json" -File) {
if (-not $stagedNames.Contains($existingFile.Name)) {
if (-not $stagedNames.Contains($existingFile.Name) -and -not (Test-IsFailedPackageFile $existingFile.Name)) {
Comment on lines +239 to +244
if [ -z "$existing" ]; then
gh issue create --title "$title" --body "$body"
elif ! gh issue view "$existing" --json body --jq .body | grep -qF "$marker"; then
gh issue edit "$existing" --body "$body"
gh issue comment "$existing" --body "The set of failing packages changed: $RUN_URL"
fi
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2047. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2047 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@IEvangelist
David Pine (IEvangelist) merged commit 6ff60c3 into main Nov 4, 2026
11 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the ievangelist-nonfatal-api-failures branch November 4, 2026 12:14
David Pine (IEvangelist) added a commit that referenced this pull request Nov 4, 2026
## Summary

<!-- Describe what this pull request changes and why. -->

Fix the complete package-failure path exposed by updater run
41827585564, rather than only suppressing its next validation error.
Merge current `main` into this branch to resolve the conflict left by
the squash merge of #2047.

- Seed staging from committed API artifacts so failed packages actually
retain their last-good data. When TypeScript generation fails after C#
advances, restore both artifacts as a matching pair and rebuild the
declarations.
- Persist each failure's package, exact catalog version, generation
stage, and reason in
`src/frontend/src/data/api-generation-failures.json`. Both the updater
and the generated data PR's CI use these narrowly deferred updates;
other identity, provenance, exported-module, and declaration checks
remain strict.
- Retry pending failures even when catalog versions have not changed;
clear the report on recovery.
- Emit diagnostics immediately after each generator, before later phases
can abort. Report package failures regardless of update-step success; do
not close the issue after an incomplete generation pass.
- Reuse one tracking issue, including reopening it on recurrence.
Unchanged failures do not produce comments; changed diagnostics are
preserved in issue comments, not just linked to expiring run logs.
- Treat a completed C# batch's expected exit code 1 as partial success,
preserving its per-package statuses. Crashes, incomplete batches, and
contradictory statuses remain fatal. An all-package restore failure
still reaches the final diagnostics and last-good-data preservation.
- Add isolated tests that execute the actual PowerShell orchestrator and
semantic validator with mocked external package generation; execute the
actual C# batch reconciliation against completed-partial, crash, and
incomplete fixtures; cover issue creation, deduplication, updates,
closure, recurrence, and API errors.

## Third-party links and affiliations

<!--
List any third-party links added or changed by this pull request and
disclose any
material affiliation with the linked organizations, such as employment,
sponsorship, or ownership. Write "None" if this pull request doesn't add
or
change third-party links.
-->

None. Example URLs in tests are non-network fixture data.

## Validation

<!-- List the checks you ran or explain why validation isn't needed. -->

From `src/frontend`:

- `node node_modules\vitest\vitest.mjs run --config
vitest.structured-data.config.ts` — passed: 121 tests across 6 files,
including 12 issue/orchestration regression tests.
- `node node_modules\eslint\bin\eslint.js
scripts\report-api-generation-failures.mjs
scripts\validate-generated-api-data.ts
tests\unit\integration-data-updater.vitest.test.ts
tests\unit\validate-generated-api-data.vitest.test.ts
vitest.structured-data.config.ts --max-warnings 0` — passed.
- `node node_modules\tsx\dist\cli.mjs
scripts\validate-generated-api-data.ts` — passed on current committed
API artifacts: 210 catalog identities and 140 TypeScript modules.

From the repository root:

- `pwsh -NoProfile -File
tests\PackageJsonGenerator.Tests\generate-package-json.Tests.ps1` —
passed: catalog-filter regression plus completed partial-batch, crash,
and incomplete-output checks.
- `[System.Management.Automation.Language.Parser]::ParseFile(...)` for
all three modified generator/orchestrator PowerShell scripts — passed:
no parse errors.
- `git diff --cached --check` — passed before each commit.

No local production build or full live package regeneration was run.
GitHub CI and an updater run on `main` after merge are still required
before calling the live workflow fixed. The workflow was not dispatched
on this PR branch, because doing so can update the real auto-merge data
PR.

---------

Co-authored-by: David Pine <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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