Skip to content

feat(vmm): support environment value specs in deployment tooling - #1651

Merged
kvinwang merged 5 commits into
feat/value-specfrom
feat/value-spec-tooling
Nov 26, 2026
Merged

kvinwang merged 5 commits into
feat/value-specfrom
feat/value-spec-tooling

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #1649; stacked on feat/value-spec.

Problem

vmm-cli and the web UI rebuild allowed_envs from the names of the variables being encrypted, so a NAME: spec entry is replaced by a plain name on the next deploy, update or update-env. Specs can only be used with a hand-written compose file, and a malformed spec is not reported until the CVM fails to boot.

Fix

  • VMM: CreateVm, UpgradeApp and GetComposeHash reject a malformed int or float spec in allowed_envs. Regex specs are not compiled there and are left to the guest: one short entry such as /\w{200}/ takes about 85 ms to compile, and a compose file can hold any number of them. Measured on a release build, the check takes 30–360 ms for a 3–4 MB compose (200k short entries, or 1000 entries of 4 KB).
  • vmm-cli: compose --env-spec 'PORT: int(1..=65535)' (repeatable). deploy, update and update-env keep entries that carry a spec and only rebuild the plain names.
  • Web UI: each encrypted variable has an optional value spec; updating secrets keeps existing specs unless a new one is given for the same name. Specs are stripped before encryption.
  • NAME: spec entry parsing moves into value-spec so the guest and the VMM share it.

Values are still only checked in the guest: they are encrypted client-side, and the tools do not reimplement the spec language.

Verification

  • cargo test -p dstack-vmm -p value-spec -p dstack-util, including a new create_manifest_from_vm_config test with valid and malformed specs, and regex specs passing unchecked.
  • python3 -m unittest dstack/vmm/src/tests/test_vmm_cli.py and npm test in dstack/vmm/ui, with new cases for the merge and for specs not reaching the encrypted payload.
  • The UI change was not exercised in a browser, and nothing here was run against a live VMM.

@kvinwang
kvinwang force-pushed the feat/value-spec-tooling branch 3 times, most recently from e44ab93 to b4d6eca Compare November 26, 2026 02:05
@kvinwang
kvinwang force-pushed the feat/value-spec-tooling branch from b4d6eca to 47f288e Compare November 26, 2026 02:07
@kvinwang
kvinwang force-pushed the feat/value-spec-tooling branch from 47f288e to c4c866b Compare November 26, 2026 02:09
@kvinwang
kvinwang merged commit c4c866b into feat/value-spec Nov 26, 2026
6 of 7 checks passed
@kvinwang
kvinwang deleted the feat/value-spec-tooling branch November 26, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant