@fleetless/contracts 13.0.1 → 13.1.0

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,22 @@ version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [13.1.0] — 2026-11-03
13
+
14
+ ### Added
15
+
16
+ - `retention_range` member of `journalManifestRow` for retention sweeps of
17
+ `datapoint_series_samples` and `bridge_latency_buckets`. One row names an
18
+ expired time range (`table`, `org_id`, `robot_id`, optional `series_id`,
19
+ `from` inclusive, `cutoff` exclusive, `row_count` and a SHA-256
20
+ `rows_digest` of the sorted row keys the range held when it was frozen)
21
+ instead of one manifest row per deleted row. Replay deletes the rows of the
22
+ range and none at or after its cutoff. `journalManifestBinding` accepts
23
+ ranges only under `history.retention`, `history.slug_delete` and
24
+ `latency.retention`, bound to the intent's organization, robot, series and
25
+ cutoff, with no overlap inside one robot. The per-row `history_sample` and
26
+ `latency_bucket` members stay valid for journals written before.
27
+
12
28
  ## [13.0.1] — 2026-11-03
13
29
 
14
30
  ### Fixed
@@ -843,9 +843,79 @@
843
843
  "audit_id"
844
844
  ],
845
845
  "additionalProperties": false
846
+ },
847
+ {
848
+ "type": "object",
849
+ "properties": {
850
+ "type": {
851
+ "type": "string",
852
+ "const": "retention_range"
853
+ },
854
+ "membership_kind": {
855
+ "type": "string",
856
+ "const": "affected"
857
+ },
858
+ "table": {
859
+ "type": "string",
860
+ "enum": [
861
+ "datapoint_series_samples",
862
+ "bridge_latency_buckets"
863
+ ],
864
+ "description": "The table the range was deleted from."
865
+ },
866
+ "org_id": {
867
+ "type": "string",
868
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
869
+ },
870
+ "robot_id": {
871
+ "type": "string",
872
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
873
+ },
874
+ "series_id": {
875
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
876
+ "type": "integer",
877
+ "minimum": 1,
878
+ "maximum": 9007199254740991
879
+ },
880
+ "from": {
881
+ "type": "string",
882
+ "format": "date-time",
883
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
884
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
885
+ },
886
+ "cutoff": {
887
+ "type": "string",
888
+ "format": "date-time",
889
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
890
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
891
+ },
892
+ "row_count": {
893
+ "type": "integer",
894
+ "minimum": 1,
895
+ "maximum": 9007199254740991,
896
+ "description": "How many rows the range held when it was frozen."
897
+ },
898
+ "rows_digest": {
899
+ "type": "string",
900
+ "pattern": "^[0-9a-f]{64}$",
901
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
902
+ }
903
+ },
904
+ "required": [
905
+ "type",
906
+ "membership_kind",
907
+ "table",
908
+ "org_id",
909
+ "robot_id",
910
+ "from",
911
+ "cutoff",
912
+ "row_count",
913
+ "rows_digest"
914
+ ],
915
+ "additionalProperties": false
846
916
  }
847
917
  ],
848
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
918
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
849
919
  }
850
920
  },
851
921
  "batches": {
@@ -1464,9 +1534,79 @@
1464
1534
  "audit_id"
1465
1535
  ],
1466
1536
  "additionalProperties": false
1537
+ },
1538
+ {
1539
+ "type": "object",
1540
+ "properties": {
1541
+ "type": {
1542
+ "type": "string",
1543
+ "const": "retention_range"
1544
+ },
1545
+ "membership_kind": {
1546
+ "type": "string",
1547
+ "const": "affected"
1548
+ },
1549
+ "table": {
1550
+ "type": "string",
1551
+ "enum": [
1552
+ "datapoint_series_samples",
1553
+ "bridge_latency_buckets"
1554
+ ],
1555
+ "description": "The table the range was deleted from."
1556
+ },
1557
+ "org_id": {
1558
+ "type": "string",
1559
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1560
+ },
1561
+ "robot_id": {
1562
+ "type": "string",
1563
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1564
+ },
1565
+ "series_id": {
1566
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
1567
+ "type": "integer",
1568
+ "minimum": 1,
1569
+ "maximum": 9007199254740991
1570
+ },
1571
+ "from": {
1572
+ "type": "string",
1573
+ "format": "date-time",
1574
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
1575
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
1576
+ },
1577
+ "cutoff": {
1578
+ "type": "string",
1579
+ "format": "date-time",
1580
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
1581
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
1582
+ },
1583
+ "row_count": {
1584
+ "type": "integer",
1585
+ "minimum": 1,
1586
+ "maximum": 9007199254740991,
1587
+ "description": "How many rows the range held when it was frozen."
1588
+ },
1589
+ "rows_digest": {
1590
+ "type": "string",
1591
+ "pattern": "^[0-9a-f]{64}$",
1592
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
1593
+ }
1594
+ },
1595
+ "required": [
1596
+ "type",
1597
+ "membership_kind",
1598
+ "table",
1599
+ "org_id",
1600
+ "robot_id",
1601
+ "from",
1602
+ "cutoff",
1603
+ "row_count",
1604
+ "rows_digest"
1605
+ ],
1606
+ "additionalProperties": false
1467
1607
  }
1468
1608
  ],
1469
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
1609
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
1470
1610
  }
1471
1611
  }
1472
1612
  },
@@ -2069,9 +2209,79 @@
2069
2209
  "audit_id"
2070
2210
  ],
2071
2211
  "additionalProperties": false
2212
+ },
2213
+ {
2214
+ "type": "object",
2215
+ "properties": {
2216
+ "type": {
2217
+ "type": "string",
2218
+ "const": "retention_range"
2219
+ },
2220
+ "membership_kind": {
2221
+ "type": "string",
2222
+ "const": "affected"
2223
+ },
2224
+ "table": {
2225
+ "type": "string",
2226
+ "enum": [
2227
+ "datapoint_series_samples",
2228
+ "bridge_latency_buckets"
2229
+ ],
2230
+ "description": "The table the range was deleted from."
2231
+ },
2232
+ "org_id": {
2233
+ "type": "string",
2234
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2235
+ },
2236
+ "robot_id": {
2237
+ "type": "string",
2238
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2239
+ },
2240
+ "series_id": {
2241
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
2242
+ "type": "integer",
2243
+ "minimum": 1,
2244
+ "maximum": 9007199254740991
2245
+ },
2246
+ "from": {
2247
+ "type": "string",
2248
+ "format": "date-time",
2249
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
2250
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
2251
+ },
2252
+ "cutoff": {
2253
+ "type": "string",
2254
+ "format": "date-time",
2255
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
2256
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
2257
+ },
2258
+ "row_count": {
2259
+ "type": "integer",
2260
+ "minimum": 1,
2261
+ "maximum": 9007199254740991,
2262
+ "description": "How many rows the range held when it was frozen."
2263
+ },
2264
+ "rows_digest": {
2265
+ "type": "string",
2266
+ "pattern": "^[0-9a-f]{64}$",
2267
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
2268
+ }
2269
+ },
2270
+ "required": [
2271
+ "type",
2272
+ "membership_kind",
2273
+ "table",
2274
+ "org_id",
2275
+ "robot_id",
2276
+ "from",
2277
+ "cutoff",
2278
+ "row_count",
2279
+ "rows_digest"
2280
+ ],
2281
+ "additionalProperties": false
2072
2282
  }
2073
2283
  ],
2074
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
2284
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
2075
2285
  }
2076
2286
  }
2077
2287
  },
@@ -613,9 +613,79 @@
613
613
  "audit_id"
614
614
  ],
615
615
  "additionalProperties": false
616
+ },
617
+ {
618
+ "type": "object",
619
+ "properties": {
620
+ "type": {
621
+ "type": "string",
622
+ "const": "retention_range"
623
+ },
624
+ "membership_kind": {
625
+ "type": "string",
626
+ "const": "affected"
627
+ },
628
+ "table": {
629
+ "type": "string",
630
+ "enum": [
631
+ "datapoint_series_samples",
632
+ "bridge_latency_buckets"
633
+ ],
634
+ "description": "The table the range was deleted from."
635
+ },
636
+ "org_id": {
637
+ "type": "string",
638
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
639
+ },
640
+ "robot_id": {
641
+ "type": "string",
642
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
643
+ },
644
+ "series_id": {
645
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
646
+ "type": "integer",
647
+ "minimum": 1,
648
+ "maximum": 9007199254740991
649
+ },
650
+ "from": {
651
+ "type": "string",
652
+ "format": "date-time",
653
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
654
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
655
+ },
656
+ "cutoff": {
657
+ "type": "string",
658
+ "format": "date-time",
659
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
660
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
661
+ },
662
+ "row_count": {
663
+ "type": "integer",
664
+ "minimum": 1,
665
+ "maximum": 9007199254740991,
666
+ "description": "How many rows the range held when it was frozen."
667
+ },
668
+ "rows_digest": {
669
+ "type": "string",
670
+ "pattern": "^[0-9a-f]{64}$",
671
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
672
+ }
673
+ },
674
+ "required": [
675
+ "type",
676
+ "membership_kind",
677
+ "table",
678
+ "org_id",
679
+ "robot_id",
680
+ "from",
681
+ "cutoff",
682
+ "row_count",
683
+ "rows_digest"
684
+ ],
685
+ "additionalProperties": false
616
686
  }
617
687
  ],
618
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
688
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
619
689
  }
620
690
  }
621
691
  },
@@ -1218,9 +1288,79 @@
1218
1288
  "audit_id"
1219
1289
  ],
1220
1290
  "additionalProperties": false
1291
+ },
1292
+ {
1293
+ "type": "object",
1294
+ "properties": {
1295
+ "type": {
1296
+ "type": "string",
1297
+ "const": "retention_range"
1298
+ },
1299
+ "membership_kind": {
1300
+ "type": "string",
1301
+ "const": "affected"
1302
+ },
1303
+ "table": {
1304
+ "type": "string",
1305
+ "enum": [
1306
+ "datapoint_series_samples",
1307
+ "bridge_latency_buckets"
1308
+ ],
1309
+ "description": "The table the range was deleted from."
1310
+ },
1311
+ "org_id": {
1312
+ "type": "string",
1313
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1314
+ },
1315
+ "robot_id": {
1316
+ "type": "string",
1317
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1318
+ },
1319
+ "series_id": {
1320
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
1321
+ "type": "integer",
1322
+ "minimum": 1,
1323
+ "maximum": 9007199254740991
1324
+ },
1325
+ "from": {
1326
+ "type": "string",
1327
+ "format": "date-time",
1328
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
1329
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
1330
+ },
1331
+ "cutoff": {
1332
+ "type": "string",
1333
+ "format": "date-time",
1334
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
1335
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
1336
+ },
1337
+ "row_count": {
1338
+ "type": "integer",
1339
+ "minimum": 1,
1340
+ "maximum": 9007199254740991,
1341
+ "description": "How many rows the range held when it was frozen."
1342
+ },
1343
+ "rows_digest": {
1344
+ "type": "string",
1345
+ "pattern": "^[0-9a-f]{64}$",
1346
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
1347
+ }
1348
+ },
1349
+ "required": [
1350
+ "type",
1351
+ "membership_kind",
1352
+ "table",
1353
+ "org_id",
1354
+ "robot_id",
1355
+ "from",
1356
+ "cutoff",
1357
+ "row_count",
1358
+ "rows_digest"
1359
+ ],
1360
+ "additionalProperties": false
1221
1361
  }
1222
1362
  ],
1223
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
1363
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
1224
1364
  }
1225
1365
  }
1226
1366
  },
@@ -2273,9 +2273,79 @@
2273
2273
  "audit_id"
2274
2274
  ],
2275
2275
  "additionalProperties": false
2276
+ },
2277
+ {
2278
+ "type": "object",
2279
+ "properties": {
2280
+ "type": {
2281
+ "type": "string",
2282
+ "const": "retention_range"
2283
+ },
2284
+ "membership_kind": {
2285
+ "type": "string",
2286
+ "const": "affected"
2287
+ },
2288
+ "table": {
2289
+ "type": "string",
2290
+ "enum": [
2291
+ "datapoint_series_samples",
2292
+ "bridge_latency_buckets"
2293
+ ],
2294
+ "description": "The table the range was deleted from."
2295
+ },
2296
+ "org_id": {
2297
+ "type": "string",
2298
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2299
+ },
2300
+ "robot_id": {
2301
+ "type": "string",
2302
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2303
+ },
2304
+ "series_id": {
2305
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
2306
+ "type": "integer",
2307
+ "minimum": 1,
2308
+ "maximum": 9007199254740991
2309
+ },
2310
+ "from": {
2311
+ "type": "string",
2312
+ "format": "date-time",
2313
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
2314
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
2315
+ },
2316
+ "cutoff": {
2317
+ "type": "string",
2318
+ "format": "date-time",
2319
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
2320
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
2321
+ },
2322
+ "row_count": {
2323
+ "type": "integer",
2324
+ "minimum": 1,
2325
+ "maximum": 9007199254740991,
2326
+ "description": "How many rows the range held when it was frozen."
2327
+ },
2328
+ "rows_digest": {
2329
+ "type": "string",
2330
+ "pattern": "^[0-9a-f]{64}$",
2331
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
2332
+ }
2333
+ },
2334
+ "required": [
2335
+ "type",
2336
+ "membership_kind",
2337
+ "table",
2338
+ "org_id",
2339
+ "robot_id",
2340
+ "from",
2341
+ "cutoff",
2342
+ "row_count",
2343
+ "rows_digest"
2344
+ ],
2345
+ "additionalProperties": false
2276
2346
  }
2277
2347
  ],
2278
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
2348
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
2279
2349
  }
2280
2350
  },
2281
2351
  "batches": {
@@ -2894,9 +2964,79 @@
2894
2964
  "audit_id"
2895
2965
  ],
2896
2966
  "additionalProperties": false
2967
+ },
2968
+ {
2969
+ "type": "object",
2970
+ "properties": {
2971
+ "type": {
2972
+ "type": "string",
2973
+ "const": "retention_range"
2974
+ },
2975
+ "membership_kind": {
2976
+ "type": "string",
2977
+ "const": "affected"
2978
+ },
2979
+ "table": {
2980
+ "type": "string",
2981
+ "enum": [
2982
+ "datapoint_series_samples",
2983
+ "bridge_latency_buckets"
2984
+ ],
2985
+ "description": "The table the range was deleted from."
2986
+ },
2987
+ "org_id": {
2988
+ "type": "string",
2989
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2990
+ },
2991
+ "robot_id": {
2992
+ "type": "string",
2993
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2994
+ },
2995
+ "series_id": {
2996
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
2997
+ "type": "integer",
2998
+ "minimum": 1,
2999
+ "maximum": 9007199254740991
3000
+ },
3001
+ "from": {
3002
+ "type": "string",
3003
+ "format": "date-time",
3004
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
3005
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
3006
+ },
3007
+ "cutoff": {
3008
+ "type": "string",
3009
+ "format": "date-time",
3010
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
3011
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
3012
+ },
3013
+ "row_count": {
3014
+ "type": "integer",
3015
+ "minimum": 1,
3016
+ "maximum": 9007199254740991,
3017
+ "description": "How many rows the range held when it was frozen."
3018
+ },
3019
+ "rows_digest": {
3020
+ "type": "string",
3021
+ "pattern": "^[0-9a-f]{64}$",
3022
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
3023
+ }
3024
+ },
3025
+ "required": [
3026
+ "type",
3027
+ "membership_kind",
3028
+ "table",
3029
+ "org_id",
3030
+ "robot_id",
3031
+ "from",
3032
+ "cutoff",
3033
+ "row_count",
3034
+ "rows_digest"
3035
+ ],
3036
+ "additionalProperties": false
2897
3037
  }
2898
3038
  ],
2899
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
3039
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
2900
3040
  }
2901
3041
  }
2902
3042
  },
@@ -3499,9 +3639,79 @@
3499
3639
  "audit_id"
3500
3640
  ],
3501
3641
  "additionalProperties": false
3642
+ },
3643
+ {
3644
+ "type": "object",
3645
+ "properties": {
3646
+ "type": {
3647
+ "type": "string",
3648
+ "const": "retention_range"
3649
+ },
3650
+ "membership_kind": {
3651
+ "type": "string",
3652
+ "const": "affected"
3653
+ },
3654
+ "table": {
3655
+ "type": "string",
3656
+ "enum": [
3657
+ "datapoint_series_samples",
3658
+ "bridge_latency_buckets"
3659
+ ],
3660
+ "description": "The table the range was deleted from."
3661
+ },
3662
+ "org_id": {
3663
+ "type": "string",
3664
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
3665
+ },
3666
+ "robot_id": {
3667
+ "type": "string",
3668
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
3669
+ },
3670
+ "series_id": {
3671
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
3672
+ "type": "integer",
3673
+ "minimum": 1,
3674
+ "maximum": 9007199254740991
3675
+ },
3676
+ "from": {
3677
+ "type": "string",
3678
+ "format": "date-time",
3679
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
3680
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
3681
+ },
3682
+ "cutoff": {
3683
+ "type": "string",
3684
+ "format": "date-time",
3685
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
3686
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
3687
+ },
3688
+ "row_count": {
3689
+ "type": "integer",
3690
+ "minimum": 1,
3691
+ "maximum": 9007199254740991,
3692
+ "description": "How many rows the range held when it was frozen."
3693
+ },
3694
+ "rows_digest": {
3695
+ "type": "string",
3696
+ "pattern": "^[0-9a-f]{64}$",
3697
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
3698
+ }
3699
+ },
3700
+ "required": [
3701
+ "type",
3702
+ "membership_kind",
3703
+ "table",
3704
+ "org_id",
3705
+ "robot_id",
3706
+ "from",
3707
+ "cutoff",
3708
+ "row_count",
3709
+ "rows_digest"
3710
+ ],
3711
+ "additionalProperties": false
3502
3712
  }
3503
3713
  ],
3504
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
3714
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
3505
3715
  }
3506
3716
  }
3507
3717
  },
@@ -572,7 +572,77 @@
572
572
  "audit_id"
573
573
  ],
574
574
  "additionalProperties": false
575
+ },
576
+ {
577
+ "type": "object",
578
+ "properties": {
579
+ "type": {
580
+ "type": "string",
581
+ "const": "retention_range"
582
+ },
583
+ "membership_kind": {
584
+ "type": "string",
585
+ "const": "affected"
586
+ },
587
+ "table": {
588
+ "type": "string",
589
+ "enum": [
590
+ "datapoint_series_samples",
591
+ "bridge_latency_buckets"
592
+ ],
593
+ "description": "The table the range was deleted from."
594
+ },
595
+ "org_id": {
596
+ "type": "string",
597
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
598
+ },
599
+ "robot_id": {
600
+ "type": "string",
601
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
602
+ },
603
+ "series_id": {
604
+ "description": "The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.",
605
+ "type": "integer",
606
+ "minimum": 1,
607
+ "maximum": 9007199254740991
608
+ },
609
+ "from": {
610
+ "type": "string",
611
+ "format": "date-time",
612
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
613
+ "description": "Inclusive lower bound of the deleted range (UTC, milliseconds)."
614
+ },
615
+ "cutoff": {
616
+ "type": "string",
617
+ "format": "date-time",
618
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$",
619
+ "description": "Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff."
620
+ },
621
+ "row_count": {
622
+ "type": "integer",
623
+ "minimum": 1,
624
+ "maximum": 9007199254740991,
625
+ "description": "How many rows the range held when it was frozen."
626
+ },
627
+ "rows_digest": {
628
+ "type": "string",
629
+ "pattern": "^[0-9a-f]{64}$",
630
+ "description": "SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted."
631
+ }
632
+ },
633
+ "required": [
634
+ "type",
635
+ "membership_kind",
636
+ "table",
637
+ "org_id",
638
+ "robot_id",
639
+ "from",
640
+ "cutoff",
641
+ "row_count",
642
+ "rows_digest"
643
+ ],
644
+ "additionalProperties": false
575
645
  }
576
646
  ],
577
- "description": "JSON Schema consumers must also check uuid_row generation equality and exact physical identity."
647
+ "description": "JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends."
578
648
  }
@@ -181,6 +181,20 @@ export declare const journalManifestRow: z.ZodUnion<readonly [z.ZodObject<{
181
181
  affected: "affected";
182
182
  unaffected: "unaffected";
183
183
  }>;
184
+ }, z.core.$strict>, z.ZodObject<{
185
+ type: z.ZodLiteral<"retention_range">;
186
+ membership_kind: z.ZodLiteral<"affected">;
187
+ table: z.ZodEnum<{
188
+ datapoint_series_samples: "datapoint_series_samples";
189
+ bridge_latency_buckets: "bridge_latency_buckets";
190
+ }>;
191
+ org_id: z.ZodString;
192
+ robot_id: z.ZodString;
193
+ series_id: z.ZodOptional<z.ZodNumber>;
194
+ from: z.ZodISODateTime;
195
+ cutoff: z.ZodISODateTime;
196
+ row_count: z.ZodNumber;
197
+ rows_digest: z.ZodString;
184
198
  }, z.core.$strict>]>;
185
199
  export type JournalManifestRow = z.infer<typeof journalManifestRow>;
186
200
  export declare const journalManifestEntry: z.ZodUnion<readonly [z.ZodObject<{
@@ -382,6 +396,20 @@ export declare const journalManifestBatch: z.ZodUnion<readonly [z.ZodObject<{
382
396
  affected: "affected";
383
397
  unaffected: "unaffected";
384
398
  }>;
399
+ }, z.core.$strict>, z.ZodObject<{
400
+ type: z.ZodLiteral<"retention_range">;
401
+ membership_kind: z.ZodLiteral<"affected">;
402
+ table: z.ZodEnum<{
403
+ datapoint_series_samples: "datapoint_series_samples";
404
+ bridge_latency_buckets: "bridge_latency_buckets";
405
+ }>;
406
+ org_id: z.ZodString;
407
+ robot_id: z.ZodString;
408
+ series_id: z.ZodOptional<z.ZodNumber>;
409
+ from: z.ZodISODateTime;
410
+ cutoff: z.ZodISODateTime;
411
+ row_count: z.ZodNumber;
412
+ rows_digest: z.ZodString;
385
413
  }, z.core.$strict>]>>;
386
414
  }, z.core.$strict>, z.ZodObject<{
387
415
  batch_id: z.ZodString;
@@ -544,6 +572,20 @@ export declare const journalManifestBatch: z.ZodUnion<readonly [z.ZodObject<{
544
572
  affected: "affected";
545
573
  unaffected: "unaffected";
546
574
  }>;
575
+ }, z.core.$strict>, z.ZodObject<{
576
+ type: z.ZodLiteral<"retention_range">;
577
+ membership_kind: z.ZodLiteral<"affected">;
578
+ table: z.ZodEnum<{
579
+ datapoint_series_samples: "datapoint_series_samples";
580
+ bridge_latency_buckets: "bridge_latency_buckets";
581
+ }>;
582
+ org_id: z.ZodString;
583
+ robot_id: z.ZodString;
584
+ series_id: z.ZodOptional<z.ZodNumber>;
585
+ from: z.ZodISODateTime;
586
+ cutoff: z.ZodISODateTime;
587
+ row_count: z.ZodNumber;
588
+ rows_digest: z.ZodString;
547
589
  }, z.core.$strict>]>>;
548
590
  }, z.core.$strict>]>;
549
591
  export type JournalManifestBatch = z.infer<typeof journalManifestBatch>;
@@ -759,6 +801,20 @@ export declare const journalDeletionManifest: z.ZodObject<{
759
801
  affected: "affected";
760
802
  unaffected: "unaffected";
761
803
  }>;
804
+ }, z.core.$strict>, z.ZodObject<{
805
+ type: z.ZodLiteral<"retention_range">;
806
+ membership_kind: z.ZodLiteral<"affected">;
807
+ table: z.ZodEnum<{
808
+ datapoint_series_samples: "datapoint_series_samples";
809
+ bridge_latency_buckets: "bridge_latency_buckets";
810
+ }>;
811
+ org_id: z.ZodString;
812
+ robot_id: z.ZodString;
813
+ series_id: z.ZodOptional<z.ZodNumber>;
814
+ from: z.ZodISODateTime;
815
+ cutoff: z.ZodISODateTime;
816
+ row_count: z.ZodNumber;
817
+ rows_digest: z.ZodString;
762
818
  }, z.core.$strict>]>>;
763
819
  batches: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
764
820
  batch_id: z.ZodString;
@@ -935,6 +991,20 @@ export declare const journalDeletionManifest: z.ZodObject<{
935
991
  affected: "affected";
936
992
  unaffected: "unaffected";
937
993
  }>;
994
+ }, z.core.$strict>, z.ZodObject<{
995
+ type: z.ZodLiteral<"retention_range">;
996
+ membership_kind: z.ZodLiteral<"affected">;
997
+ table: z.ZodEnum<{
998
+ datapoint_series_samples: "datapoint_series_samples";
999
+ bridge_latency_buckets: "bridge_latency_buckets";
1000
+ }>;
1001
+ org_id: z.ZodString;
1002
+ robot_id: z.ZodString;
1003
+ series_id: z.ZodOptional<z.ZodNumber>;
1004
+ from: z.ZodISODateTime;
1005
+ cutoff: z.ZodISODateTime;
1006
+ row_count: z.ZodNumber;
1007
+ rows_digest: z.ZodString;
938
1008
  }, z.core.$strict>]>>;
939
1009
  }, z.core.$strict>, z.ZodObject<{
940
1010
  batch_id: z.ZodString;
@@ -1097,6 +1167,20 @@ export declare const journalDeletionManifest: z.ZodObject<{
1097
1167
  affected: "affected";
1098
1168
  unaffected: "unaffected";
1099
1169
  }>;
1170
+ }, z.core.$strict>, z.ZodObject<{
1171
+ type: z.ZodLiteral<"retention_range">;
1172
+ membership_kind: z.ZodLiteral<"affected">;
1173
+ table: z.ZodEnum<{
1174
+ datapoint_series_samples: "datapoint_series_samples";
1175
+ bridge_latency_buckets: "bridge_latency_buckets";
1176
+ }>;
1177
+ org_id: z.ZodString;
1178
+ robot_id: z.ZodString;
1179
+ series_id: z.ZodOptional<z.ZodNumber>;
1180
+ from: z.ZodISODateTime;
1181
+ cutoff: z.ZodISODateTime;
1182
+ row_count: z.ZodNumber;
1183
+ rows_digest: z.ZodString;
1100
1184
  }, z.core.$strict>]>>;
1101
1185
  }, z.core.$strict>]>>;
1102
1186
  }, z.core.$strict>;
@@ -1324,6 +1408,20 @@ export declare const journalManifestBinding: z.ZodObject<{
1324
1408
  affected: "affected";
1325
1409
  unaffected: "unaffected";
1326
1410
  }>;
1411
+ }, z.core.$strict>, z.ZodObject<{
1412
+ type: z.ZodLiteral<"retention_range">;
1413
+ membership_kind: z.ZodLiteral<"affected">;
1414
+ table: z.ZodEnum<{
1415
+ datapoint_series_samples: "datapoint_series_samples";
1416
+ bridge_latency_buckets: "bridge_latency_buckets";
1417
+ }>;
1418
+ org_id: z.ZodString;
1419
+ robot_id: z.ZodString;
1420
+ series_id: z.ZodOptional<z.ZodNumber>;
1421
+ from: z.ZodISODateTime;
1422
+ cutoff: z.ZodISODateTime;
1423
+ row_count: z.ZodNumber;
1424
+ rows_digest: z.ZodString;
1327
1425
  }, z.core.$strict>]>>;
1328
1426
  batches: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1329
1427
  batch_id: z.ZodString;
@@ -1500,6 +1598,20 @@ export declare const journalManifestBinding: z.ZodObject<{
1500
1598
  affected: "affected";
1501
1599
  unaffected: "unaffected";
1502
1600
  }>;
1601
+ }, z.core.$strict>, z.ZodObject<{
1602
+ type: z.ZodLiteral<"retention_range">;
1603
+ membership_kind: z.ZodLiteral<"affected">;
1604
+ table: z.ZodEnum<{
1605
+ datapoint_series_samples: "datapoint_series_samples";
1606
+ bridge_latency_buckets: "bridge_latency_buckets";
1607
+ }>;
1608
+ org_id: z.ZodString;
1609
+ robot_id: z.ZodString;
1610
+ series_id: z.ZodOptional<z.ZodNumber>;
1611
+ from: z.ZodISODateTime;
1612
+ cutoff: z.ZodISODateTime;
1613
+ row_count: z.ZodNumber;
1614
+ rows_digest: z.ZodString;
1503
1615
  }, z.core.$strict>]>>;
1504
1616
  }, z.core.$strict>, z.ZodObject<{
1505
1617
  batch_id: z.ZodString;
@@ -1662,6 +1774,20 @@ export declare const journalManifestBinding: z.ZodObject<{
1662
1774
  affected: "affected";
1663
1775
  unaffected: "unaffected";
1664
1776
  }>;
1777
+ }, z.core.$strict>, z.ZodObject<{
1778
+ type: z.ZodLiteral<"retention_range">;
1779
+ membership_kind: z.ZodLiteral<"affected">;
1780
+ table: z.ZodEnum<{
1781
+ datapoint_series_samples: "datapoint_series_samples";
1782
+ bridge_latency_buckets: "bridge_latency_buckets";
1783
+ }>;
1784
+ org_id: z.ZodString;
1785
+ robot_id: z.ZodString;
1786
+ series_id: z.ZodOptional<z.ZodNumber>;
1787
+ from: z.ZodISODateTime;
1788
+ cutoff: z.ZodISODateTime;
1789
+ row_count: z.ZodNumber;
1790
+ rows_digest: z.ZodString;
1665
1791
  }, z.core.$strict>]>>;
1666
1792
  }, z.core.$strict>]>>;
1667
1793
  }, z.core.$strict>;
@@ -24,6 +24,8 @@ const uuidRowTable = z.enum([
24
24
  'organization_exports', 'ops_notification_jobs', 'console_oauth_codes',
25
25
  ]);
26
26
  const member = { membership_kind: membership };
27
+ // Retention sweeps name an expired time range instead of every deleted row.
28
+ const retentionRangeTable = z.enum(['datapoint_series_samples', 'bridge_latency_buckets']);
27
29
  export const journalManifestRow = z.union([
28
30
  z.strictObject({ ...member, type: z.literal('uuid_row'), table: uuidRowTable, id: uuid, row_generation: uuid }),
29
31
  z.strictObject({ ...member, type: z.literal('basic_activity_observation'), org_id: uuid, audit_event_id: uuid }),
@@ -44,11 +46,30 @@ export const journalManifestRow = z.union([
44
46
  z.strictObject({ ...member, type: z.literal('global_ops_event'), event_id: uuid }),
45
47
  z.strictObject({ ...member, type: z.literal('org_operator_audit'), org_id: uuid, audit_id: uuid }),
46
48
  z.strictObject({ ...member, type: z.literal('global_operator_audit'), audit_id: uuid }),
49
+ z.strictObject({
50
+ type: z.literal('retention_range'),
51
+ membership_kind: z.literal('affected'),
52
+ table: retentionRangeTable.meta({ description: 'The table the range was deleted from.' }),
53
+ org_id: uuid,
54
+ robot_id: uuid,
55
+ series_id: positive.optional().meta({ description: 'The one datapoint series of the range; absent when the range covers every series of the robot. Never set for latency buckets.' }),
56
+ from: utcMillis.meta({ description: 'Inclusive lower bound of the deleted range (UTC, milliseconds).' }),
57
+ cutoff: utcMillis.meta({ description: 'Exclusive upper bound of the deleted range (UTC, milliseconds). Replay deletes every row of the table inside [from, cutoff) for this robot and series and no row at or after the cutoff.' }),
58
+ row_count: positive.meta({ description: 'How many rows the range held when it was frozen.' }),
59
+ rows_digest: hash.meta({ description: 'SHA-256 over the sorted row keys the range held when it was frozen (retention range digest v1); lets a backup of the range be checked against what was deleted.' }),
60
+ }),
47
61
  ]).superRefine((row, ctx) => {
48
62
  if (row.type === 'uuid_row' && row.row_generation !== row.id) {
49
63
  ctx.addIssue({ code: 'custom', path: ['row_generation'], message: 'Immutable UUID row generation must equal its ID' });
50
64
  }
51
- }).describe('JSON Schema consumers must also check uuid_row generation equality and exact physical identity.');
65
+ if (row.type === 'retention_range') {
66
+ if (row.from >= row.cutoff)
67
+ ctx.addIssue({ code: 'custom', path: ['cutoff'], message: 'A retention range must end after it starts' });
68
+ if (row.table === 'bridge_latency_buckets' && row.series_id !== undefined) {
69
+ ctx.addIssue({ code: 'custom', path: ['series_id'], message: 'Latency buckets are not kept per series' });
70
+ }
71
+ }
72
+ }).describe('JSON Schema consumers must also check uuid_row generation equality, exact physical identity and that a retention range starts before it ends.');
52
73
  const entry = { mapping_id: uuid, source_project_id: opaqueId, source_bucket: opaqueId,
53
74
  old_key: opaqueId, version_ids: z.array(opaqueId).min(1), membership_kind: membership };
54
75
  export const journalManifestEntry = z.union([
@@ -92,6 +113,7 @@ function rowKey(row) {
92
113
  case 'global_ops_event': return JSON.stringify(['ops_events', row.event_id]);
93
114
  case 'org_operator_audit':
94
115
  case 'global_operator_audit': return JSON.stringify(['operator_audit', row.audit_id]);
116
+ case 'retention_range': return JSON.stringify([row.table, 'range', row.robot_id, row.series_id ?? null, row.from]);
95
117
  }
96
118
  }
97
119
  function entryKey(value) { return JSON.stringify([value.kind, value.mapping_id]); }
@@ -128,6 +150,53 @@ const nonOrganizationScope = {
128
150
  'operator_audit.retention': 'operator_audit',
129
151
  'auth_factor.remove': 'subject',
130
152
  };
153
+ const rangeTableOfKind = {
154
+ 'history.retention': 'datapoint_series_samples',
155
+ 'history.slug_delete': 'datapoint_series_samples',
156
+ 'latency.retention': 'bridge_latency_buckets',
157
+ };
158
+ /**
159
+ * A retention range belongs to exactly the history and latency retention
160
+ * kinds, stays inside the organization, robot, series and cutoff of its
161
+ * intent, and no two ranges of one robot overlap (a robot's ranges name a
162
+ * series all or none of them).
163
+ */
164
+ function retentionRangeProblems(kind, ids, ranges) {
165
+ const problems = [];
166
+ const table = rangeTableOfKind[kind];
167
+ if (table === undefined)
168
+ return ['Retention ranges belong only to history and latency retention'];
169
+ for (const range of ranges) {
170
+ if (range.table !== table)
171
+ problems.push('Range table does not match the intent kind');
172
+ if (range.org_id !== ids.org_id)
173
+ problems.push('Range organization does not match the intent');
174
+ if (kind === 'history.slug_delete' && (range.robot_id !== ids.robot_id || range.series_id !== ids.series_id)) {
175
+ problems.push('Range robot or series does not match the intent');
176
+ }
177
+ if (kind !== 'history.slug_delete' && typeof ids.cutoff_at === 'string' && range.cutoff > ids.cutoff_at) {
178
+ problems.push('Range reaches past the sweep cutoff');
179
+ }
180
+ }
181
+ const byRobot = new Map();
182
+ for (const range of ranges)
183
+ byRobot.set(range.robot_id, [...(byRobot.get(range.robot_id) ?? []), range]);
184
+ for (const group of byRobot.values()) {
185
+ if (new Set(group.map((range) => range.series_id === undefined)).size > 1) {
186
+ problems.push('A robot\'s ranges must name a series all or none');
187
+ continue;
188
+ }
189
+ const bySeries = new Map();
190
+ for (const range of group)
191
+ bySeries.set(range.series_id, [...(bySeries.get(range.series_id) ?? []), range]);
192
+ for (const series of bySeries.values()) {
193
+ const ordered = [...series].sort((a, b) => (a.from < b.from ? -1 : a.from > b.from ? 1 : 0));
194
+ if (ordered.some((range, index) => index > 0 && range.from < ordered[index - 1].cutoff))
195
+ problems.push('Ranges of one robot overlap');
196
+ }
197
+ }
198
+ return problems;
199
+ }
131
200
  /** A structural candidate; it is not a signed intent or protected readback. */
132
201
  export const journalManifestBinding = z.strictObject({
133
202
  intent: journalManifestIntentProjection, manifest: journalDeletionManifest,
@@ -159,6 +228,10 @@ export const journalManifestBinding = z.strictObject({
159
228
  const allows = allowedRows[manifest.scope.kind];
160
229
  if (allows && !manifest.rows.every(allows))
161
230
  problem('Row outside closed source scope', ['manifest', 'rows']);
231
+ const ranges = manifest.rows.filter((row) => row.type === 'retention_range');
232
+ if (ranges.length > 0)
233
+ for (const message of new Set(retentionRangeProblems(intent.kind, ids, ranges)))
234
+ problem(message, ['manifest', 'rows']);
162
235
  const isSweep = sweepKinds.some((kind) => kind === intent.kind);
163
236
  const isExplicit = explicitKinds.some((kind) => kind === intent.kind);
164
237
  if (isSweep || isExplicit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetless/contracts",
3
- "version": "13.0.1",
3
+ "version": "13.1.0",
4
4
  "description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dehne Robotik GmbH",