Repository navigation
fix(sync): store latestVersion in state and omit it from PATCH - #80
Open
TimKrieg01 wants to merge 1 commit into
Open
TimKrieg01 wants to merge 1 commit into
TimKrieg01 wants to merge 1 commit into
Conversation
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.
Summary
Keep Vapi's
latestVersionas per-resource state metadata instead of storing it in resource configuration, capture it from pulls and push responses, and never send it in tool, assistant, or squad PATCH payloads.Why
There are two separate drift problems this change addresses:
v6tov7; the PATCH response containslatestVersion: v7, but the local resource file remains atv6. The baseline then reflectsv7while the file still reflectsv6, so a later audit can incorrectly report local-ahead even when the actual config matches. Writing the returned version back into the resource file could fix this symptom, but would keep server metadata mixed into authored config.latestVersiondescribes the current Vapi-side version state; it is not desired assistant, tool, or squad configuration. For example, a dashboard change is published asv7, then reverted and published asv8, while localv6has the same config asv8. Including the version in the resource hash can falsely report dashboard-ahead; if there is also a separate local edit, the version-only delta can make the classifier report a false both-diverged conflict. Store the version beside the UUID in the state file and compare resource config without it.The API also rejects
latestVersionwhen sent in a tool PATCH. A direct PATCH API-request test tool with only its current version returned:A GET immediately afterward still reported
latestVersion: v2and the sameupdatedAt, so the rejected probe did not change the tool.Changes
latestVersionbeside its UUID in.vapi-state.<org>.json, keeping version metadata out of the resource file and its content hash."my-tool": { "uuid": "<uuid>", "latestVersion": "v8" }; the tool YAML contains only the desired tool configuration.latestVersionfrom PATCH payloads for tools, assistants, and squads. This prevents the Vapi tool PATCH validation error and avoids sending server-managed metadata as authored config.Verification
npm run buildnpm test(544 tests passed).vapi-state.<org>.json; assistant edits that Vapi kept as drafts did not advancelatestVersion. A rollback that restored a config matching an earlier version did not produce version-only drift or a merge conflict.latestVersionreturns400 Bad Requestwithproperty latestVersion should not exist.