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

Implement versions list + versions view commands #5208

Merged
merged 10 commits into from
Mar 13, 2024
Merged

Conversation

RamIdeas
Copy link
Contributor

@RamIdeas RamIdeas commented Mar 8, 2024

What this PR solves / how to test

This PR implements the versions list and versions view <version-id> commands. They are very similar so a single PR seemed fine.

Author has addressed the following

@RamIdeas RamIdeas requested a review from a team as a code owner March 8, 2024 14:40
Copy link

changeset-bot bot commented Mar 8, 2024

🦋 Changeset detected

Latest commit: efd3514

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

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@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

@RamIdeas RamIdeas force-pushed the versions-list-command branch 2 times, most recently from d909fc7 to 439ca2d Compare March 8, 2024 19:37
Copy link
Contributor

github-actions bot commented Mar 8, 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/8262522410/npm-package-wrangler-5208

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

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

Or you can use npx with this latest build directly:

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

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


wrangler@3.33.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240304.1
workerd 1.20240304.0 1.20240304.0
workerd --version 1.20240304.0 2024-03-04

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

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

Attention: Patch coverage is 86.00000% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 70.98%. Comparing base (29e8151) to head (efd3514).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5208      +/-   ##
==========================================
+ Coverage   70.91%   70.98%   +0.07%     
==========================================
  Files         301      304       +3     
  Lines       15831    15927      +96     
  Branches     4053     4080      +27     
==========================================
+ Hits        11226    11306      +80     
- Misses       4605     4621      +16     
Files Coverage Δ
packages/wrangler/src/index.ts 90.38% <100.00%> (-0.07%) ⬇️
packages/wrangler/src/metrics/send-event.ts 100.00% <ø> (ø)
...kages/wrangler/src/utils/render-labelled-values.ts 100.00% <100.00%> (ø)
packages/wrangler/src/versions/index.ts 38.46% <100.00%> (+11.18%) ⬆️
packages/wrangler/src/versions/view.ts 100.00% <100.00%> (ø)
packages/wrangler/src/versions/list.ts 75.86% <75.86%> (ø)

... and 2 files with indirect coverage changes

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.

Added some comments, but all non-blocking. Looks good! ✅ Assuming no changeset as this is still experimental, or are you planning to add one before merging?

`[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions/ffffffff-ffff-ffff-ffff-ffffffffffff) failed.]`
);

expect(normalizeOutput(std.out)).toMatchInlineSnapshot(`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be logged to stderr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. This is just the fetchResult call rejecting. Which should bubble up to the main() try..catch error handling. Does wrangler log errors to stdout??

@@ -0,0 +1,22 @@
import { logger } from "../logger";

export default function renderLabelledValues(
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment with example output from this function might be nice.

Comment on lines +20 to +38
type UUID = string;
type VersionId = UUID;
type ApiVersion = {
id: VersionId;
number: number;
metadata: {
created_on: string;
modified_on: string;
source: "api" | string;
author_id: string;
author_email: string;
};
annotations?: {
"workers/triggered_by"?: "upload" | string;
"workers/message"?: string;
"workers/tag"?: string;
};
// other properties not typed as not used
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these types get extracted into some common file in a later PR? They seem to be duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

case "terraform":
return "Terraform 🏗️";
default:
return "Other";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include the actual value for Other and Unknown below?

Suggested change
return "Other";
return `Other (${source})`;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that too – will add

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did this in the next PR instead abc57e3

author_email: string;
};
annotations?: Record<string, string> & {
"workers/triggered_by"?: "upload" | string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have the other values, or just be string?

Copy link
Contributor Author

@RamIdeas RamIdeas Mar 12, 2024

Choose a reason for hiding this comment

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

I extract it into another file in the next PR so will leave this for now

(I typed it from copy-pasting a api response so kept values for sanity knowing they'd widen into string anyway)

@RamIdeas RamIdeas force-pushed the versions-deploy-command branch 3 times, most recently from 32b6d43 to b681d4e Compare March 12, 2024 22:37
@RamIdeas RamIdeas force-pushed the versions-list-command branch 2 times, most recently from 2f6d5e8 to 1310333 Compare March 12, 2024 23:05
Base automatically changed from versions-deploy-command to main March 13, 2024 09:24
@RamIdeas RamIdeas merged commit 4730b6c into main Mar 13, 2024
15 checks passed
@RamIdeas RamIdeas deleted the versions-list-command branch March 13, 2024 09:54
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