Skip to content

fix(config): push emits the JSON-Schema shape the server stores#104

Open
brentrager wants to merge 1 commit into
mainfrom
fix-config-push-emit-json-schema
Open

fix(config): push emits the JSON-Schema shape the server stores#104
brentrager wants to merge 1 commit into
mainfrom
fix-config-push-emit-json-schema

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Follow-up to #102. The server's pushConfigSchemaVersion stores the POSTed jsonSchema verbatim, and push POSTed the local manifest doc — so a real push would overwrite the remote's JSON-Schema form, changing the shape every consumer reads. Fix: manifest_to_json_schema converts manifest→JSON-Schema before POST (camelCase names from types, tier via canonical match, bare type→{type:…}; already-JSON-Schema passes through); both push paths use it. Tests: produces the server shape; passthrough; and the key invariant that the converted form flattens to the SAME key→tier map as the manifest (compute_diff(manifest, converted) empty) — a key-set update, not a format rewrite. 3 new tests green; cargo build clean. (3 resolve_org env-var test failures are pre-existing on main, unrelated, pass in CI.) With #102 + this, th config push is safe end-to-end; the 22-key drift (SMOOAI_LLM_KEY, MICROSOFT_AUTH, …) + 3 stale payload* is now safely syncable. 🤖 Generated with Claude Code

`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 Jun 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3be5bee

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

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