Skip to content

[Internal] Preset service serialization format - #4162

Draft
peterschmidt85 wants to merge 1 commit into
masterfrom
preset-verbatim-serialization
Draft

[Internal] Preset service serialization format#4162
peterschmidt85 wants to merge 1 commit into
masterfrom
preset-verbatim-serialization

Conversation

@peterschmidt85

@peterschmidt85 peterschmidt85 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The exported service must match the configuration of the verified run exactly, and presentation does not belong in serialization. Stored preset.yml files and exports were built through a custom serializer: field exclusions (type, status, name, gateway, profile params), an env rewrite to the key=value list form, and a filter dropping empty containers, so the written files diverged from the model that ran. The serializer is deleted; presentation, including a future human-readable format, is a separate concern on top of an exact export (a TODO marks it). As a bonus, one transform masked a real bug: literal env values counted as secrets, so creation failed for any literal value of 8 or more characters.

What changed

  • ~/.dstack/presets/<id>/preset.yml and the service configuration dstack preset export writes are the exact model_dump of the preset and its service; the custom serializer is deleted.
  • The redaction mechanism is unchanged; the list of values it treats as secrets no longer includes the user's literal env values, which the saved preset legitimately contains. It keeps the dstack token, the agent API key, resolved passthrough env values, and inherited proxy variables.
  • The exported service is named after the preset; -n/--name overrides.

What this does not change

The stored service still never contains name, gateway, or any ProfileParams field (backends, spot_policy, max_price, ...): they are the deployer's choices, and a preset with any of them set fails validation.

resources stays required and stored as the run specified it, with the GPU vendor filled in from the hardware the run was verified on, as before.

Backward compatible

Old files load with new code, and new files load with old code.

🤖 Generated with Claude Code

preset.yml and exported service configurations are now the exact model
dump. All dump-time transforms are removed: field exclusions (type,
status, name, gateway, profile params), the env rewrite to key=value
list form, and the empty-container filter. What a preset must not carry
is enforced by VerifiedPreset validation, not hidden at serialization.
Old files load unchanged; new files load on old versions.

Redaction now covers secrets only: the dstack token, the agent API key,
resolved passthrough env values, and inherited proxy variables. Literal
env values are the user's own configuration text; treating them as
secrets failed creation for any literal of 8+ characters.

dstack preset export names the service after the preset; -n overrides.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@peterschmidt85 peterschmidt85 changed the title [Presets] Serialize stored and exported configurations verbatim [Presets] Remove custom serialization Aug 18, 2026
@peterschmidt85 peterschmidt85 changed the title [Presets] Remove custom serialization [Internal] Preset service serialization format Aug 18, 2026
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