Repository navigation
Commit 28966fe
authored
feat(push): label assistant versions with the pusher, commit and changed fields (#79)
## Value
**V.A.L.U.E. tier:** small. It is a behavior change: push sends one extra PATCH per published assistant version. Linear: [PRISM-2038](https://linear.app/vapi/issue/PRISM-2038).
- **Problem:** On an org with assistant versioning, each gitops push publishes a new assistant version. The platform records no author on a version written with a private API key (`createdBy` is null), and the audit log only covers dashboard users. So nobody can tell who published a version, from which commit, or what changed.
- **Who it affects:** Teams that manage production assistants with gitops and need to trace a live version back to a person and a change. This matters most during a traffic split, when several versions take calls at once.
- **What changes:**
- **After a push publishes a new assistant version,** push sends `PATCH /assistant/:id/versions/:version` with:
- `versionName`: `gitops <commit>[+dirty] by <actor>`
- `versionDescription`: the actor, the commit, and the dotted paths of the changed fields (`model.messages, voice.voiceId`), within the API's 80 and 500 character limits
- **Actor:** `VAPI_GITOPS_ACTOR`, else `github:$GITHUB_ACTOR`, else `git config user.email`. It is self-reported.
- **Changed fields:** the diff of the dashboard payload fetched before the PATCH (the drift check's GET, reused) against the PATCH response. Server-managed keys are ignored.
- **Skips:** dry runs, and pushes the platform deduplicated (`latestVersion` did not move). A failed label logs a warning and never fails the push.
- **Docs:** `docs/learnings/sync-behavior.md` gets an "Assistant version labels" section.
- **Definition of done:** a push that edits an assistant's prompt shows a version in the dashboard history named `gitops <sha> by <email>`, described with `Changed: model.messages`. It **fails** if a push errors because of the label, or if a no-op push labels anything.
- **Out of scope:**
- Squads: the API has no squad version metadata endpoint.
- Authenticated attribution: storing the API key id on version rows is a platform change in `VapiAI/vapi`.
Small edit since first push: rebased onto current main, preserving both reference validation and version labeling, and sorted the imports.
## Evidence of value
- 10 new unit tests in `tests/version-metadata.test.ts` cover the field diff, the server-key filter, truncation within the API limits, and the actor resolution order.
- Live run on a dev org (2026-10-06), using a throwaway assistant that was deleted afterwards:
- create → `v1` named `gitops 6eeae32+dirty by …`, described `Created by gitops.`
- prompt and first-message edit → `v2` described `Changed: firstMessage, model.messages`
- a second push with no edits published no `v3`
- `createdBy` was `null` on both versions, which confirms the gap this PR fills
## Testing plan
- [x] `npm test`: 546 pass, 0 fail (10 new)
- [x] `npx tsc --noEmit`: clean
- [x] Live: `npm run push -- <sandbox-org>` after editing one assistant prompt, on a versioning-enabled org. Confirm the new version's name and description in `GET /assistant/:id/versions/:version`, and that a second push with no edits adds no label.1 parent a67a4b1 commit 28966fe
5 files changed
Lines changed: 367 additions & 4 deletions
File tree
- docs/learnings
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
250 | 270 | | |
251 | 271 | | |
252 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
170 | 215 | | |
171 | 216 | | |
172 | 217 | | |
| |||
199 | 244 | | |
200 | 245 | | |
201 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
202 | 254 | | |
203 | 255 | | |
204 | 256 | | |
| |||
212 | 264 | | |
213 | 265 | | |
214 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
215 | 271 | | |
216 | 272 | | |
217 | 273 | | |
218 | 274 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | 275 | | |
223 | 276 | | |
224 | 277 | | |
| |||
344 | 397 | | |
345 | 398 | | |
346 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
347 | 407 | | |
348 | 408 | | |
349 | 409 | | |
| |||
748 | 808 | | |
749 | 809 | | |
750 | 810 | | |
751 | | - | |
| 811 | + | |
| 812 | + | |
752 | 813 | | |
753 | 814 | | |
754 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
0 commit comments