Skip to content
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

fix: determine duplicate function precedence based on extension #5617

Merged
merged 7 commits into from
Apr 12, 2023

Conversation

khendrikse
Copy link
Contributor

@khendrikse khendrikse commented Apr 12, 2023

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes https://github.com/netlify/pod-compute/issues/462

Right now, the cli doesn't behave the same as production when it comes to duplicate function precedence. This should fix it. For more detail check the issue1


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@khendrikse khendrikse added the type: bug code to address defects in shipped code label Apr 12, 2023
@khendrikse khendrikse requested a review from a team April 12, 2023 08:38
@khendrikse khendrikse self-assigned this Apr 12, 2023
@github-actions
Copy link

github-actions bot commented Apr 12, 2023

📊 Benchmark results

Comparing with 219dd3c

Package size: 313 MB

⬇️ 0.00% decrease vs. 219dd3c

^                                                          306 MB  306 MB  306 MB  306 MB  313 MB  313 MB 
│                                                  302 MB   ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│                                                   ┌──┐    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│ ─264 MB──264 MB──264 MB──264 MB──271 MB──271 MB───┼──┼────┼──┼────┼──┼────┼──┼────┼──┼────┼──┼────|▒▒|──
│   ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

Copy link
Contributor

@danez danez left a comment

Choose a reason for hiding this comment

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

Can we add a test?

@khendrikse
Copy link
Contributor Author

I will!

@khendrikse khendrikse requested a review from danez April 12, 2023 09:44
src/lib/functions/registry.mjs Outdated Show resolved Hide resolved
@khendrikse khendrikse force-pushed the feat-461/set-function-precedence-based-on-extension branch from 3684235 to c5a759a Compare April 12, 2023 10:31
danez
danez previously approved these changes Apr 12, 2023
@@ -212,7 +212,8 @@ export class FunctionsRegistry {
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func.name)))

await Promise.all(
functions.map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
// We reverse the array so we get the right functions precedence
functions.reverse().map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this solve the problem? Can you describe how this works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I added an extra comment now :) zip-it-and-ship-it returns an array with the last functions preceding the previous. But we need to reverse that in the cli

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, so much simpler :)

@khendrikse khendrikse requested a review from danez April 12, 2023 12:36
@@ -212,7 +212,8 @@ export class FunctionsRegistry {
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func.name)))

await Promise.all(
functions.map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
// We reverse the array so we get the right functions precedence
functions.reverse().map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, so much simpler :)

@khendrikse khendrikse added the automerge Add to Kodiak auto merge queue label Apr 12, 2023
@kodiakhq kodiakhq bot merged commit 8ae1456 into main Apr 12, 2023
@kodiakhq kodiakhq bot deleted the feat-461/set-function-precedence-based-on-extension branch April 12, 2023 12:48
@danez
Copy link
Contributor

danez commented Apr 12, 2023

This broke some tests I think.

@khendrikse
Copy link
Contributor Author

This broke some tests I think.

I'm really confused as to how I was able to merge this PR :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Add to Kodiak auto merge queue type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants