fix(config): push emits the JSON-Schema shape the server stores#104
Open
brentrager wants to merge 1 commit into
Open
fix(config): push emits the JSON-Schema shape the server stores#104brentrager wants to merge 1 commit into
brentrager wants to merge 1 commit into
Conversation
`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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #102. The server's
pushConfigSchemaVersionstores the POSTedjsonSchemaverbatim, andpushPOSTed 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_schemaconverts manifest→JSON-Schema before POST (camelCase names fromtypes, 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. (3resolve_orgenv-var test failures are pre-existing on main, unrelated, pass in CI.) With #102 + this,th config pushis safe end-to-end; the 22-key drift (SMOOAI_LLM_KEY, MICROSOFT_AUTH, …) + 3 stale payload* is now safely syncable. 🤖 Generated with Claude Code