Skip to content

Variables: Smarter resolution flow - #9140

Merged
medikoo merged 15 commits into
masterfrom
0318-smarter-vars-resolution
Mar 18, 2021
Merged

medikoo merged 15 commits into
masterfrom
0318-smarter-vars-resolution

Conversation

@medikoo

@medikoo medikoo commented Mar 18, 2021 •

Copy link
Copy Markdown
Contributor

Instead of resolving all properties with every resolution phase, attempt to resolve only those properties that are required to be resolved at given phase.

While resolving all at first should not be seen harmful (once resolved properties are marked as resolved and are not re-resolved in following resolution phases), it implies a slight negative side effect to JS function resolvers, which are invoked at very early stage, and are subject to unavailability of some properties or sources -> Problem raised here: #8364 (comment)

One minor drawback of new approach is that some unrecoverable errors in variables setup will be discovered in later resolution phase and not in first one

With new partial resolution mechanism introduced, I've updated to resolve only provider.name and plugins properties if we deal with help command. As that's all properties that are needed to have complete pictures of available CLI commands and their options.

Additionally:

  • Ensure no validation errors are thrown with any help command request
  • Throw explicitly if variablesResolutionMode is used together with provider.variableSyntax
  • Throw explicitly if provider.name is seen as not resolved at given stage
  • Report variable syntax errors early
  • Improve organization of processing flow in scripts/serverless.js so it's more maintanable
  • Integrate isHelpRequest into resolveInput util
  • Cleanup result value of resolve operation (so far it returned an array of useless data, while all we need to know is that it resolved, hence now undefined is returned)
  • Improve tests coverage

@codecov

codecov Bot commented Mar 18, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #9140 (412d190) into master (d8dde51) will decrease coverage by 0.12%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9140      +/-   ##
==========================================
- Coverage   87.14%   87.01%   -0.13%     
==========================================
  Files         294      293       -1     
  Lines       11256    11285      +29     
==========================================
+ Hits         9809     9820      +11     
- Misses       1447     1465      +18     
Impacted Files Coverage Δ
lib/Serverless.js 92.51% <0.00%> (-0.06%) ⬇️
scripts/serverless.js 70.73% <53.06%> (-12.61%) ⬇️
lib/classes/CLI.js 84.24% <100.00%> (-0.10%) ⬇️
lib/classes/PluginManager.js 97.43% <100.00%> (ø)
lib/classes/Service.js 86.50% <100.00%> (ø)
lib/cli/resolve-input.js 100.00% <100.00%> (+5.00%) ⬆️
...n/variables/eventually-report-resolution-errors.js 100.00% <100.00%> (ø)
lib/configuration/variables/resolve.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8dde51...412d190. Read the comment docs.

@medikoo
medikoo force-pushed the 0318-smarter-vars-resolution branch from 8952df0 to 0fd43c1 Compare March 18, 2021 12:02
@medikoo
medikoo force-pushed the 0318-smarter-vars-resolution branch from 0fd43c1 to 412d190 Compare March 18, 2021 12:07
@medikoo
medikoo requested a review from pgrzesik March 18, 2021 12:15

@pgrzesik pgrzesik 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.

Looks great, nothing to add 👍

@medikoo
medikoo merged commit ee01833 into master Mar 18, 2021
@medikoo
medikoo deleted the 0318-smarter-vars-resolution branch March 18, 2021 13:36
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.01%. Comparing base (d8dde51) to head (412d190).

Files with missing lines Patch % Lines
scripts/serverless.js 53.06% 23 Missing ⚠️
lib/Serverless.js 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9140      +/-   ##
==========================================
- Coverage   87.14%   87.01%   -0.13%     
==========================================
  Files         294      293       -1     
  Lines       11256    11285      +29     
==========================================
+ Hits         9809     9820      +11     
- Misses       1447     1465      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants