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

Remove second wrangler banner from namespace rename #5226

Merged

Conversation

DaniFoldi
Copy link
Contributor

What this PR solves / how to test

After noticing #5225 and definitely not renaming a dispatch namespace a few times to see if the team notices it, I found that the banner was being printed twice in that command.

While the linked PR removes the yargs handler, it leaves the function in place, so I thought I'd fix it to aid a potential reintroduction in the future by ensuring the consistency between these functions.

Author has addressed the following

  • Tests
    • TODO (before merge)
    • Included
    • Not necessary because: Banners are excluded from the snapshot the tests are checked against
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Included
    • Not necessary because:
  • Public documentation

@DaniFoldi DaniFoldi requested a review from a team as a code owner March 11, 2024 20:43
Copy link

changeset-bot bot commented Mar 11, 2024

🦋 Changeset detected

Latest commit: de89108

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

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers 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 Mar 12, 2024

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/8920932986/npm-package-wrangler-5226

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-wrangler-5226 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-create-cloudflare-5226 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-cloudflare-kv-asset-handler-5226
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-miniflare-5226
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-cloudflare-pages-shared-5226
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8920932986/npm-package-cloudflare-vitest-pool-workers-5226

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


wrangler@3.53.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240419.0
workerd 1.20240419.0 1.20240419.0
workerd --version 1.20240419.0 2024-04-19

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

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.46%. Comparing base (2789f26) to head (bf45750).
Report is 78 commits behind head on main.

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

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5226      +/-   ##
==========================================
- Coverage   72.44%   70.46%   -1.99%     
==========================================
  Files         331      298      -33     
  Lines       17298    15568    -1730     
  Branches     4422     4007     -415     
==========================================
- Hits        12532    10970    -1562     
+ Misses       4766     4598     -168     
Files Coverage Δ
packages/wrangler/src/dispatch-namespace.ts 100.00% <ø> (ø)

... and 124 files with indirect coverage changes

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

The fact that there needs to be no change to a test for this to pass CI makes me worried about the test coverage here.
Could we add tests for this command? It should be quite straightforward, mocking out the fetch request expectation.

@nora-soderlund
Copy link
Contributor

is a community PR the best place to add missing test coverage though? feels like something that should go to the employees backlog.

@petebacondarwin
Copy link
Contributor

is a community PR the best place to add missing test coverage though? feels like something that should go to the employees backlog.

Good call @nora-soderlund - I didn't notice that @DaniFoldi is not an employee. I totally don't expect him to backfill all our tests. But equally, this PR is fixing something that is not right in our codebase, so a test to prove it would be appreciated.

@DaniFoldi
Copy link
Contributor Author

Hey @petebacondarwin 👋

I had a look at this, however it looks like it would require significant time to test that without having to change most tests.
If my investigation is correct, the header is disabled in tests to avoid tests failing every time when it changes (new version available, etc).
I think it should be possible to mock the header function and count its number of invocations. Failing on the second one could be possible by throwing, however detecting if a command is missing the header (r2 commands seem to have no header, for example) I'm not even sure how I'd approach.

Feel free to close this PR, or merge as-is, and the header stuff could be tracked in a separate issue.

@petebacondarwin petebacondarwin self-assigned this May 2, 2024
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

I updated a test to prove this fix.

@petebacondarwin petebacondarwin merged commit f63e7a5 into cloudflare:main May 2, 2024
12 checks passed
@workers-devprod workers-devprod mentioned this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants