Skip to content

feat(sign): enhance signing process with error handling and response …#210

Open
elias96 wants to merge 1 commit into
mainfrom
handle-new-app-signer-resposne-statuscodes
Open

feat(sign): enhance signing process with error handling and response …#210
elias96 wants to merge 1 commit into
mainfrom
handle-new-app-signer-resposne-statuscodes

Conversation

@elias96

@elias96 elias96 commented May 5, 2026

Copy link
Copy Markdown
Contributor

…validation

@elias96 elias96 requested review from robinlagren and sjostrand May 5, 2026 07:15
@elias96 elias96 self-assigned this May 5, 2026
@elias96 elias96 requested a review from Copilot May 5, 2026 07:16

Copilot AI left a comment

Copy link
Copy Markdown

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 refactors the signing CLI flow in sitevision-scripts to centralize signing-response handling, improve user-facing error reporting, and validate that the signing endpoint returns a downloadable artifact instead of an unexpected JSON payload.

Changes:

  • Extracts signing-specific helpers for error-code parsing, failure messaging, and writing the signed zip.
  • Updates sign.js to use the new helpers and add explicit handling for non-OK responses, JSON responses, and missing response bodies.
  • Slightly cleans up the prompt setup in the signing script.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/sitevision-scripts/scripts/sign.js Reworks the main signing flow to use helper-based response validation and failure reporting.
packages/sitevision-scripts/scripts/util/signHelper.js Adds reusable helpers for signing error-code extraction, failure messaging, and streaming the signed zip to disk.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


const ERROR_MESSAGES = {
CERTIFICATE_NOT_FOUND: (certificateLabel = 'default') => {
return `Certificate "${certificateLabel}" was not found.`;
Comment on lines +98 to +105
if (!response.body) {
printSigningFailure({
status: response.status,
statusText: response.statusText,
code: 'EMPTY_RESPONSE',
certificateName: answers.certificateName,
});
return;
Comment on lines +84 to +93
await new Promise((resolve, reject) => {
const writer = fs.createWriteStream(signedFileNameAndPath, {
autoClose: true,
});

response.body.once('error', reject);
writer.once('error', reject);
writer.once('finish', resolve);
response.body.pipe(writer);
});

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +5 to +7
CERTIFICATE_NOT_FOUND: (certificateLabel = 'default') => {
return `Certificate "${certificateLabel}" was not found.`;
},
Comment on lines 15 to 17
(function () {
var questions = [
let questions = [
{
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