ctxflow-semconv 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,548 @@
1
+ {
2
+ "notes": [
3
+ "`cases`: the baggage entries in the context a span starts in (all values are strings, as on the wire) -> the identity attributes of the span. `warnings` lists the baggage keys the SDK warns about (one warning per key and process: the vector has one span per case). A dropped value never drops the other keys.",
4
+ "Length is in Unicode code points, not bytes or UTF-16 units.",
5
+ "`ctxflow.turn` is an integer attribute in [0, 2**63-1] (beyond 2**53 a JSON reader must keep the digits: JavaScript needs `BigInt`); the other three are strings.",
6
+ "A JSON reader MUST decode integers beyond 2**53 without loss, both in `expected.attributes` (`ctxflow.turn`) and in `conversation[].args.turn` (JavaScript: a `BigInt` reviver or the source text; PHP: `JSON_BIGINT_AS_STRING`).",
7
+ "A case with `int64_only: true` has a valid turn above 2**53-1. An SDK whose OpenTelemetry attribute API cannot hold an int64 (JavaScript) does not copy it: the attribute is absent and the SDK warns about the key, as for an invalid turn; it may also skip the case. The scenarios (tier 2) never use such a turn.",
8
+ "`conversation`: the arguments of the `conversation()` helper -> the baggage it sets (values as strings), or `error`: the argument that is invalid. `turn` may be an integer or a string of ASCII digits (a boolean is not an integer; the baggage keeps the text). Unlike the span side, the helper rejects bad values (it fails where the app writes them)."
9
+ ],
10
+ "cases": [
11
+ {
12
+ "name": "no baggage: no attributes",
13
+ "baggage": {},
14
+ "expected": {
15
+ "attributes": {},
16
+ "warnings": []
17
+ }
18
+ },
19
+ {
20
+ "name": "conversation id only",
21
+ "baggage": {
22
+ "gen_ai.conversation.id": "conv-1"
23
+ },
24
+ "expected": {
25
+ "attributes": {
26
+ "gen_ai.conversation.id": "conv-1"
27
+ },
28
+ "warnings": []
29
+ }
30
+ },
31
+ {
32
+ "name": "all four keys",
33
+ "baggage": {
34
+ "gen_ai.conversation.id": "conv-1",
35
+ "user.id": "user-7",
36
+ "session.id": "sess-3",
37
+ "ctxflow.turn": "4"
38
+ },
39
+ "expected": {
40
+ "attributes": {
41
+ "ctxflow.turn": 4,
42
+ "gen_ai.conversation.id": "conv-1",
43
+ "session.id": "sess-3",
44
+ "user.id": "user-7"
45
+ },
46
+ "warnings": []
47
+ }
48
+ },
49
+ {
50
+ "name": "other baggage keys are not copied",
51
+ "baggage": {
52
+ "tenant": "acme",
53
+ "gen_ai.conversation.id": "c"
54
+ },
55
+ "expected": {
56
+ "attributes": {
57
+ "gen_ai.conversation.id": "c"
58
+ },
59
+ "warnings": []
60
+ }
61
+ },
62
+ {
63
+ "name": "values are kept as they are: no trim",
64
+ "baggage": {
65
+ "user.id": " padded "
66
+ },
67
+ "expected": {
68
+ "attributes": {
69
+ "user.id": " padded "
70
+ },
71
+ "warnings": []
72
+ }
73
+ },
74
+ {
75
+ "name": "an empty string is kept",
76
+ "baggage": {
77
+ "session.id": ""
78
+ },
79
+ "expected": {
80
+ "attributes": {
81
+ "session.id": ""
82
+ },
83
+ "warnings": []
84
+ }
85
+ },
86
+ {
87
+ "name": "unicode values",
88
+ "baggage": {
89
+ "user.id": "usuario-ñ-你好"
90
+ },
91
+ "expected": {
92
+ "attributes": {
93
+ "user.id": "usuario-ñ-你好"
94
+ },
95
+ "warnings": []
96
+ }
97
+ },
98
+ {
99
+ "name": "a value of exactly 256 characters is kept",
100
+ "baggage": {
101
+ "user.id": "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
102
+ },
103
+ "expected": {
104
+ "attributes": {
105
+ "user.id": "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
106
+ },
107
+ "warnings": []
108
+ }
109
+ },
110
+ {
111
+ "name": "a value of 257 characters is dropped, with a warning",
112
+ "baggage": {
113
+ "user.id": "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
114
+ },
115
+ "expected": {
116
+ "attributes": {},
117
+ "warnings": [
118
+ "user.id"
119
+ ]
120
+ }
121
+ },
122
+ {
123
+ "name": "length counts characters, not bytes or UTF-16 units (256 astral characters are kept)",
124
+ "baggage": {
125
+ "gen_ai.conversation.id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
126
+ },
127
+ "expected": {
128
+ "attributes": {
129
+ "gen_ai.conversation.id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
130
+ },
131
+ "warnings": []
132
+ }
133
+ },
134
+ {
135
+ "name": "257 astral characters are dropped",
136
+ "baggage": {
137
+ "gen_ai.conversation.id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
138
+ },
139
+ "expected": {
140
+ "attributes": {},
141
+ "warnings": [
142
+ "gen_ai.conversation.id"
143
+ ]
144
+ }
145
+ },
146
+ {
147
+ "name": "one long value does not drop the others",
148
+ "baggage": {
149
+ "session.id": "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
150
+ "user.id": "u",
151
+ "ctxflow.turn": "1"
152
+ },
153
+ "expected": {
154
+ "attributes": {
155
+ "ctxflow.turn": 1,
156
+ "user.id": "u"
157
+ },
158
+ "warnings": [
159
+ "session.id"
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "name": "turn: zero",
165
+ "baggage": {
166
+ "ctxflow.turn": "0"
167
+ },
168
+ "expected": {
169
+ "attributes": {
170
+ "ctxflow.turn": 0
171
+ },
172
+ "warnings": []
173
+ }
174
+ },
175
+ {
176
+ "name": "turn: leading zeros",
177
+ "baggage": {
178
+ "ctxflow.turn": "007"
179
+ },
180
+ "expected": {
181
+ "attributes": {
182
+ "ctxflow.turn": 7
183
+ },
184
+ "warnings": []
185
+ }
186
+ },
187
+ {
188
+ "name": "turn: int64 maximum",
189
+ "int64_only": true,
190
+ "baggage": {
191
+ "ctxflow.turn": "9223372036854775807"
192
+ },
193
+ "expected": {
194
+ "attributes": {
195
+ "ctxflow.turn": 9223372036854775807
196
+ },
197
+ "warnings": []
198
+ }
199
+ },
200
+ {
201
+ "name": "turn: above int64 is dropped, with a warning",
202
+ "baggage": {
203
+ "ctxflow.turn": "9223372036854775808"
204
+ },
205
+ "expected": {
206
+ "attributes": {},
207
+ "warnings": [
208
+ "ctxflow.turn"
209
+ ]
210
+ }
211
+ },
212
+ {
213
+ "name": "turn: negative is dropped, with a warning",
214
+ "baggage": {
215
+ "ctxflow.turn": "-1"
216
+ },
217
+ "expected": {
218
+ "attributes": {},
219
+ "warnings": [
220
+ "ctxflow.turn"
221
+ ]
222
+ }
223
+ },
224
+ {
225
+ "name": "turn: a decimal is dropped, with a warning",
226
+ "baggage": {
227
+ "ctxflow.turn": "1.5"
228
+ },
229
+ "expected": {
230
+ "attributes": {},
231
+ "warnings": [
232
+ "ctxflow.turn"
233
+ ]
234
+ }
235
+ },
236
+ {
237
+ "name": "turn: surrounding space is dropped, with a warning",
238
+ "baggage": {
239
+ "ctxflow.turn": " 1"
240
+ },
241
+ "expected": {
242
+ "attributes": {},
243
+ "warnings": [
244
+ "ctxflow.turn"
245
+ ]
246
+ }
247
+ },
248
+ {
249
+ "name": "turn: a plus sign is dropped, with a warning",
250
+ "baggage": {
251
+ "ctxflow.turn": "+1"
252
+ },
253
+ "expected": {
254
+ "attributes": {},
255
+ "warnings": [
256
+ "ctxflow.turn"
257
+ ]
258
+ }
259
+ },
260
+ {
261
+ "name": "turn: not a number is dropped, with a warning",
262
+ "baggage": {
263
+ "ctxflow.turn": "first"
264
+ },
265
+ "expected": {
266
+ "attributes": {},
267
+ "warnings": [
268
+ "ctxflow.turn"
269
+ ]
270
+ }
271
+ },
272
+ {
273
+ "name": "turn: empty is dropped, with a warning",
274
+ "baggage": {
275
+ "ctxflow.turn": ""
276
+ },
277
+ "expected": {
278
+ "attributes": {},
279
+ "warnings": [
280
+ "ctxflow.turn"
281
+ ]
282
+ }
283
+ },
284
+ {
285
+ "name": "turn: only ASCII digits count (Arabic-Indic digits are dropped)",
286
+ "baggage": {
287
+ "ctxflow.turn": "١٢"
288
+ },
289
+ "expected": {
290
+ "attributes": {},
291
+ "warnings": [
292
+ "ctxflow.turn"
293
+ ]
294
+ }
295
+ },
296
+ {
297
+ "name": "a bad turn does not drop the other keys",
298
+ "baggage": {
299
+ "gen_ai.conversation.id": "c",
300
+ "ctxflow.turn": "x"
301
+ },
302
+ "expected": {
303
+ "attributes": {
304
+ "gen_ai.conversation.id": "c"
305
+ },
306
+ "warnings": [
307
+ "ctxflow.turn"
308
+ ]
309
+ }
310
+ }
311
+ ],
312
+ "conversation": [
313
+ {
314
+ "name": "conversation id only",
315
+ "args": {
316
+ "conversation_id": "c1"
317
+ },
318
+ "expected": {
319
+ "baggage": {
320
+ "gen_ai.conversation.id": "c1"
321
+ }
322
+ }
323
+ },
324
+ {
325
+ "name": "all arguments",
326
+ "args": {
327
+ "conversation_id": "c1",
328
+ "user_id": "u1",
329
+ "session_id": "s1",
330
+ "turn": 3
331
+ },
332
+ "expected": {
333
+ "baggage": {
334
+ "ctxflow.turn": "3",
335
+ "gen_ai.conversation.id": "c1",
336
+ "session.id": "s1",
337
+ "user.id": "u1"
338
+ }
339
+ }
340
+ },
341
+ {
342
+ "name": "turn zero",
343
+ "args": {
344
+ "conversation_id": "c1",
345
+ "turn": 0
346
+ },
347
+ "expected": {
348
+ "baggage": {
349
+ "ctxflow.turn": "0",
350
+ "gen_ai.conversation.id": "c1"
351
+ }
352
+ }
353
+ },
354
+ {
355
+ "name": "turn as a digit string is accepted",
356
+ "args": {
357
+ "conversation_id": "c1",
358
+ "turn": "3"
359
+ },
360
+ "expected": {
361
+ "baggage": {
362
+ "ctxflow.turn": "3",
363
+ "gen_ai.conversation.id": "c1"
364
+ }
365
+ }
366
+ },
367
+ {
368
+ "name": "turn as a negative string is an error",
369
+ "args": {
370
+ "conversation_id": "c1",
371
+ "turn": "-1"
372
+ },
373
+ "expected": {
374
+ "error": "turn"
375
+ }
376
+ },
377
+ {
378
+ "name": "turn as text is an error",
379
+ "args": {
380
+ "conversation_id": "c1",
381
+ "turn": "x"
382
+ },
383
+ "expected": {
384
+ "error": "turn"
385
+ }
386
+ },
387
+ {
388
+ "name": "turn as a boolean is an error",
389
+ "args": {
390
+ "conversation_id": "c1",
391
+ "turn": true
392
+ },
393
+ "expected": {
394
+ "error": "turn"
395
+ }
396
+ },
397
+ {
398
+ "name": "turn as a decimal number is an error",
399
+ "args": {
400
+ "conversation_id": "c1",
401
+ "turn": 1.5
402
+ },
403
+ "expected": {
404
+ "error": "turn"
405
+ }
406
+ },
407
+ {
408
+ "name": "turn int64 maximum",
409
+ "int64_only": true,
410
+ "args": {
411
+ "conversation_id": "c1",
412
+ "turn": 9223372036854775807
413
+ },
414
+ "expected": {
415
+ "baggage": {
416
+ "ctxflow.turn": "9223372036854775807",
417
+ "gen_ai.conversation.id": "c1"
418
+ }
419
+ }
420
+ },
421
+ {
422
+ "name": "a value of exactly 256 characters",
423
+ "args": {
424
+ "conversation_id": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
425
+ },
426
+ "expected": {
427
+ "baggage": {
428
+ "gen_ai.conversation.id": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
429
+ }
430
+ }
431
+ },
432
+ {
433
+ "name": "256 astral characters",
434
+ "args": {
435
+ "conversation_id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
436
+ },
437
+ "expected": {
438
+ "baggage": {
439
+ "gen_ai.conversation.id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
440
+ }
441
+ }
442
+ },
443
+ {
444
+ "name": "empty conversation id is an error",
445
+ "args": {
446
+ "conversation_id": ""
447
+ },
448
+ "expected": {
449
+ "error": "conversation_id"
450
+ }
451
+ },
452
+ {
453
+ "name": "leading space is an error",
454
+ "args": {
455
+ "conversation_id": " c1"
456
+ },
457
+ "expected": {
458
+ "error": "conversation_id"
459
+ }
460
+ },
461
+ {
462
+ "name": "trailing space is an error",
463
+ "args": {
464
+ "conversation_id": "c1 "
465
+ },
466
+ "expected": {
467
+ "error": "conversation_id"
468
+ }
469
+ },
470
+ {
471
+ "name": "whitespace only is an error",
472
+ "args": {
473
+ "conversation_id": " "
474
+ },
475
+ "expected": {
476
+ "error": "conversation_id"
477
+ }
478
+ },
479
+ {
480
+ "name": "257 characters is an error",
481
+ "args": {
482
+ "conversation_id": "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
483
+ },
484
+ "expected": {
485
+ "error": "conversation_id"
486
+ }
487
+ },
488
+ {
489
+ "name": "257 astral characters is an error",
490
+ "args": {
491
+ "conversation_id": "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
492
+ },
493
+ "expected": {
494
+ "error": "conversation_id"
495
+ }
496
+ },
497
+ {
498
+ "name": "empty user id is an error",
499
+ "args": {
500
+ "conversation_id": "c1",
501
+ "user_id": ""
502
+ },
503
+ "expected": {
504
+ "error": "user_id"
505
+ }
506
+ },
507
+ {
508
+ "name": "user id with a trailing newline is an error",
509
+ "args": {
510
+ "conversation_id": "c1",
511
+ "user_id": "u\n"
512
+ },
513
+ "expected": {
514
+ "error": "user_id"
515
+ }
516
+ },
517
+ {
518
+ "name": "session id of 257 characters is an error",
519
+ "args": {
520
+ "conversation_id": "c1",
521
+ "session_id": "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss"
522
+ },
523
+ "expected": {
524
+ "error": "session_id"
525
+ }
526
+ },
527
+ {
528
+ "name": "negative turn is an error",
529
+ "args": {
530
+ "conversation_id": "c1",
531
+ "turn": -1
532
+ },
533
+ "expected": {
534
+ "error": "turn"
535
+ }
536
+ },
537
+ {
538
+ "name": "turn above int64 is an error",
539
+ "args": {
540
+ "conversation_id": "c1",
541
+ "turn": 9223372036854775808
542
+ },
543
+ "expected": {
544
+ "error": "turn"
545
+ }
546
+ }
547
+ ]
548
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "algorithm": "sha256 over the document bytes as they are, as lowercase hex",
3
+ "notes": [
4
+ "`ctxflow.source_hash`: the bytes of the original document, with no normalization (text is not NFC-normalized and whitespace is kept: a changed byte is a new document). A string input is its UTF-8 bytes. No key: a plain sha256 (ADR-016).",
5
+ "`data_hex` is the document as lowercase hex."
6
+ ],
7
+ "cases": [
8
+ {
9
+ "data_hex": "",
10
+ "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
11
+ },
12
+ {
13
+ "data_hex": "68656c6c6f20776f726c64",
14
+ "hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
15
+ },
16
+ {
17
+ "data_hex": "202068656c6c6f202020776f726c64200a",
18
+ "hash": "a753ebb269cf29d77b2ca52a435dcba55243ed343c6606d3e6af7b2f3b06c07c"
19
+ },
20
+ {
21
+ "data_hex": "636166c3a9",
22
+ "hash": "850f7dc43910ff890f8879c0ed26fe697c93a067ad93a7d50f466a7028a9bf4e"
23
+ },
24
+ {
25
+ "data_hex": "63616665cc81",
26
+ "hash": "81ef060bcd98adc7824eb5c1ada83c32491b16018e11e79f00ab9d09e04b015a"
27
+ },
28
+ {
29
+ "data_hex": "0001fffe2062696e617279",
30
+ "hash": "920c4a551c86f106cb3c4909e84d46d00cdff53586f375dd41adf160cd47c66c"
31
+ },
32
+ {
33
+ "data_hex": "23205469746c650a0a4120646f63756d656e742077697468207365766572616c206c696e65732e0d0a5365636f6e64206c696e652e0a",
34
+ "hash": "c0ea0ad89110dba4ceb07856e6c5ca358ee2c4c16b4b002784162e37594bf371"
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "algorithm": "sha256 over the UTF-8 bytes of the normalized text, as lowercase hex",
3
+ "notes": [
4
+ "Normalization: Unicode NFC, then every run of Unicode White_Space characters (U+0009-U+000D, U+0020, U+0085, U+00A0, U+1680, U+2000-U+200A, U+2028, U+2029, U+202F, U+205F, U+3000) becomes one space, then trim. Case and other characters (zero-width space, ASCII separators U+001C-U+001F) are kept.",
5
+ "A text with nothing left after normalization has no hash (`null`).",
6
+ "No key: the hash is a plain sha256 (ADR-016)."
7
+ ],
8
+ "cases": [
9
+ {
10
+ "text": "hello world",
11
+ "normalized": "hello world",
12
+ "hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
13
+ },
14
+ {
15
+ "text": " hello world \n",
16
+ "normalized": "hello world",
17
+ "hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
18
+ },
19
+ {
20
+ "text": "hello\tworld\r\nagain",
21
+ "normalized": "hello world again",
22
+ "hash": "cbb2d50bd9c870e0f098b9230d66d2f74d55544f2e57f1aabe3830443a040eb6"
23
+ },
24
+ {
25
+ "text": "Hello World",
26
+ "normalized": "Hello World",
27
+ "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
28
+ },
29
+ {
30
+ "text": "café",
31
+ "normalized": "café",
32
+ "hash": "850f7dc43910ff890f8879c0ed26fe697c93a067ad93a7d50f466a7028a9bf4e"
33
+ },
34
+ {
35
+ "text": "café",
36
+ "normalized": "café",
37
+ "hash": "850f7dc43910ff890f8879c0ed26fe697c93a067ad93a7d50f466a7028a9bf4e"
38
+ },
39
+ {
40
+ "text": "Å ngström",
41
+ "normalized": "Å ngström",
42
+ "hash": "815627972e7933ae7230f5caaf02dafb67e7db2316307cb144b28393ad3e79e1"
43
+ },
44
+ {
45
+ "text": "Å ngström",
46
+ "normalized": "Å ngström",
47
+ "hash": "815627972e7933ae7230f5caaf02dafb67e7db2316307cb144b28393ad3e79e1"
48
+ },
49
+ {
50
+ "text": "non breaking and ideographic spaces",
51
+ "normalized": "non breaking and ideographic spaces",
52
+ "hash": "1a1b901fd160357b198202200113ef45bc9d8185feabd0a24244ce4933098b3a"
53
+ },
54
+ {
55
+ "text": "zero​width stays",
56
+ "normalized": "zero​width stays",
57
+ "hash": "c503ac6258d0f62cb6aa9de856be5b855d6e480e42b520ce245eb1bf38e8c747"
58
+ },
59
+ {
60
+ "text": "line
separator
paragraph…next",
61
+ "normalized": "line separator paragraph next",
62
+ "hash": "8114ef7fbe46645a1d9705ea33bae0dcfe1afbc27f029bd890adf00ee3ec540f"
63
+ },
64
+ {
65
+ "text": "\u001ccontrol\u001d separators are not whitespace",
66
+ "normalized": "\u001ccontrol\u001d separators are not whitespace",
67
+ "hash": "fbfc9557b92d91319168614f8f2c6eac92090ee2c010a75e5853569f31a26fbf"
68
+ },
69
+ {
70
+ "text": "한국어 텍스트",
71
+ "normalized": "한국어 텍스트",
72
+ "hash": "df3e7d371f512c92b07486de790c4cbc04b24148f107c588df2435ac3c255bf3"
73
+ },
74
+ {
75
+ "text": "emoji 😀 text",
76
+ "normalized": "emoji 😀 text",
77
+ "hash": "2445bca3cc8ebb2371f0a8b29e57000b0401d4de7f8298b6157dbbdc7d3c54f3"
78
+ },
79
+ {
80
+ "text": "",
81
+ "normalized": "",
82
+ "hash": null
83
+ },
84
+ {
85
+ "text": " \n\t ",
86
+ "normalized": "",
87
+ "hash": null
88
+ }
89
+ ]
90
+ }
File without changes