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: init from dash using explicit usage model for standard accounts #4521

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

zebp
Copy link
Contributor

@zebp zebp commented Nov 29, 2023

What this PR solves / how to test:

Fixes a bug where users with the standard usage model would have an explicit usage model defined in their wrangler.toml when they initialized a Worker from dash. Testing can be done by building and then running wrangler init --from-dash [worker] -y --no-delegate-c3 on an account that has opted into the new standard pricing and ensuring there is no usage model defined in the config.

Author has addressed the following:

  • Tests
    • Included
    • Not necessary because:
  • Changeset (Changeset guidelines)
    • Included
    • Not necessary because:
  • Associated docs
    • Issue(s)/PR(s):
    • Not necessary because: this is a bug fix to match existing defined behavior

Note for PR author:

We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label highlight pr review so future reviewers can take inspiration and learn from it.

@zebp zebp requested a review from a team as a code owner November 29, 2023 15:35
Copy link

changeset-bot bot commented Nov 29, 2023

🦋 Changeset detected

Latest commit: 444a667

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 29, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7061322025/npm-package-wrangler-4521

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7061322025/npm-package-wrangler-4521

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7061322025/npm-package-wrangler-4521 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7061322025/npm-package-miniflare-4521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7061322025/npm-package-cloudflare-pages-shared-4521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7061322025/npm-package-create-cloudflare-4521

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.18.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20231030.2
workerd 1.20231030.0 1.20231030.0
workerd --version 1.20231030.0 2023-10-30

|

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #4521 (3881974) into main (18a4dd9) will increase coverage by 0.01%.
Report is 12 commits behind head on main.
The diff coverage is 66.66%.

❗ Current head 3881974 differs from pull request most recent head 444a667. Consider uploading reports for the commit 444a667 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4521      +/-   ##
==========================================
+ Coverage   75.44%   75.45%   +0.01%     
==========================================
  Files         240      240              
  Lines       12851    12854       +3     
  Branches     3309     3312       +3     
==========================================
+ Hits         9695     9699       +4     
+ Misses       3156     3155       -1     
Files Coverage Δ
packages/wrangler/src/init.ts 91.83% <66.66%> (-0.19%) ⬇️

... and 5 files with indirect coverage changes

@mrbbot
Copy link
Contributor

mrbbot commented Nov 29, 2023

Hey! 👋 Thanks for opening this PR! I see you noticed there's already an in-flight PR that fixes this behaviour in a slightly different way. Could we close this PR and discuss which solution to use on #4470 instead, or does this need to go in sooner?

@zebp
Copy link
Contributor Author

zebp commented Nov 29, 2023

Hey! 👋 Thanks for opening this PR! I see you noticed there's already an in-flight PR that fixes this behaviour in a slightly different way. Could we close this PR and discuss which solution to use on #4470 instead, or does this need to go in sooner?

We were going to initially do that, but with Samuel being OOO we wanted to ensure that this'd be in the next release. I'm open to using that PR if we can be sure it'll go out in the next release, but product decided we should play it safe with a smaller bugfix PR.

Copy link
Contributor

@mrbbot mrbbot left a comment

Choose a reason for hiding this comment

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

Fair enough. Considering Samuel's out this week, let's go with this PR. Added a couple comments, but looks good. 👍

packages/wrangler/src/__tests__/init.test.ts Outdated Show resolved Hide resolved
.changeset/heavy-cherries-fetch.md Outdated Show resolved Hide resolved
@zebp zebp force-pushed the zeb/fix-explicit-usage-model branch from 3881974 to 444a667 Compare December 1, 2023 14:31
@mrbbot mrbbot merged commit 6c5bc70 into cloudflare:main Dec 1, 2023
15 checks passed
@workers-devprod workers-devprod mentioned this pull request Dec 1, 2023
penalosa added a commit that referenced this pull request Dec 7, 2023
@penalosa penalosa mentioned this pull request Dec 7, 2023
6 tasks
penalosa added a commit that referenced this pull request Dec 11, 2023
penalosa added a commit that referenced this pull request Dec 12, 2023
* Don't offer to use typescript or deploy when using --from-dash

* Remove fail-fast from init --from-dash.

If a user has multiple accounts, this check meant they'd be prompted to pick the account they wanted to use _twice_ (once by Wrangler and once by C3). The additional latency is minimal, and it's a less confusing DX.

* Only JS + hide usage_model = standard + cleanup

* Include custom domains + workers dev & format routes correctly

* Use implementation from #4521
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