Skip to content

Added file existence check before override generateFromTypeSpec flag#13415

Merged
raych1 merged 3 commits intomainfrom
users/raych1/fix-executionreport-generation-issue
Dec 20, 2025
Merged

Added file existence check before override generateFromTypeSpec flag#13415
raych1 merged 3 commits intomainfrom
users/raych1/fix-executionreport-generation-issue

Conversation

@raych1
Copy link
Member

@raych1 raych1 commented Dec 19, 2025

Fixed the following issue introduced by PR:

[EXT-ERR] Failed to read generateOutput.json. Please check if the generate script is configured correctly.
Error: [EXT-ERR] Failed to read generateOutput.json. Please check if the generate script is configured correctly.
    at generateReport (/mnt/vss/_work/1/s/azure-rest-api-specs/node_modules/@azure-tools/spec-gen-sdk/dist/automation/reportStatus.js:109:19)
    at sdkAutoMain (/mnt/vss/_work/1/s/azure-rest-api-specs/node_modules/@azure-tools/spec-gen-sdk/dist/automation/entrypoint.js:125:43)
    at async generateSdk (/mnt/vss/_work/1/s/azure-rest-api-specs/node_modules/@azure-tools/spec-gen-sdk/dist/cli/cli.js:45:18)
    at async Object.handler (/mnt/vss/_work/1/s/azure-rest-api-specs/node_modules/@azure-tools/spec-gen-sdk/dist/cli/cli.js:178:5)
spec-gen-sdk execution time: 0s

We already have the file existence check after SDK is generated, however, this issue happens when SDK generation configuration isn't enabled which causes the generation step to be skipped. So, we need to check the file existence and cannot throw the exception if the file doesn't exist. Instead, do not override the flag when the file doesn't exist.

Repro pipeline run

Copilot AI review requested due to automatic review settings December 19, 2025 23:10
@raych1 raych1 self-assigned this Dec 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a file access issue in the .NET SDK generation workflow by adding a file existence check before attempting to read generateOutput.json. Previously, the code would throw an error when the file didn't exist; now it gracefully handles the absence of the file by only processing it when it exists.

  • Added fs.existsSync() check before reading generateOutput.json
  • Changed error handling from throwing to gracefully continuing when file is absent
  • Version bumped from 0.9.5 to 0.9.6

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/spec-gen-sdk/src/automation/reportStatus.ts Added file existence check in the condition and removed error throwing when file is absent, allowing graceful handling when generation configuration is not enabled for .NET
tools/spec-gen-sdk/package.json Bumped version to 0.9.6
tools/spec-gen-sdk/package-lock.json Updated lockfile to reflect new version 0.9.6
tools/spec-gen-sdk/CHANGELOG.md Added release notes for version 0.9.6 documenting the fix
Files not reviewed (1)
  • tools/spec-gen-sdk/package-lock.json: Language not supported

raych1 and others added 2 commits December 19, 2025 23:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@raych1 raych1 enabled auto-merge (squash) December 19, 2025 23:24
@raych1 raych1 requested a review from mikeharder December 20, 2025 01:01
@raych1 raych1 merged commit 94c590c into main Dec 20, 2025
7 checks passed
@raych1 raych1 deleted the users/raych1/fix-executionreport-generation-issue branch December 20, 2025 01:58
JiaqiZhang-Dev pushed a commit that referenced this pull request Dec 22, 2025
…13415)

* Added file existence check before override generateFromTypeSpec flag

* Fixed lint issue

* Update tools/spec-gen-sdk/CHANGELOG.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+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