Skip to content

fix: handle undefined values when handling results #845

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

Open
wants to merge 3 commits into
base: main-enterprise
Choose a base branch
from

Conversation

fandasson
Copy link

This is patch update handling undefined values in few scenarios I observed when using this tool.

I believe it should fix issue #501. I observed the same freezing in github action and this fixes properly handling undefined fixes it.

@Copilot Copilot AI review requested due to automatic review settings June 10, 2025 16:52
Copilot

This comment was marked as outdated.

@fandasson fandasson requested a review from Copilot June 26, 2025 17:28
Copy link
Contributor

@Copilot 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 pull request fixes issue #501 by adding safeguards to handle undefined values in results and error reporting. The key changes are:

  • In lib/settings.js, error actions and change actions are now guarded with default objects to avoid undefined values.
  • The result processing logic skips entries without an action property.
  • In lib/configManager.js, a safe null return is added after a failed GitHub API call.

Reviewed Changes

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

File Description
lib/settings.js Added default values and skipped processing for undefined actions.
lib/configManager.js Enhanced error handling by returning null on fetch failures.
Comments suppressed due to low confidence (2)

lib/settings.js:206

  • The error action is now pushed as an object instead of a string. Please confirm that downstream consumers of stats.errors can handle an object with a msg property rather than a plain string.
          stats.errors[res.repo].push(res.action ?? { msg: 'Unknown error' })

lib/settings.js:214

  • The changes array now may contain an object with a msg field even if res.action is undefined, replacing a string representation. Verify that any code consuming stats.changes can handle both objects and strings without issues.
          stats.changes[res.plugin][res.repo].push(res.action ?? { msg: 'No action details' })

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.

1 participant