Skip to content

th config push: emit the server's JSON-Schema shape (land stranded fix) - #179

Merged
brentrager merged 1 commit into
mainfrom
th-config-push-json-schema
Jul 8, 2026
Merged

th config push: emit the server's JSON-Schema shape (land stranded fix)#179
brentrager merged 1 commit into
mainfrom
th-config-push-json-schema

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

th config push POSTed the local manifest doc ({public:[SCREAMING_SNAKE], secret:[...], featureFlag:[...], types:{camelKey:...}}) verbatim. The config server persists the POSTed jsonSchema as-is, so a push would overwrite the stored JSON-Schema form (properties.<tier>ConfigSchema.properties.<camelKey>) — changing the shape every consumer of the stored schema reads. push could never safely carry a real change, even after the diff fix (#102).

Solution

Adds manifest_to_json_schema: converts the manifest to the server's JSON-Schema shape before POST (camelCase property names from types, tier resolved by matching each key's canonical form against the manifest tier arrays; bare type strings become {type: ...}). Already-JSON-Schema input passes through unchanged. Both push paths (update + create) now POST the converted form.

This is a stranded fix (commit 3be5bee) cherry-picked onto main — it was verified absent from main (cmd_push still POSTed local_schema verbatim).

Verification

  • cargo test -p smooai-smooth-cli — 325 passed, including 3 new tests: produces the server shape; passthrough for JSON-Schema input; and the key invariant that the converted form flattens to the SAME key→tier map as the manifest (compute_diff(manifest, converted) empty) — a push is a key-set update, not a format rewrite.
  • rustfmt --check clean; clippy shows only pre-existing workspace pedantic warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LE7V35vzRiHyxBFE8wAxb4

`pushConfigSchemaVersion` persists the POSTed `jsonSchema` verbatim. push was
POSTing the local *manifest* doc (`{public:[SCREAMING_SNAKE], …, types:{…}}`),
which would overwrite the remote's *JSON-Schema* form
(`properties.<tier>ConfigSchema.properties.<camelKey>`) — changing the shape every
consumer of the stored schema reads. So push could never safely carry a real
change, even after the diff was fixed (#102).

Add `manifest_to_json_schema`: converts the manifest to the server's JSON-Schema
shape before POST (camelCase property names from `types`, tier from matching each
key's canonical form against the tier arrays; bare type strings become
`{type: ...}`). Already-JSON-Schema input passes through. Both push paths (update +
create) now POST the converted form.

Tests: produces the server shape; passthrough for JSON-Schema input; and the key
invariant — the converted form flattens to the SAME key→tier map as the manifest
(`compute_diff(manifest, converted)` is empty), so a push is a key-set update, not
a format rewrite. 3 new tests pass (+ the #102 diff tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1666945

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@brentrager
brentrager enabled auto-merge (squash) July 8, 2026 21:44
@brentrager
brentrager merged commit 1cfdc18 into main Jul 8, 2026
2 checks passed
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