Skip to content

Conversation

@joehan
Copy link
Contributor

@joehan joehan commented Apr 20, 2023

Description

Due to the conversion to and from proto wire format, required repeated fields of extensionSpec would be undefined instead of empty. This caused some unexpected behavior, including erroring out when trying to ext:install or ext:configure an extension that has no params.

This change ensures that spec.param and spec.systemParams will be [] instead of undefined, and adds some defensive checking in other places to prevent similar issues.

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2023

Codecov Report

Patch coverage: 83.33% and no project coverage change.

Comparison is base (7910bb2) 55.58% compared to head (c38d70f) 55.59%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5715   +/-   ##
=======================================
  Coverage   55.58%   55.59%           
=======================================
  Files         324      324           
  Lines       21973    21975    +2     
  Branches     4477     4479    +2     
=======================================
+ Hits        12213    12216    +3     
+ Misses       8679     8678    -1     
  Partials     1081     1081           
Impacted Files Coverage Δ
src/extensions/extensionsApi.ts 65.99% <83.33%> (-0.14%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@joehan joehan requested a review from huangjeff5 April 20, 2023 21:42

const [immutableParams, tbdParams] = partition(
spec.params.concat(spec.systemParams ?? []),
(spec.params ?? []).concat(spec.systemParams ?? []),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need these checks here if we are checking it at the api level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really - this is just some extra defensive null checking in case we reintroduce this in the future accidentally. I have a low priority goal to make ext:install and ext:configure work offline for local extensions, and doing so could skip over the code in extensionsApi that ensures these are populated.

@joehan joehan merged commit f2592d5 into master Apr 21, 2023
@joehan joehan deleted the jh-empty-params branch April 21, 2023 18:20
ProfHercules pushed a commit to ProfHercules/firebase-tools that referenced this pull request May 5, 2023
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.

3 participants