Add Edge Workers commands with safe deploy and explicit enable - #2918
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Also extracts API_HOST/API_URL/PRODUCTION_API_HOST into a leaf constants module and lazy-requires the rechallenge link inside API() to break a circular-dependency cycle that caused Jest mocks to misfire in the rechallenge test suite.
Implements `vip defensive-mode configure` with full flag validation, interactive prompting for missing required flags, and non-interactive hard-error mode.
…e guards, telemetry order, teardown race) - configure: log current effective config and proposed input before mutating (Fix 1) - enable/disable: add --non-interactive option and guard; error on production mutation attempted non-interactively without --skip-confirmation (Fix 2) - flow: add clientType=cli to rechallenge_required event (Fix 3) - flow: fire rechallenge_verified before rechallenge_exchanged to match spec order (Fix 4) - link: split innerSub into firstSub/retrySub to eliminate teardown race during async gap (Fix 5) - enable/disable/configure: use console.error for error-path chalk.red messages (Fix 6) - token-cache: document single-blob keychain strategy (Fix 7) - tests: assert proposed config logged in configure; add non-interactive-production exit tests for enable/disable; assert rechallenge_verified fires before rechallenge_exchanged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ad validation, dedupe commands) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…bin loader, sleep, flag parsing) - Render current/proposed defensive-mode config as a table instead of raw JSON, and drop the JSON blob from the production confirm prompt - Clear the elevated-token cache when `vip login` replaces the stored token, so cached elevation cannot carry across user identities - Register the four vip-defensive-mode* bins in internal-bin-loader.js - Replace the hand-rolled abortable sleep in rechallenge flow with setTimeout from node:timers/promises - Reject boolean/blank values in parsePositiveInt so bare flags like `--connection-threshold-absolute` error instead of coercing to 1 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The loop polls session status sequentially by design; each iteration must finish before the next starts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e client trunk replaced node-fetch with undici (#2837), so in the PR merge ref the node-fetch types no longer resolve and type-aware lint flags every member access as unsafe. Derive the response type from http() instead, which tracks whichever fetch implementation the merged tree uses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new vip edge-workers command suite to scaffold, compile, validate, and deploy WASM-based edge workers on VIP, including an AssemblyScript toolchain and GraphQL API integration.
Changes:
- Introduces an
edge-workerslibrary (project discovery, manifests, location parsing) plus an AssemblyScript toolchain for scaffolding and local.wasmbuilds. - Adds GraphQL API helpers for listing/getting/validating/creating/updating/enabling/disabling/deleting edge workers, and wires new CLI subcommands.
- Adds initial Jest coverage for the new lib modules and several bin commands (
deploy,validate,list).
Reviewed changes
Copilot reviewed 14 out of 30 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/edge-workers/types.ts | Defines shared edge-worker domain types (manifests, locations, API shapes). |
| src/lib/edge-workers/toolchains/index.ts | Introduces toolchain registry + getToolchain() lookup. |
| src/lib/edge-workers/toolchains/assemblyscript/templates.ts | Adds scaffolded AssemblyScript project/worker template contents. |
| src/lib/edge-workers/toolchains/assemblyscript/index.ts | Implements AssemblyScript scaffold + compiler invocation (asc) to produce .wasm. |
| src/lib/edge-workers/toolchains/assemblyscript/constants.ts | Centralizes AssemblyScript toolchain constants (SDK/version/paths). |
| src/lib/edge-workers/project.ts | Adds project resolution + descriptor/manifest IO + worker discovery. |
| src/lib/edge-workers/location.ts | Adds CLI parsing for --location <op>:<value>. |
| src/lib/edge-workers/index.ts | Adds build/read helpers for artifacts and worker source. |
| src/lib/api/edge-workers.ts | Adds GraphQL query/mutation wrappers for edge workers. |
| src/lib/api.ts | Adds extra debug logging for GraphQL error details / partial data. |
| src/bin/vip.js | Registers the new top-level edge-workers command. |
| src/bin/vip-edge-workers.js | Adds the vip edge-workers subcommand dispatcher. |
| src/bin/vip-edge-workers-validate.js | Adds vip edge-workers validate implementation. |
| src/bin/vip-edge-workers-new.js | Adds vip edge-workers new implementation. |
| src/bin/vip-edge-workers-list.js | Adds vip edge-workers list implementation with formatter output. |
| src/bin/vip-edge-workers-init.js | Adds vip edge-workers init implementation (project scaffolding). |
| src/bin/vip-edge-workers-get.js | Adds vip edge-workers get implementation (optionally prints source). |
| src/bin/vip-edge-workers-enable.js | Adds vip edge-workers enable implementation. |
| src/bin/vip-edge-workers-disable.js | Adds vip edge-workers disable implementation. |
| src/bin/vip-edge-workers-deploy.js | Adds vip edge-workers deploy implementation (validate + create/update). |
| src/bin/vip-edge-workers-delete.js | Adds vip edge-workers delete implementation with confirmation gate. |
| src/bin/vip-edge-workers-build.js | Adds vip edge-workers build implementation for local compilation. |
| package.json | Registers new published vip-edge-workers-* bin entrypoints. |
| npm-shrinkwrap.json | Updates shrinkwrap bin map to include new vip-edge-workers-* entrypoints. |
| tests/lib/edge-workers/toolchains.js | Adds tests for toolchain registry + AssemblyScript scaffolding behavior. |
| tests/lib/edge-workers/project.js | Adds tests for project resolution and worker discovery helpers. |
| tests/lib/edge-workers/location.js | Adds tests for --location parsing and validation. |
| tests/bin/vip-edge-workers-validate.js | Adds CLI-wrapper tests for validate behavior. |
| tests/bin/vip-edge-workers-list.js | Adds CLI-wrapper tests for list mapping and error handling. |
| tests/bin/vip-edge-workers-deploy.js | Adds CLI-wrapper tests for deploy create/update/validation behaviors. |
Files not reviewed (1)
- npm-shrinkwrap.json: Generated file
|
rebeccahum
reviewed
Aug 20, 2026
- api: set exitOnError:false on all edge-worker API calls so GraphQL failures propagate to the command try/catch instead of exiting the process, restoring the intended error paths for deploy/disable/enable/get - api: filter the environment server-side via environments(id: $envId) rather than fetching all environments and filtering client-side - build/validate: reject a worker name together with --all - assemblyscript scaffold: lstat the target so a symlinked directory is rejected rather than followed - readPrebuiltWorker: reject a symlinked build artifact, not just the dir - project: reject symlinked descriptor/manifest before reading - location/project: guard value-less --location/--path (boolean) with a clear UserError instead of a TypeError - dedupe BUILD_DIR into project.ts alongside the other layout constants Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tering Now that the read queries filter by environments(id: $envId), the client-side id match, id-type scan and envId re-check are redundant — matching how app-logs/envvar consume environments(id:). pickEnvWorkers keeps only the fail-closed shape validation and no longer needs envId. Replaces the two obsolete id-mismatch tests with an empty-environments (target-not-found) fail-closed case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Last one: #2918 (comment) |
|
rebeccahum
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Add a complete
vip edge-workerscommand suite for safely scaffolding, validating, deploying, inspecting, and managing WASM Edge Workers.The workflow is intentionally review-first:
initscaffolds an Edge Workers project with exact supported AssemblyScript/SDK dependencies and refuses destructive initialization.new <name>creates a validated worker manifest and starter source.build [name]/build --allcompile deterministic WASM artifacts.validate <name>/validate --allperform server-side dry-run validation without uploading.deploy <name>/deploy --allprepare and print the complete plan before any remote mutation, then create or update by name.listandget <name>inspect deployed workers; source is fetched only when explicitly requested.enable,disable, anddeletemanage deployed workers with production/destructive confirmation safeguards.This revision also adds explicit activation to deploy through
--enable, while keeping upload-only deployment as the default.Deploy/activation safety contract
deploy --enabledefaults tofalseand is not a confirmation bypass.--enable, creates and inactive updates remain inactive.--enable, a create or inactive update uploads first and enables only after a successful upload.--allprepares every worker before remote writes, then applies sequentially with accurate completed/failed/not-attempted reporting.get/listverification; it never claims the worker remained inactive.The operator guide documents the inactive-create dependency, location preserve/null-clear semantics, source storage behavior, live active updates, partial failures,
--enable, and the required non-production lifecycle.Changelog Description
Added
vip edge-workerscommands to scaffold, build, validate, deploy, inspect, enable, disable, and delete Edge Workers.vip edge-workers deploy --enableto explicitly enable newly created or inactive workers after a successful upload.Changed
Pull request checklist
New release checklist
Verification
Run with Node 24.19.0:
npm test npm run build npm run smoke:release NODE_ENV=test DO_NOT_TRACK=1 node dist/bin/vip-edge-workers-deploy.js --helpLocal results:
--enablewith(default: false)and required no credentials or browser.Steps to Test
Do not use a production target. After the platform inactive-create guarantee is deployed, use an approved non-production alias:
Build this branch:
Scaffold and review a project:
Validate and perform the default upload-only create. Confirm
list/getreport the worker inactive:Exercise separate enable, disable, and deploy-with-enable:
While the worker is already active, update and deploy again with
--enable. Verify the plan says it remains active and no redundant enable request is made.Verify location tri-state behavior: omit
locationto preserve the stored rule, then set it tonullto clear the rule and apply to all requests.Disable the worker, then confirm permanent deletion:
If an enable request fails or times out at any point, stop: the final active state is unknown. Reconcile it with
edge-workers get <name>oredge-workers listbefore taking another action. Do not retry, roll back, disable, or delete automatically.