Kinto / Kinto/kinto

Event payload attributes on batch requests

Open
#945 9 comments 0 reactions 0 assignees View on GitHub
enhancement question stale
Dominant language
Python
Stars
4.4k
Forks
437
Avg merge
1d 2h
Merged PRs (30d)
15

Description

> This is a follow-up bug of #942

On batch requests, an event is sent for each (parent id / resource / action), and the list of objects is provided in `event.impacted_records`. But the content of `event.payload` makes very little sense in this context, and can lead to serious confusions:

```
>>> event.payload

{ 'action': 'update',
'bucket_id': u'staging',
'collection_id': u'gfx',
'record_id': u'fd6a9531-af10-79a0-e645-4249218dbf4f',
'resource_name': 'record',
'timestamp': 1479999631700L,
'uri': u'/buckets/staging/collections/gfx/records/fd6a9531-af10-79a0-e645-4249218dbf4f',
'user_id': 'basicauth:cbd3731f18c97ebe1d31d9846b5f1b95cf8eeeae586e201277263434041e99d1'}
```

I propose that when there are more than one impacted object then we drop the `${resource_name}_id` and the `uri` keys.

Thoughts?

Contributor guide

Open the contributing guide

Research direction

Start by reading follow-up issue #942 and tracing where batch-request events populate event.payload and event.impacted_records. Compare payloads for single-object and multi-object batches, then identify the existing event tests or request path that covers this behavior. Done means the multi-object payload no longer contains the resource ID or uri while single-object behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.