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

Catch erroneous use of deployments view [deployment-id] --experimental-versions command #5405

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

RamIdeas
Copy link
Contributor

What this PR solves / how to test

Adds a view command to the new deployments subcommands opted-in via the --experimental-versions flag which shows a deprecation message and points the user to either run wrangler deployments status --experimental-versions or wrangler versions view <version-id> --experimental-versions instead.

Author has addressed the following

@RamIdeas RamIdeas requested a review from a team as a code owner March 27, 2024 10:05
Copy link

changeset-bot bot commented Mar 27, 2024

🦋 Changeset detected

Latest commit: d521a0a

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 27, 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/8450548979/npm-package-wrangler-5405

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

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

Or you can use npx with this latest build directly:

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

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


wrangler@3.38.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240320.0
workerd 1.20240320.1 1.20240320.1
workerd --version 1.20240320.1 2024-03-20

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

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.26%. Comparing base (c99c7e2) to head (d521a0a).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5405      +/-   ##
==========================================
+ Coverage   72.16%   72.26%   +0.09%     
==========================================
  Files         321      322       +1     
  Lines       16651    16663      +12     
  Branches     4258     4260       +2     
==========================================
+ Hits        12017    12042      +25     
+ Misses       4634     4621      -13     
Files Coverage Δ
...ackages/wrangler/src/versions/deployments/index.ts 100.00% <100.00%> (ø)
packages/wrangler/src/versions/deployments/view.ts 100.00% <100.00%> (ø)

... and 7 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.

What is the aim of adding a "new" command that is already deprecated?

Is it to catch people who are used to running a view command under a different sub-command?

Although running the "correct" command feels like it is helping users, I would say that in this case an error is better since it prevents users from starting down the wrong path at all, and in fact would allow this fake command to be removed in the future without a breaking change, since the only user facing change would be the replacement of the "helpful" error message with a more generic one.

I think one could actually go further and rather than call this "deprecated" you just say that we are providing a more helpful error message for an invalid command.

@RamIdeas
Copy link
Contributor Author

RamIdeas commented Mar 27, 2024

What is the aim of adding a "new" command that is already deprecated?

Is it to catch people who are used to running a view command under a different sub-command?

Yeah pretty much. You'll note this command is marked as 'hidden' too.

Although running the "correct" command feels like it is helping users, I would say that in this case an error is better since it prevents users from starting down the wrong path at all, and in fact would allow this fake command to be removed in the future without a breaking change, since the only user facing change would be the replacement of the "helpful" error message with a more generic one.

Thanks for confirming – I agree.

I think one could actually go further and rather than call this "deprecated" you just say that we are providing a more helpful error message for an invalid command.

Yeah I like this. See my other comment for suggested change.

@RamIdeas RamIdeas changed the title Add (deprecated) deployments view [deployment-id] --experimental-versions command Catch erroneous use of deployments view [deployment-id] --experimental-versions command Mar 27, 2024
@RamIdeas RamIdeas merged commit 7c701bf into main Mar 27, 2024
17 checks passed
@RamIdeas RamIdeas deleted the versions-deployments-view branch March 27, 2024 13:18
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

2 participants