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

feat: add experimental_patchConfig #7521

Merged
merged 13 commits into from
Dec 19, 2024
Merged

feat: add experimental_patchConfig #7521

merged 13 commits into from
Dec 19, 2024

Conversation

emily-shen
Copy link
Contributor

@emily-shen emily-shen commented Dec 11, 2024

Fixes DEVX 1424


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: should be covered by unit tests
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: not user facing change

@emily-shen emily-shen requested a review from a team as a code owner December 11, 2024 13:35
Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: 6c2ce25

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

@emily-shen emily-shen marked this pull request as draft December 11, 2024 13:35
Copy link
Contributor

github-actions bot commented Dec 11, 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/12397643964/npm-package-wrangler-7521

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-wrangler-7521 dev path/to/script.js
Additional artifacts:
wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-workers-bindings-extension-7521 -O ./cloudflare-workers-bindings-extension.0.0.0-vdd3c7f5ec.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-vdd3c7f5ec.vsix
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-create-cloudflare-7521 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-kv-asset-handler-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-miniflare-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-pages-shared-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-unenv-preset-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-vitest-pool-workers-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-workers-editor-shared-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-workers-shared-7521
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12397643964/npm-package-cloudflare-workflows-shared-7521

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


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241205.0
workerd 1.20241205.0 1.20241205.0
workerd --version 1.20241205.0 2024-12-05

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

@emily-shen emily-shen force-pushed the emily/read-bindings-api branch 2 times, most recently from 9507a77 to a4e3f93 Compare December 13, 2024 18:04
@emily-shen emily-shen marked this pull request as ready for review December 13, 2024 18:04
@emily-shen emily-shen force-pushed the emily/read-bindings-api branch 2 times, most recently from 590b62f to 021ea61 Compare December 16, 2024 11:11
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
packages/wrangler/src/config/patch-config.ts Outdated Show resolved Hide resolved
@emily-shen emily-shen force-pushed the emily/read-bindings-api branch from 52fa451 to 04384f1 Compare December 18, 2024 11:32
@emily-shen emily-shen changed the title feat: add experimental_readRawConfig and experimental_patchBindingsConfig feat: add experimental_patchConfig Dec 18, 2024
@penalosa penalosa force-pushed the emily/read-bindings-api branch from 9311943 to a1aa663 Compare December 18, 2024 16:35
// {
// binding: "KV",
// },
// undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if you take out the undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no :/ I probably need to rethink the 'delete' api, but since no one is asking for it now and all of this is quite separate from the patchConfig flow that is actually used, I was just going to leave it alone for now.

Happy to take the edit with replacement stuff out of this PR as well, and just have the additive patch if you'd rather.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still a bit confused about the behaviour. What happens with:

// original
{
  kv_namespaces: [
    {
      binding: "MY_KV"
    },
    {
      binding: "MY_KV2"
    }
  ]
}

// replacement patch
 {
  kv_namespaces: [
    {
      binding: "MY_KV"
    }
  ]
}

?

I'd expect the output to be the below, but it sounds like it's something different?

{
  kv_namespaces: [
    {
      binding: "MY_KV"
    }
  ]
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for future reference:

the edit-with-replacement is going through each terminal? leaf? node and updating that, in order to preserve comments. that's why it needs 'undefined' in order to actually delete something. I suppose the better way to do it would be work out the diff between the patch and original, and only edit those. Will iterate on this later 👍

Copy link
Contributor

@penalosa penalosa left a comment

Choose a reason for hiding this comment

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

Couple questions, but otherwise lgtm

@emily-shen emily-shen force-pushed the emily/read-bindings-api branch from a1aa663 to 6c2ce25 Compare December 18, 2024 16:55
@emily-shen emily-shen merged commit 48e7e10 into main Dec 19, 2024
29 checks passed
@emily-shen emily-shen deleted the emily/read-bindings-api branch December 19, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants