Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.6.0
-
Security Level: Public
-
None
Description
In 2.6.0, the revisions returned by the DocumentChanged webhook were the latest revision, rather than the winning revision. This is incorrect behaviour - webhooks should never be sending conflicting, non-winning revisions.
Steps to reproduce:
- Start SG with a document_changed webhook set
- Create a document
- Update the document (with branch A for example)
- Create a conflict from the revision in step 3 (let's say branch B)
- Delete the revision for branch B
- Observe that the webhook body sent in step 5 is actually the revision from step 3 (the now winning revision)
2.6.0:
2.6.0
|
|
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1 -H 'Content-Type: application/json' -d '{"test":true}'
|
{"rev":"1-12ff9ce1dd501524378fe092ce9aee8f","ok":true,"id":"mydoc1"}
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1?rev=1-12ff9ce1dd501524378fe092ce9aee8f -H 'Content-Type: application/json' -d '{"test":true,"update":1,"branch":"A"}'
|
{"id":"mydoc1","rev":"2-66258a11be0ec429274dd7070740231e","ok":true}
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1?new_edits=false -H 'Content-Type: application/json' -d '{"test":true,"update":1,"branch":"B","_revisions":{"start":2,"ids":["newrevid", "12ff9ce1dd501524378fe092ce9aee8f"]}}'
|
{"ok":true,"id":"mydoc1","rev":"2-newrevid"}
|
|
$ curl -X DELETE http://localhost:4985/walrus/mydoc1?rev=2-newrevid
|
{"ok":true,"id":"mydoc1","rev":"3-64cf17340e8bb836d30a8f20376427ad"}
|
|
|
|
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 72
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"_id":"mydoc1","_rev":"1-12ff9ce1dd501524378fe092ce9aee8f","test":true}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 96
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"_id":"mydoc1","_rev":"2-66258a11be0ec429274dd7070740231e","branch":"A","test":true,"update":1}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 151
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"_id":"mydoc1","_rev":"2-newrevid","_revisions":{"ids":["newrevid","12ff9ce1dd501524378fe092ce9aee8f"],"start":2},"branch":"B","test":true,"update":1}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 76
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"_deleted":true,"_id":"mydoc1","_rev":"3-64cf17340e8bb836d30a8f20376427ad"}
|
h3 2.7.0:
2.7.0
|
|
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1 -H 'Content-Type: application/json' -d '{"test":true}'
|
{"rev":"1-12ff9ce1dd501524378fe092ce9aee8f","ok":true,"id":"mydoc1"}
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1?rev=1-12ff9ce1dd501524378fe092ce9aee8f -H 'Content-Type: application/json' -d '{"test":true,"update":1,"branch":"A"}'
|
{"id":"mydoc1","rev":"2-66258a11be0ec429274dd7070740231e","ok":true}
|
|
$ curl -X PUT http://localhost:4985/walrus/mydoc1?new_edits=false -H 'Content-Type: application/json' -d '{"test":true,"update":1,"branch":"B","_revisions":{"start":2,"ids":["newrevid", "12ff9ce1dd501524378fe092ce9aee8f"]}}'
|
{"ok":true,"id":"mydoc1","rev":"2-newrevid"}
|
|
$ curl -X DELETE http://localhost:4985/walrus/mydoc1?rev=2-newrevid
|
{"ok":true,"id":"mydoc1","rev":"3-64cf17340e8bb836d30a8f20376427ad"}
|
|
|
|
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 38
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"test":true,"_id":"mydoc1","_rev":""}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 62
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"branch":"A","test":true,"update":1,"_id":"mydoc1","_rev":""}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 62
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"test":true,"update":1,"branch":"B","_id":"mydoc1","_rev":""}^C
|
|
|
$ nc -l 8000
|
POST /docchanged HTTP/1.1
|
Host: localhost:8000
|
User-Agent: Go-http-client/1.1
|
Content-Length: 137
|
Content-Type: application/json
|
Accept-Encoding: gzip
|
|
{"branch":"A","_id":"mydoc1","_rev":"2-66258a11be0ec429274dd7070740231e","_deleted":true,"test":true,"update":1,"_id":"mydoc1","_rev":""}
|
Attachments
Issue Links
- causes
-
CBG-521 DocumentChanged webhook _rev empty
- Closed