Skip to content

Fix push_config() to push labels and versions#1785

Merged
dmontagu merged 5 commits intomainfrom
fix/push-config-labels
Mar 23, 2026
Merged

Fix push_config() to push labels and versions#1785
dmontagu merged 5 commits intomainfrom
fix/push-config-labels

Conversation

@dmontagu
Copy link
Copy Markdown
Contributor

@dmontagu dmontagu commented Mar 20, 2026

Summary

  • _config_to_api_body() now serializes config.labels into the API body, converting LabeledValue to version targets and LabelRef to latest/code_default/label targets
  • push_config() diff comparison now excludes the read-only latest_version field to prevent false-positive diffs on round-trip

Closes #1770

Companion PR

  • Platform: pydantic/platform#18906 (adds server-side support for the labels field in create/update/bulk API)

Test plan

  • All 314 existing variable tests pass
  • Pyright and ruff clean
  • Manual test: pull config → push back → verify no diff
  • Manual test: modify a label in pulled config → push → verify label changed

Summary by cubic

Fixes push_config() so labels and version targets are included in API requests and ignores read‑only latest_version in diff checks. Docs clarify variables_push() is metadata‑only; use variables_push_config() to sync labels and versions from code.

  • Bug Fixes
    • _config_to_api_body() now serializes config.labels: LabeledValue{'target_type':'version','version','serialized_value'}; LabelRef{'target_type':'latest'|'code_default'|'label','target_label'}; omits labels when empty.
    • push_config() comparison excludes latest_version on both sides to prevent false‑positive diffs after round trips.

Written for commit 9a60516. Summary will update on new commits.

… diff

push_config() was silently dropping all label data during push because
_config_to_api_body() only sent rollout weights. This adds label
serialization (LabeledValue → version target, LabelRef → latest/
code_default/label target) and excludes the read-only latest_version
field from the diff comparison to prevent false positives.

Closes #1770
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 20, 2026

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a60516
Status: ✅  Deploy successful!
Preview URL: https://41c0eceb.logfire-docs.pages.dev
Branch Preview URL: https://fix-push-config-labels.logfire-docs.pages.dev

View logs

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

devin-ai-integration[bot]

This comment was marked as resolved.

- Test all LabelRef types: latest, code_default, label-to-label ref
- Test that empty labels dict omits the labels key from API body
- Fixes coverage gaps in logfire/variables/remote.py
devin-ai-integration[bot]

This comment was marked as resolved.

Previously docs stated that variables_push() only syncs metadata and that
labels/versions must be managed through the UI. Updated to reflect that
labels and versions are now included in push operations.
cubic-dev-ai[bot]

This comment was marked as resolved.

…s labels

Cubic correctly identified that the previous doc update incorrectly
attributed label/version syncing to variables_push(). Only
variables_push_config() syncs labels and versions. Also fix duplicated
phrasing in the getting started steps.
@dmontagu dmontagu merged commit 65d9b48 into main Mar 23, 2026
16 checks passed
@dmontagu dmontagu deleted the fix/push-config-labels branch March 23, 2026 03:30
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.

variables_push_config() does not push labels/versions despite docstring claim + GET /v1/variables/ returns 500

1 participant