fsanyoto commited on
Commit
3db9c6a
·
verified ·
1 Parent(s): 9567e44

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,35 +1,485 @@
1
  {
2
- "current": "v81 (e141ccc85)",
3
  "releases": [
4
  {
5
  "version": "v81",
6
- "sha": "e141ccc85",
7
  "date": "2026-10-15",
8
  "subject": "release v81"
9
  },
10
  {
11
  "version": "v80",
12
- "sha": "869b8fcc6",
13
  "date": "2026-10-13",
14
  "subject": "release v80"
15
  },
16
  {
17
  "version": "v79",
18
- "sha": "406417b8d",
19
  "date": "2026-10-13",
20
  "subject": "release v79"
21
  },
22
  {
23
  "version": "v78",
24
- "sha": "aad6561d6",
25
  "date": "2026-10-09",
26
  "subject": "release v78: SDLC 71 with the D-7536 and D-7537 repairs"
27
  },
28
  {
29
  "version": "v77",
30
- "sha": "e741e5ca6",
31
  "date": "2026-10-05",
32
  "subject": "release v77"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
  ]
35
  }
 
1
  {
2
+ "current": "426e3d12cddb (426e3d12cddb)",
3
  "releases": [
4
  {
5
  "version": "v81",
6
+ "sha": "e141ccc85ef0",
7
  "date": "2026-10-15",
8
  "subject": "release v81"
9
  },
10
  {
11
  "version": "v80",
12
+ "sha": "869b8fcc62ac",
13
  "date": "2026-10-13",
14
  "subject": "release v80"
15
  },
16
  {
17
  "version": "v79",
18
+ "sha": "406417b8ded0",
19
  "date": "2026-10-13",
20
  "subject": "release v79"
21
  },
22
  {
23
  "version": "v78",
24
+ "sha": "aad6561d63e6",
25
  "date": "2026-10-09",
26
  "subject": "release v78: SDLC 71 with the D-7536 and D-7537 repairs"
27
  },
28
  {
29
  "version": "v77",
30
+ "sha": "e741e5ca604d",
31
  "date": "2026-10-05",
32
  "subject": "release v77"
33
+ },
34
+ {
35
+ "version": "v76",
36
+ "sha": "7990f03e0254",
37
+ "date": "2026-10-01",
38
+ "subject": "release v76"
39
+ },
40
+ {
41
+ "version": "v75",
42
+ "sha": "2c5146981ccf",
43
+ "date": "2026-09-19",
44
+ "subject": "release v75"
45
+ },
46
+ {
47
+ "version": "v74",
48
+ "sha": "40dceba9262e",
49
+ "date": "2026-09-14",
50
+ "subject": "release v74: waves 58+59 incl. the Amazon credential door (W59-T21/22/23) and sync producer (W59-T42); hotfix promote so"
51
+ },
52
+ {
53
+ "version": "v73",
54
+ "sha": "bb94de5665e6",
55
+ "date": "2026-09-13",
56
+ "subject": "release v73"
57
+ },
58
+ {
59
+ "version": "v71",
60
+ "sha": "96143dc6fb65",
61
+ "date": "2026-09-04",
62
+ "subject": "release v71 - wave 51, QA'd 24 PASS / 6 FAIL / 5 UNPROVEN"
63
+ },
64
+ {
65
+ "version": "v70",
66
+ "sha": "eedfb6a00163",
67
+ "date": "2026-09-03",
68
+ "subject": "release v70 - wave 50 (grid analytics, the Sheet as a spreadsheet, view trash and audit)"
69
+ },
70
+ {
71
+ "version": "v69",
72
+ "sha": "8598f56293a0",
73
+ "date": "2026-09-02",
74
+ "subject": "release v69: wave48-continuation validated + hotfixes v67/v68/d4e3e31 + go-live QA repairs (Supplier option limit, optio"
75
+ },
76
+ {
77
+ "version": "v68",
78
+ "sha": "62b065a2610a",
79
+ "date": "2026-09-01",
80
+ "subject": "release v68: unified holiday date offsets"
81
+ },
82
+ {
83
+ "version": "v67",
84
+ "sha": "3b2241982cf7",
85
+ "date": "2026-09-01",
86
+ "subject": "release v67"
87
+ },
88
+ {
89
+ "version": "v66",
90
+ "sha": "73c94f076740",
91
+ "date": "2026-08-31",
92
+ "subject": "release v66"
93
+ },
94
+ {
95
+ "version": "v65",
96
+ "sha": "9f6cfedb8a43",
97
+ "date": "2026-08-31",
98
+ "subject": "release v65"
99
+ },
100
+ {
101
+ "version": "v64",
102
+ "sha": "bb8985c6e73e",
103
+ "date": "2026-08-31",
104
+ "subject": "release v64"
105
+ },
106
+ {
107
+ "version": "v63",
108
+ "sha": "ec75cb8f3412",
109
+ "date": "2026-08-31",
110
+ "subject": "release v63"
111
+ },
112
+ {
113
+ "version": "v62",
114
+ "sha": "2c8f702c964f",
115
+ "date": "2026-08-31",
116
+ "subject": "release v62"
117
+ },
118
+ {
119
+ "version": "v61",
120
+ "sha": "bbc4c0760ab5",
121
+ "date": "2026-08-30",
122
+ "subject": "v61 - wave 46 hotfix: D-590 schema overlay reaches the grid read (all three assemblies), D-599 route to zone association"
123
+ },
124
+ {
125
+ "version": "v60",
126
+ "sha": "dd1b0620210e",
127
+ "date": "2026-08-30",
128
+ "subject": "v60 - wave 46"
129
+ },
130
+ {
131
+ "version": "v59",
132
+ "sha": "3cb73ce8021e",
133
+ "date": "2026-08-29",
134
+ "subject": "release v59"
135
+ },
136
+ {
137
+ "version": "v58",
138
+ "sha": "c526cede82f9",
139
+ "date": "2026-08-29",
140
+ "subject": "release v58"
141
+ },
142
+ {
143
+ "version": "v57",
144
+ "sha": "4859c035e6a7",
145
+ "date": "2026-08-29",
146
+ "subject": "release v57"
147
+ },
148
+ {
149
+ "version": "v56",
150
+ "sha": "2970b729e8f0",
151
+ "date": "2026-08-28",
152
+ "subject": "release v56"
153
+ },
154
+ {
155
+ "version": "v55",
156
+ "sha": "b766b904b8fa",
157
+ "date": "2026-08-28",
158
+ "subject": "release v55"
159
+ },
160
+ {
161
+ "version": "v54",
162
+ "sha": "6a8e99a064d9",
163
+ "date": "2026-08-27",
164
+ "subject": "release v54"
165
+ },
166
+ {
167
+ "version": "v53",
168
+ "sha": "89ed2cb867da",
169
+ "date": "2026-08-24",
170
+ "subject": "release v53"
171
+ },
172
+ {
173
+ "version": "v52",
174
+ "sha": "826349376241",
175
+ "date": "2026-08-23",
176
+ "subject": "release v52"
177
+ },
178
+ {
179
+ "version": "v51",
180
+ "sha": "5740d20fa585",
181
+ "date": "2026-08-23",
182
+ "subject": "release v51"
183
+ },
184
+ {
185
+ "version": "v50",
186
+ "sha": "8027c83d1da6",
187
+ "date": "2026-08-23",
188
+ "subject": "release v50"
189
+ },
190
+ {
191
+ "version": "v49",
192
+ "sha": "9a14c01a48a4",
193
+ "date": "2026-08-23",
194
+ "subject": "release v49"
195
+ },
196
+ {
197
+ "version": "v48",
198
+ "sha": "3c69fd93da7c",
199
+ "date": "2026-08-23",
200
+ "subject": "release v48"
201
+ },
202
+ {
203
+ "version": "v47",
204
+ "sha": "917f9a0eb509",
205
+ "date": "2026-08-23",
206
+ "subject": "release v47"
207
+ },
208
+ {
209
+ "version": "v46",
210
+ "sha": "a8dc531b5078",
211
+ "date": "2026-08-23",
212
+ "subject": "release v46"
213
+ },
214
+ {
215
+ "version": "v45",
216
+ "sha": "0b2b5010d86f",
217
+ "date": "2026-08-23",
218
+ "subject": "release v45"
219
+ },
220
+ {
221
+ "version": "v44",
222
+ "sha": "a7877aaf20ff",
223
+ "date": "2026-08-23",
224
+ "subject": "Hotfix: allow renaming the active Map view"
225
+ },
226
+ {
227
+ "version": "v43",
228
+ "sha": "e2ba4616fa0f",
229
+ "date": "2026-08-23",
230
+ "subject": "release v43"
231
+ },
232
+ {
233
+ "version": "v42",
234
+ "sha": "25b885e6373a",
235
+ "date": "2026-08-23",
236
+ "subject": "release v42"
237
+ },
238
+ {
239
+ "version": "v41",
240
+ "sha": "1d6adcc3c3ac",
241
+ "date": "2026-08-22",
242
+ "subject": "v41 vertical route navigation"
243
+ },
244
+ {
245
+ "version": "v40",
246
+ "sha": "1451837168f3",
247
+ "date": "2026-08-22",
248
+ "subject": "release v40 route UI correction"
249
+ },
250
+ {
251
+ "version": "v39",
252
+ "sha": "a78bdf00e38e",
253
+ "date": "2026-08-21",
254
+ "subject": "W39 clean stale migration targets"
255
+ },
256
+ {
257
+ "version": "v38",
258
+ "sha": "a556631cf979",
259
+ "date": "2026-08-21",
260
+ "subject": "W39 reversible Live store cutover"
261
+ },
262
+ {
263
+ "version": "v37",
264
+ "sha": "1ddd8cf82379",
265
+ "date": "2026-08-21",
266
+ "subject": "W39: coalesce derived workspace reads"
267
+ },
268
+ {
269
+ "version": "v36",
270
+ "sha": "51db3b7fee2c",
271
+ "date": "2026-08-21",
272
+ "subject": "W39 share-field oid repair"
273
+ },
274
+ {
275
+ "version": "v35",
276
+ "sha": "0f642129c8f7",
277
+ "date": "2026-08-21",
278
+ "subject": "W39 visual QA fixture"
279
+ },
280
+ {
281
+ "version": "v34",
282
+ "sha": "cb4caa188e05",
283
+ "date": "2026-08-21",
284
+ "subject": "W39 Staging PostgreSQL egress controls"
285
+ },
286
+ {
287
+ "version": "v33",
288
+ "sha": "2b115e573d6a",
289
+ "date": "2026-08-21",
290
+ "subject": "W39: stop nonproduction Postgres background egress"
291
+ },
292
+ {
293
+ "version": "v32",
294
+ "sha": "b47b27ca7b2a",
295
+ "date": "2026-08-21",
296
+ "subject": "W39: repair Staging Postgres projection"
297
+ },
298
+ {
299
+ "version": "v31",
300
+ "sha": "8880a49a244e",
301
+ "date": "2026-08-21",
302
+ "subject": "v31: Wave 39 staging candidate"
303
+ },
304
+ {
305
+ "version": "v30",
306
+ "sha": "71776ca6c8df",
307
+ "date": "2026-08-20",
308
+ "subject": "v30: W39-T29 Member-owned View first-share hotfix"
309
+ },
310
+ {
311
+ "version": "v29",
312
+ "sha": "55ced5018ff2",
313
+ "date": "2026-08-18",
314
+ "subject": "v29: the build staging has been running since 2026-08-18 (55ced50)."
315
+ },
316
+ {
317
+ "version": "v28",
318
+ "sha": "2793e4ba53dc",
319
+ "date": "2026-08-18",
320
+ "subject": "release v28"
321
+ },
322
+ {
323
+ "version": "v27",
324
+ "sha": "c05a794837fc",
325
+ "date": "2026-08-18",
326
+ "subject": "release v27"
327
+ },
328
+ {
329
+ "version": "v25",
330
+ "sha": "bc248295ed66",
331
+ "date": "2026-08-14",
332
+ "subject": "v25 - wave 32's LIVE build (deployed 2026-08-13, bc24829)"
333
+ },
334
+ {
335
+ "version": "v26",
336
+ "sha": "6a642e139cfa",
337
+ "date": "2026-08-14",
338
+ "subject": "v26 - wave 33's build (deployed 2026-08-14, 6a642e1)"
339
+ },
340
+ {
341
+ "version": "v24",
342
+ "sha": "514d8292ce73",
343
+ "date": "2026-08-09",
344
+ "subject": "release v24"
345
+ },
346
+ {
347
+ "version": "v23",
348
+ "sha": "44cc28380fca",
349
+ "date": "2026-08-09",
350
+ "subject": "release v23"
351
+ },
352
+ {
353
+ "version": "v22",
354
+ "sha": "f14e199ff32f",
355
+ "date": "2026-08-09",
356
+ "subject": "release v22"
357
+ },
358
+ {
359
+ "version": "v21",
360
+ "sha": "5fdffce8b558",
361
+ "date": "2026-08-09",
362
+ "subject": "release v21"
363
+ },
364
+ {
365
+ "version": "v20",
366
+ "sha": "442e4a1430a7",
367
+ "date": "2026-08-09",
368
+ "subject": "release v20"
369
+ },
370
+ {
371
+ "version": "v19",
372
+ "sha": "94cb4a4dfdfe",
373
+ "date": "2026-08-09",
374
+ "subject": "release v19"
375
+ },
376
+ {
377
+ "version": "v18",
378
+ "sha": "0106ef949805",
379
+ "date": "2026-08-09",
380
+ "subject": "release v18"
381
+ },
382
+ {
383
+ "version": "v17",
384
+ "sha": "308240cc75e8",
385
+ "date": "2026-08-09",
386
+ "subject": "release v17"
387
+ },
388
+ {
389
+ "version": "v16",
390
+ "sha": "a804df54430f",
391
+ "date": "2026-08-09",
392
+ "subject": "release v16"
393
+ },
394
+ {
395
+ "version": "v15",
396
+ "sha": "6b84d7264c81",
397
+ "date": "2026-08-09",
398
+ "subject": "release v15"
399
+ },
400
+ {
401
+ "version": "v14",
402
+ "sha": "bee5eaf5b5cb",
403
+ "date": "2026-08-07",
404
+ "subject": "release v14"
405
+ },
406
+ {
407
+ "version": "v13",
408
+ "sha": "314c0e368b1d",
409
+ "date": "2026-08-06",
410
+ "subject": "release v13"
411
+ },
412
+ {
413
+ "version": "v12",
414
+ "sha": "4908f399785d",
415
+ "date": "2026-08-06",
416
+ "subject": "release v12"
417
+ },
418
+ {
419
+ "version": "v11",
420
+ "sha": "312661712b98",
421
+ "date": "2026-08-05",
422
+ "subject": "release v11"
423
+ },
424
+ {
425
+ "version": "v10",
426
+ "sha": "43f804287496",
427
+ "date": "2026-08-05",
428
+ "subject": "release v10"
429
+ },
430
+ {
431
+ "version": "v9",
432
+ "sha": "2e26f57396b1",
433
+ "date": "2026-08-05",
434
+ "subject": "release v9"
435
+ },
436
+ {
437
+ "version": "v8",
438
+ "sha": "8073b3ecbac3",
439
+ "date": "2026-08-05",
440
+ "subject": "release v8"
441
+ },
442
+ {
443
+ "version": "v7",
444
+ "sha": "b1c5a7e9b848",
445
+ "date": "2026-08-05",
446
+ "subject": "release v7"
447
+ },
448
+ {
449
+ "version": "v6",
450
+ "sha": "a344020f114a",
451
+ "date": "2026-08-05",
452
+ "subject": "release v6"
453
+ },
454
+ {
455
+ "version": "v5",
456
+ "sha": "c0b0fbb40a7b",
457
+ "date": "2026-08-05",
458
+ "subject": "release v5"
459
+ },
460
+ {
461
+ "version": "v4",
462
+ "sha": "de5037ff1c8f",
463
+ "date": "2026-08-05",
464
+ "subject": "release v4"
465
+ },
466
+ {
467
+ "version": "v3",
468
+ "sha": "6b9fa62d93e8",
469
+ "date": "2026-08-05",
470
+ "subject": "release v3"
471
+ },
472
+ {
473
+ "version": "v2",
474
+ "sha": "fd0586199858",
475
+ "date": "2026-08-04",
476
+ "subject": "release v2"
477
+ },
478
+ {
479
+ "version": "v1",
480
+ "sha": "5b4e2c4bc3f3",
481
+ "date": "2026-08-04",
482
+ "subject": "release v1"
483
  }
484
  ]
485
  }
VERSION CHANGED
@@ -1 +1 @@
1
- v81 (e141ccc85)
 
1
+ 426e3d12cddb (426e3d12cddb)
api/routes_assets.py CHANGED
@@ -55,16 +55,18 @@ def _application_error(exc):
55
  raise err(status, "application_not_found" if status == 404 else "bad_application", message)
56
 
57
 
58
- def application_access_context(session, databases, *, strict=False):
59
  """Return readable databases plus governed semantic records, without exposing refused names."""
60
  from core import perm_scope
61
- from harness import semantic as sem
62
  allowed, records = set(), {}
63
  for database in dict.fromkeys(str(value or "").strip() for value in databases or ()):
64
  if not database:
65
  continue
66
- topic = next((row for row in sem.topics().values()
67
- if isinstance(row, dict) and row.get("grid") == database), None)
 
 
 
68
  # S68-T42 / CA-F1: a user table has no semantic topic, and `perm_scope.may_read` already
69
  # answers it (creator, admin or a share grant). Refusing it left every App bound to a user
70
  # table unopenable and undeletable (S67-T39 finding). It carries no governed records, so a
@@ -77,7 +79,7 @@ def application_access_context(session, databases, *, strict=False):
77
  raise PermissionError("that database is not available")
78
  continue
79
  allowed.add(database)
80
- if user_table:
81
  records[database] = {}
82
  continue
83
  baseline = semantic_rt.topic_records(database, topic)
@@ -328,7 +330,8 @@ def application_index(database: str = "", type: str = "", starred: bool | None =
328
  raise err(400, "bad_application", "application type is not recognized")
329
  candidates = [database] if database else _application_databases(session.runtime)
330
  try:
331
- allowed, _ = application_access_context(session, candidates, strict=bool(database))
 
332
  except PermissionError as exc:
333
  _application_error(exc)
334
  return {"applications": applications.list_apps(
 
55
  raise err(status, "application_not_found" if status == 404 else "bad_application", message)
56
 
57
 
58
+ def application_access_context(session, databases, *, strict=False, include_records=True):
59
  """Return readable databases plus governed semantic records, without exposing refused names."""
60
  from core import perm_scope
 
61
  allowed, records = set(), {}
62
  for database in dict.fromkeys(str(value or "").strip() for value in databases or ()):
63
  if not database:
64
  continue
65
+ topic = None
66
+ if include_records or not database.startswith("ut_"):
67
+ from harness import semantic as sem
68
+ topic = next((row for row in sem.topics().values()
69
+ if isinstance(row, dict) and row.get("grid") == database), None)
70
  # S68-T42 / CA-F1: a user table has no semantic topic, and `perm_scope.may_read` already
71
  # answers it (creator, admin or a share grant). Refusing it left every App bound to a user
72
  # table unopenable and undeletable (S67-T39 finding). It carries no governed records, so a
 
79
  raise PermissionError("that database is not available")
80
  continue
81
  allowed.add(database)
82
+ if user_table or not include_records:
83
  records[database] = {}
84
  continue
85
  baseline = semantic_rt.topic_records(database, topic)
 
330
  raise err(400, "bad_application", "application type is not recognized")
331
  candidates = [database] if database else _application_databases(session.runtime)
332
  try:
333
+ allowed, _ = application_access_context(
334
+ session, candidates, strict=bool(database), include_records=False)
335
  except PermissionError as exc:
336
  _application_error(exc)
337
  return {"applications": applications.list_apps(
api/routes_odoo_tables.py CHANGED
@@ -2585,14 +2585,22 @@ def _relation_rows(session, table, columns, *, ids=None, match=None, matches=Non
2585
  # The revision memo serves a caller that handed this request's token (the page's link fills,
2586
  # S67-T28); any other caller reads exactly as before, which is also what lets
2587
  # `verify_grid_ux.py` exec this function alone with a stubbed `perm_scope`.
2588
- fields, rows = (perm_scope._read(table, session.user, session.runtime) if rev is ...
2589
- else _stored_link_rows(session, table, token=rev))
2590
- rows = perm_scope.apply_row_scope(rows, session.user, table, fields, st=session.runtime)
2591
- if where:
2592
- raise err(409, "relation_target_unavailable", "This relation needs a connected database predicate.")
 
2593
  if ids is not None:
2594
  wanted = {str(value) for value in ids}
2595
  rows = [row for row in rows if str(row.get("pid")) in wanted]
 
 
 
 
 
 
 
2596
  if match is not None:
2597
  key, values = match
2598
  normalize = ((lambda value: str(value).strip().lower()) if normalize_match
 
2585
  # The revision memo serves a caller that handed this request's token (the page's link fills,
2586
  # S67-T28); any other caller reads exactly as before, which is also what lets
2587
  # `verify_grid_ux.py` exec this function alone with a stubbed `perm_scope`.
2588
+ definition = _ut().get(table, st=st) if st is not None else None
2589
+ if rev is ...:
2590
+ fields, rows = (perm_scope._read(table, session.user, session.runtime, defn=definition)
2591
+ if definition is not None else perm_scope._read(table, session.user, session.runtime))
2592
+ else:
2593
+ fields, rows = _stored_link_rows(session, table, token=rev)
2594
  if ids is not None:
2595
  wanted = {str(value) for value in ids}
2596
  rows = [row for row in rows if str(row.get("pid")) in wanted]
2597
+ if definition is None:
2598
+ rows = perm_scope.apply_row_scope(rows, session.user, table, fields, st=session.runtime)
2599
+ else:
2600
+ rows = perm_scope.apply_row_scope(rows, session.user, table, fields,
2601
+ st=session.runtime, defn=definition)
2602
+ if where:
2603
+ raise err(409, "relation_target_unavailable", "This relation needs a connected database predicate.")
2604
  if match is not None:
2605
  key, values = match
2606
  normalize = ((lambda value: str(value).strip().lower()) if normalize_match
api/routes_sheet.py CHANGED
@@ -1593,7 +1593,13 @@ def activity_read_policy(session: Session, object):
1593
  if database in {"customer_data", "product_data"} and any(
1594
  perm_scope.derive_pool_scope(session.user, database)):
1595
  return False
1596
- grid = _registry_assembly(borrowed, database, with_rows=False)
 
 
 
 
 
 
1597
  fields = (grid.get("defn") or {}).get("fields", grid.get("fields", []))
1598
  if grid.get("hidden") or perm_scope.hidden_keys(session.user, database, fields, st=reader):
1599
  return False
 
1593
  if database in {"customer_data", "product_data"} and any(
1594
  perm_scope.derive_pool_scope(session.user, database)):
1595
  return False
1596
+ # Activity needs the complete field wall, without display usage and metric catalogs.
1597
+ resolve = (memo.get("activity_source_fields")
1598
+ if isinstance(memo, dict) and database.startswith("ut_") else None)
1599
+ grid = (resolve(database) if callable(resolve)
1600
+ else _registry_assembly(borrowed, database, with_rows=False))
1601
+ if grid is None:
1602
+ return False
1603
  fields = (grid.get("defn") or {}).get("fields", grid.get("fields", []))
1604
  if grid.get("hidden") or perm_scope.hidden_keys(session.user, database, fields, st=reader):
1605
  return False
api/routes_tables.py CHANGED
@@ -547,7 +547,7 @@ def _activity_cursor(session, query, position=None, token=None):
547
 
548
 
549
  def query_activity(session: Session, *, object=None, by=None, since=None, until=None,
550
- cursor=None, limit=100, scan_limit=10000):
551
  """Read a session-bound activity page through both activity and current source permissions."""
552
  import routes_agent_harness
553
  import routes_sheet
@@ -555,24 +555,40 @@ def query_activity(session: Session, *, object=None, by=None, since=None, until=
555
  with (routes_sheet._sheet_request_scope(session), activity_log.read_scope(session.runtime),
556
  routes_agent_harness.activity_read_scope(session)):
557
  return _query_activity_page(session, object=object, by=by, since=since, until=until,
558
- cursor=cursor, limit=limit, scan_limit=scan_limit)
 
559
 
560
 
561
  def _query_activity_page(session: Session, *, object=None, by=None, since=None, until=None,
562
- cursor=None, limit=100, scan_limit=10000):
563
  """Resolve one activity page within its caller's request scope."""
564
  from core import activity_log, perm_scope
565
 
566
  key = activity_log.DATABASE_KEY
567
  # Borrow definitions and grants for this call only; each cursor request rebuilds them.
568
  context_store = _table_lend(session.runtime, key, defs_only=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  memo = getattr(session, '_sheet_read_memo', None)
570
  if isinstance(memo, dict):
571
  memo['permission_reader'] = context_store
572
  memo['activity_permission_identity'] = (session.tenant, session.uname, id(session.runtime))
573
  own = _defn_or_refuse(session, key, st=context_store, defs_only=True, scope_applied=True)
574
- own_grid = _compute_ut_assembly(session, key, st=context_store, with_rows=False, fields_only=True,
575
- include_usage=False, include_measures=False)
 
576
  own_keys = {f['key'] for f in own_grid['fields']}
577
  query = [object, by, since, until]
578
  position = _activity_cursor(session, query, token=cursor) if cursor else None
@@ -585,6 +601,7 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
585
  source_pids = {}
586
  partners = {}
587
  connected = set()
 
588
  applications = None
589
 
590
  def source(database):
@@ -597,9 +614,10 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
597
  definition = _defn_or_refuse(session, database, st=context_store,
598
  defs_only=True, scope_applied=True)
599
  windowed = not _ut().materialises(database, st=session.runtime, defn=definition)
600
- g = _compute_ut_assembly(session, database, st=context_store,
601
- with_rows=False, fields_only=windowed,
602
- include_usage=False, include_measures=False)
 
603
  if windowed:
604
  connected.add(database)
605
  elif database in ('customer_data', 'product_data'):
@@ -616,6 +634,8 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
616
  if exc.status_code not in (403, 404, 409):
617
  raise
618
  contexts[database] = None
 
 
619
  return contexts[database]
620
 
621
  def partner(obj):
@@ -645,6 +665,9 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
645
  partners[identity] = admitted
646
  return admitted
647
 
 
 
 
648
  def can_read_object(obj):
649
  # T64 gives this resolver the object only. Event-kind checks and value scrubbing follow.
650
  return source(str(obj['database'])) is not None if 'database' in obj else partner(obj)
@@ -657,9 +680,8 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
657
  object=object, by=by, since=since, until=until,
658
  cursor=position, limit=limit, scan_limit=scan_limit)
659
  position = raw['next_cursor']
660
- # Resolve only this page's source ids through the connected grid's existing SQL wall.
661
- # Whole-pool admission would hide all record events once a source exceeds its window.
662
- for database in connected:
663
  wanted = {str(event['object']['id']) for event in raw['records']
664
  if event['object'].get('database') == database and event['kind'] not in ('field', 'view')
665
  and str(event['object']['id']).isdigit()}
@@ -667,11 +689,19 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
667
  from routes_odoo_tables import _relation_rows
668
  try:
669
  contexts[database]['pids'] = frozenset(
670
- row['pid'] for row in _relation_rows(session, database, {'pid'}, ids=wanted))
 
671
  except HTTPException as exc:
672
  if exc.status_code not in (403, 404, 409):
673
  raise
674
- contexts[database]['pids'] = frozenset()
 
 
 
 
 
 
 
675
  source_pids[database] = frozenset(str(pid) for pid in contexts[database]['pids'])
676
  scoped = perm_scope.apply_row_scope(raw['records'], session.user, key, own['fields'],
677
  st=session.runtime, defn=own)
@@ -736,8 +766,11 @@ def _query_activity_page(session: Session, *, object=None, by=None, since=None,
736
  break
737
  except ValueError as exc:
738
  raise err(400, 'bad_activity_query', str(exc)) from exc
739
- return {'records': records, 'next_cursor': _activity_cursor(session, query, position),
740
- 'fields': own_grid['fields']}
 
 
 
741
 
742
 
743
  def _activity_grid_rows(session):
@@ -1697,7 +1730,7 @@ def ut_assembly(session: Session, table_key: str, storage_key: str = "",
1697
  def _compute_ut_assembly(session: Session, table_key: str, storage_key: str = "",
1698
  consume_corrections: bool = False, with_rows: bool = True, st=None,
1699
  *, fields_only: bool = False, needed=None, include_usage: bool = True,
1700
- include_measures: bool = True):
1701
  """The user-table mirror of `grid_assembly` / `product_assembly` — SAME g-dict keys, so
1702
  `/workspace` and the events route consume any of the three interchangeably.
1703
 
@@ -1760,7 +1793,8 @@ def _compute_ut_assembly(session: Session, table_key: str, storage_key: str = ""
1760
  scope_key=table_key, table=ops)
1761
  ws = grid_events.table_workspace(ctx, allowed_pids=pids,
1762
  consume_corrections=consume_corrections,
1763
- capture_document=True)
 
1764
  workspace, fields, views, lists = aios_grid.workspace_wire(
1765
  ws, session.uname, set(pids), defs={}, scope_key=table_key,
1766
  storage_key=storage_key, fields_base=fields_base, st=st)
@@ -2661,10 +2695,8 @@ def table_rows(table_key: str, session: Session = Depends(require_session),
2661
  if table_key == 'ut_activity':
2662
  if related:
2663
  raise err(409, 'activity_related_unavailable', 'Open the Activity database to read events.')
2664
- page = query_activity(session, cursor=cursor, limit=limit)
2665
- g = _compute_ut_assembly(session, table_key,
2666
- storage_key=f'{session.tenant}:{table_key}:{session.uname}',
2667
- with_rows=False, fields_only=True)
2668
  json_keys = {field['key'] for field in g['fields'] if field.get('type') == 'json'}
2669
  rows = [{name: json.dumps(value, ensure_ascii=False, separators=(',', ':'))
2670
  if name in json_keys and isinstance(value, (dict, list)) else value
 
547
 
548
 
549
  def query_activity(session: Session, *, object=None, by=None, since=None, until=None,
550
+ cursor=None, limit=100, scan_limit=10000, _with_workspace=False):
551
  """Read a session-bound activity page through both activity and current source permissions."""
552
  import routes_agent_harness
553
  import routes_sheet
 
555
  with (routes_sheet._sheet_request_scope(session), activity_log.read_scope(session.runtime),
556
  routes_agent_harness.activity_read_scope(session)):
557
  return _query_activity_page(session, object=object, by=by, since=since, until=until,
558
+ cursor=cursor, limit=limit, scan_limit=scan_limit,
559
+ _with_workspace=_with_workspace)
560
 
561
 
562
  def _query_activity_page(session: Session, *, object=None, by=None, since=None, until=None,
563
+ cursor=None, limit=100, scan_limit=10000, _with_workspace=False):
564
  """Resolve one activity page within its caller's request scope."""
565
  from core import activity_log, perm_scope
566
 
567
  key = activity_log.DATABASE_KEY
568
  # Borrow definitions and grants for this call only; each cursor request rebuilds them.
569
  context_store = _table_lend(session.runtime, key, defs_only=True)
570
+ from core import route_system, schema_overlay
571
+ metadata = (route_system.STORE_KEY, _ut().ZONE_STORE_KEY, schema_overlay.STORE_KEY)
572
+ read_many = getattr(session.runtime, 'get_many', None)
573
+ if callable(read_many):
574
+ try:
575
+ documents = read_many(metadata)
576
+ except Exception:
577
+ documents = None
578
+ if isinstance(documents, dict):
579
+ context_store = _ut().lend(context_store, **{
580
+ name: documents[name] for name in metadata if isinstance(documents.get(name), dict)})
581
+ from copy import copy
582
+ field_session = copy(session)
583
+ field_session.runtime = context_store
584
  memo = getattr(session, '_sheet_read_memo', None)
585
  if isinstance(memo, dict):
586
  memo['permission_reader'] = context_store
587
  memo['activity_permission_identity'] = (session.tenant, session.uname, id(session.runtime))
588
  own = _defn_or_refuse(session, key, st=context_store, defs_only=True, scope_applied=True)
589
+ own_grid = _compute_ut_assembly(field_session, key, st=context_store, with_rows=False,
590
+ fields_only=True, storage_key=f'{session.tenant}:{key}:{session.uname}' if _with_workspace else '',
591
+ include_usage=_with_workspace, include_measures=_with_workspace, include_views=_with_workspace)
592
  own_keys = {f['key'] for f in own_grid['fields']}
593
  query = [object, by, since, until]
594
  position = _activity_cursor(session, query, token=cursor) if cursor else None
 
601
  source_pids = {}
602
  partners = {}
603
  connected = set()
604
+ page_sources = set()
605
  applications = None
606
 
607
  def source(database):
 
614
  definition = _defn_or_refuse(session, database, st=context_store,
615
  defs_only=True, scope_applied=True)
616
  windowed = not _ut().materialises(database, st=session.runtime, defn=definition)
617
+ g = _compute_ut_assembly(field_session, database, st=context_store,
618
+ with_rows=False, fields_only=True,
619
+ include_usage=False, include_measures=False, include_views=False)
620
+ page_sources.add(database)
621
  if windowed:
622
  connected.add(database)
623
  elif database in ('customer_data', 'product_data'):
 
634
  if exc.status_code not in (403, 404, 409):
635
  raise
636
  contexts[database] = None
637
+ except perm_scope.Unresolvable:
638
+ contexts[database] = None
639
  return contexts[database]
640
 
641
  def partner(obj):
 
665
  partners[identity] = admitted
666
  return admitted
667
 
668
+ if isinstance(memo, dict):
669
+ memo['activity_source_fields'] = source
670
+
671
  def can_read_object(obj):
672
  # T64 gives this resolver the object only. Event-kind checks and value scrubbing follow.
673
  return source(str(obj['database'])) is not None if 'database' in obj else partner(obj)
 
680
  object=object, by=by, since=since, until=until,
681
  cursor=position, limit=limit, scan_limit=scan_limit)
682
  position = raw['next_cursor']
683
+ # Resolve page ids through the ordinary row wall without admitting unrelated stored rows.
684
+ for database in page_sources:
 
685
  wanted = {str(event['object']['id']) for event in raw['records']
686
  if event['object'].get('database') == database and event['kind'] not in ('field', 'view')
687
  and str(event['object']['id']).isdigit()}
 
689
  from routes_odoo_tables import _relation_rows
690
  try:
691
  contexts[database]['pids'] = frozenset(
692
+ row['pid'] for row in _relation_rows(
693
+ session, database, {'pid'}, ids=wanted, st=context_store))
694
  except HTTPException as exc:
695
  if exc.status_code not in (403, 404, 409):
696
  raise
697
+ contexts[database] = None
698
+ source_pids[database] = frozenset()
699
+ continue
700
+ except perm_scope.Unresolvable:
701
+ # Unavailable source rows cannot authorize retained ids or values.
702
+ contexts[database] = None
703
+ source_pids[database] = frozenset()
704
+ continue
705
  source_pids[database] = frozenset(str(pid) for pid in contexts[database]['pids'])
706
  scoped = perm_scope.apply_row_scope(raw['records'], session.user, key, own['fields'],
707
  st=session.runtime, defn=own)
 
766
  break
767
  except ValueError as exc:
768
  raise err(400, 'bad_activity_query', str(exc)) from exc
769
+ result = {'records': records, 'next_cursor': _activity_cursor(session, query, position),
770
+ 'fields': own_grid['fields']}
771
+ if _with_workspace:
772
+ result['_grid'] = own_grid
773
+ return result
774
 
775
 
776
  def _activity_grid_rows(session):
 
1730
  def _compute_ut_assembly(session: Session, table_key: str, storage_key: str = "",
1731
  consume_corrections: bool = False, with_rows: bool = True, st=None,
1732
  *, fields_only: bool = False, needed=None, include_usage: bool = True,
1733
+ include_measures: bool = True, include_views: bool = True):
1734
  """The user-table mirror of `grid_assembly` / `product_assembly` — SAME g-dict keys, so
1735
  `/workspace` and the events route consume any of the three interchangeably.
1736
 
 
1793
  scope_key=table_key, table=ops)
1794
  ws = grid_events.table_workspace(ctx, allowed_pids=pids,
1795
  consume_corrections=consume_corrections,
1796
+ capture_document=True,
1797
+ **({"include_views": False} if not include_views else {}))
1798
  workspace, fields, views, lists = aios_grid.workspace_wire(
1799
  ws, session.uname, set(pids), defs={}, scope_key=table_key,
1800
  storage_key=storage_key, fields_base=fields_base, st=st)
 
2695
  if table_key == 'ut_activity':
2696
  if related:
2697
  raise err(409, 'activity_related_unavailable', 'Open the Activity database to read events.')
2698
+ page = query_activity(session, cursor=cursor, limit=limit, _with_workspace=True)
2699
+ g = page.pop('_grid')
 
 
2700
  json_keys = {field['key'] for field in g['fields'] if field.get('type') == 'json'}
2701
  rows = [{name: json.dumps(value, ensure_ascii=False, separators=(',', ':'))
2702
  if name in json_keys and isinstance(value, (dict, list)) else value
platform/core/grid_events.py CHANGED
@@ -59,7 +59,6 @@ MAX_VIEW_ORDER = 500
59
  import core.user_tables as _ut_limits # wave 23 (C7): MAX_JSON_CELL — one ceiling, one definer
60
  import harness.telemetry as _tel # _tel.error() = THE error sink (all caught errors log)
61
  import modules.cohort as cohort_mod
62
- import modules.customer_data as cl_mod
63
 
64
  #: C5 (owner item 12): customer documents. The cap is enforced HOST-side on the DECODED byte
65
  #: count — the client checks the same number first, but a client check only spares the user a
@@ -330,6 +329,7 @@ def _tops(ctx):
330
  """
331
  if ctx.table is not None:
332
  return ctx.table
 
333
  return cl_mod.TABLE_OPS
334
 
335
 
@@ -710,7 +710,8 @@ def workspace_corrections(st, table_key, uname, assembly):
710
  return assembly
711
 
712
 
713
- def table_workspace(ctx, allowed_pids=None, consume_corrections=True, capture_document=False):
 
714
  """Durable Airtable-style view/schema/overlay state, with an honest session fallback.
715
 
716
  Wave-9 I17: the returned `views` are this user's OWN views MERGED with every view SHARED
@@ -747,6 +748,9 @@ def table_workspace(ctx, allowed_pids=None, consume_corrections=True, capture_do
747
  ws, ctx.workspace_document = read
748
  else:
749
  ws = read
 
 
 
750
  document = ctx.workspace_document if capture_document else None
751
  # ⭐ WAVE 21 (item 9, C1): the R10 registry's named-user grants, PROJECTED at last.
752
  # Wave 20 wrote view grants and no reader ever consulted them — "Share view…" recorded
 
59
  import core.user_tables as _ut_limits # wave 23 (C7): MAX_JSON_CELL — one ceiling, one definer
60
  import harness.telemetry as _tel # _tel.error() = THE error sink (all caught errors log)
61
  import modules.cohort as cohort_mod
 
62
 
63
  #: C5 (owner item 12): customer documents. The cap is enforced HOST-side on the DECODED byte
64
  #: count — the client checks the same number first, but a client check only spares the user a
 
329
  """
330
  if ctx.table is not None:
331
  return ctx.table
332
+ import modules.customer_data as cl_mod
333
  return cl_mod.TABLE_OPS
334
 
335
 
 
710
  return assembly
711
 
712
 
713
+ def table_workspace(ctx, allowed_pids=None, consume_corrections=True, capture_document=False,
714
+ *, include_views=True):
715
  """Durable Airtable-style view/schema/overlay state, with an honest session fallback.
716
 
717
  Wave-9 I17: the returned `views` are this user's OWN views MERGED with every view SHARED
 
748
  ws, ctx.workspace_document = read
749
  else:
750
  ws = read
751
+ if not include_views:
752
+ # Field admission still receives the full authored field and shared-field documents.
753
+ return {**ws, 'views': {}}
754
  document = ctx.workspace_document if capture_document else None
755
  # ⭐ WAVE 21 (item 9, C1): the R10 registry's named-user grants, PROJECTED at last.
756
  # Wave 20 wrote view grants and no reader ever consulted them — "Share view…" recorded
platform/core/perm_scope.py CHANGED
@@ -1283,11 +1283,11 @@ def _ticket_source_admits(row, user, module, source_rows, memo, st):
1283
  group = (database, required)
1284
  if group not in memo:
1285
  try:
1286
- table = _ut().get(database, st=st) if database.startswith('ut_') else None
1287
  fields = (table or {}).get('fields') or [{'key': key} for key in sorted(required)]
1288
  readable = bool(may_read(user, database, st=st)
1289
  and not required & hidden_keys(user, database, fields, st=st))
1290
- walled = readable and row_scope_applies(user, database, st=st)
1291
  except Exception:
1292
  # An unreadable permission answer denies; it never falls back to the stored list.
1293
  table, fields, readable, walled = None, [], False, False
@@ -1307,7 +1307,7 @@ def _ticket_source_admits(row, user, module, source_rows, memo, st):
1307
  if not isinstance(src, dict):
1308
  return False
1309
  try:
1310
- return bool(apply_row_scope([src], user, database, fields, st=st))
1311
  except Exception:
1312
  return False
1313
 
@@ -2620,7 +2620,7 @@ def _scoped(user, table_key, st=None, ctx=None, want_rows=True):
2620
  return fields, rows
2621
 
2622
 
2623
- def _read(table_key, user, st, want_rows=True):
2624
  """`(fields, rows)` BEFORE the wall — the app layer's reader, or core's own for a `ut_*`."""
2625
  reader = _ROW_SOURCES.get(table_key)
2626
  if reader is not None:
@@ -2635,10 +2635,10 @@ def _read(table_key, user, st, want_rows=True):
2635
  # imported the API layer this is the honest answer: nothing here can build that pool.
2636
  raise UnknownTable(f"no database named '{table_key}' in this workspace, and no reader "
2637
  f"is registered for it")
2638
- return _read_user_table(table_key, st, want_rows)
2639
 
2640
 
2641
- def _read_user_table(table_key, st, want_rows=True):
2642
  """core's OWN reader for a `ut_*` database. Answers with NO registrar, deliberately.
2643
 
2644
  ⭐ WHY IT LIVES IN `core` RATHER THAN BEING REGISTERED LIKE THE TOPICS, and it is the same
@@ -2653,8 +2653,9 @@ def _read_user_table(table_key, st, want_rows=True):
2653
  the materialised arm below takes the whole read explicitly.
2654
  """
2655
  ut = _ut()
2656
- lent = ut.lend_defs(st)
2657
- defn = ut.get(table_key, st=lent)
 
2658
  if not defn:
2659
  raise UnknownTable(f"no database named '{table_key}'")
2660
  fields = [dict(f) for f in (defn.get('fields') or [])]
 
1283
  group = (database, required)
1284
  if group not in memo:
1285
  try:
1286
+ table = _ut().get_one(database, st=st) if database.startswith('ut_') else None
1287
  fields = (table or {}).get('fields') or [{'key': key} for key in sorted(required)]
1288
  readable = bool(may_read(user, database, st=st)
1289
  and not required & hidden_keys(user, database, fields, st=st))
1290
+ walled = readable and row_scope_applies(user, database, st=st, defn=table)
1291
  except Exception:
1292
  # An unreadable permission answer denies; it never falls back to the stored list.
1293
  table, fields, readable, walled = None, [], False, False
 
1307
  if not isinstance(src, dict):
1308
  return False
1309
  try:
1310
+ return bool(apply_row_scope([src], user, database, fields, st=st, defn=table))
1311
  except Exception:
1312
  return False
1313
 
 
2620
  return fields, rows
2621
 
2622
 
2623
+ def _read(table_key, user, st, want_rows=True, *, defn=None):
2624
  """`(fields, rows)` BEFORE the wall — the app layer's reader, or core's own for a `ut_*`."""
2625
  reader = _ROW_SOURCES.get(table_key)
2626
  if reader is not None:
 
2635
  # imported the API layer this is the honest answer: nothing here can build that pool.
2636
  raise UnknownTable(f"no database named '{table_key}' in this workspace, and no reader "
2637
  f"is registered for it")
2638
+ return _read_user_table(table_key, st, want_rows, defn=defn)
2639
 
2640
 
2641
+ def _read_user_table(table_key, st, want_rows=True, *, defn=None):
2642
  """core's OWN reader for a `ut_*` database. Answers with NO registrar, deliberately.
2643
 
2644
  ⭐ WHY IT LIVES IN `core` RATHER THAN BEING REGISTERED LIKE THE TOPICS, and it is the same
 
2653
  the materialised arm below takes the whole read explicitly.
2654
  """
2655
  ut = _ut()
2656
+ if defn is None:
2657
+ lent = ut.lend_defs(st)
2658
+ defn = ut.get(table_key, st=lent)
2659
  if not defn:
2660
  raise UnknownTable(f"no database named '{table_key}'")
2661
  fields = [dict(f) for f in (defn.get('fields') or [])]
platform/harness/datastore.py CHANGED
@@ -251,6 +251,8 @@ ENTITIES = {
251
  # JSON list of ALL ids. Declared explicitly: a 2-element m2m read would otherwise be
252
  # indistinguishable from an m2o (id, name) pair in _flatten.
253
  "m2m": ["agent_ids"],
 
 
254
  },
255
  "product_product": {
256
  "model": "product.product", "archivable": True,
@@ -1394,11 +1396,7 @@ def _ensure_sync_state(con):
1394
  cursor_wd VARCHAR, rows BIGINT, updated_at VARCHAR)""")
1395
 
1396
 
1397
- # These many2many fields store all source names, despite their singular `_id` suffix.
1398
- NAMED_M2M_FIELDS = {"category_id": "res.partner.category"}
1399
-
1400
-
1401
- def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1402
  out = {"id": rec["id"]}
1403
  for f in m2m:
1404
  v = rec.get(f) or []
@@ -1407,7 +1405,7 @@ def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1407
  out[f] = json.dumps(list(v)) if v else None
1408
  for f in fields:
1409
  v = rec.get(f)
1410
- if f in NAMED_M2M_FIELDS:
1411
  names = (named_m2m_names or {}).get(f, {})
1412
  if any(tag_id not in names or not names[tag_id] for tag_id in (v or [])):
1413
  raise RuntimeError("Source tag names could not be resolved")
@@ -1437,10 +1435,10 @@ def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1437
  return out
1438
 
1439
 
1440
- def _flatten_records(recs, fields, m2m=()):
1441
  """Resolve analytic and tag names once per source page, without a shared tenant cache."""
1442
  named_m2m_names = {}
1443
- for field, model in NAMED_M2M_FIELDS.items():
1444
  if field not in fields:
1445
  continue
1446
  ids = sorted({tag_id for rec in recs for tag_id in (rec.get(field) or [])})
@@ -1461,7 +1459,7 @@ def _flatten_records(recs, fields, m2m=()):
1461
  [("id", "in", ids[start:start + 1000]), ("active", "in", [True, False])],
1462
  ["name"], limit=1000, order="id asc")
1463
  names.update({account["id"]: account.get("name") for account in accounts})
1464
- return [_flatten(rec, fields, m2m, analytic_names=names,
1465
  named_m2m_names=named_m2m_names) for rec in recs]
1466
 
1467
 
@@ -1620,7 +1618,7 @@ def _cols(spec):
1620
  cols = ["id BIGINT PRIMARY KEY"]
1621
  for f in spec["fields"]:
1622
  base = f.removesuffix("_id")
1623
- if f in NAMED_M2M_FIELDS:
1624
  cols.append(f"{f} VARCHAR")
1625
  elif f.endswith("_id") or f in MANY2ONE_FIELDS:
1626
  cols += [f"{base}_id BIGINT", f"{base}_name VARCHAR"]
@@ -1657,9 +1655,9 @@ def _ensure_columns(con, key, spec):
1657
  return added
1658
 
1659
 
1660
- def _field_cols(f):
1661
  """The store column(s) one spec field materialises into (m2o fields become _id + _name)."""
1662
- if f in NAMED_M2M_FIELDS:
1663
  return [f]
1664
  if f == "analytic_distribution":
1665
  return [f, f + "_details"]
@@ -1730,7 +1728,7 @@ def _backfill_columns(con, key, spec, log=print, max_batches=None, *, repeat=Fal
1730
  last, n = (st[1] or 0, st[2] or 0) if st else (0, 0)
1731
  if last:
1732
  log(f" {key}: {operation} resuming at id {last:,} ({n:,} rows already done)")
1733
- cols = [c for f in fields for c in _field_cols(f)]
1734
  setter = ", ".join(f"{c}=?" for c in cols)
1735
  pages, changed = 0, 0
1736
  while True:
@@ -1740,7 +1738,7 @@ def _backfill_columns(con, key, spec, log=print, max_batches=None, *, repeat=Fal
1740
  break
1741
  if any(field not in rec for rec in recs for field in fields):
1742
  raise RuntimeError(f"{key}: column backfill response omitted a requested field")
1743
- rows = _flatten_records(recs, fields)
1744
  if repeat:
1745
  # UPDATE ... RETURNING counts actual changed mirror rows. Fetched,
1746
  # identical and absent rows must not trigger a product-store rebuild.
@@ -1810,7 +1808,8 @@ def _backfill_m2m(con, key, spec, log=print):
1810
  def _upsert(con, key, spec, recs):
1811
  if not recs:
1812
  return
1813
- rows = _flatten_records(recs, spec["fields"], spec.get("m2m") or ())
 
1814
  colnames = [c.split()[0] for c in _cols(spec)]
1815
  ids = [r["id"] for r in rows]
1816
  con.execute(f"DELETE FROM {key} WHERE id IN ({','.join(map(str, ids))})")
 
251
  # JSON list of ALL ids. Declared explicitly: a 2-element m2m read would otherwise be
252
  # indistinguishable from an m2o (id, name) pair in _flatten.
253
  "m2m": ["agent_ids"],
254
+ # Named many2many fields store source names despite their singular `_id` suffix.
255
+ "named_m2m": {"category_id": "res.partner.category"},
256
  },
257
  "product_product": {
258
  "model": "product.product", "archivable": True,
 
1396
  cursor_wd VARCHAR, rows BIGINT, updated_at VARCHAR)""")
1397
 
1398
 
1399
+ def _flatten(rec, fields, m2m=(), *, named_m2m=None, analytic_names=None, named_m2m_names=None):
 
 
 
 
1400
  out = {"id": rec["id"]}
1401
  for f in m2m:
1402
  v = rec.get(f) or []
 
1405
  out[f] = json.dumps(list(v)) if v else None
1406
  for f in fields:
1407
  v = rec.get(f)
1408
+ if f in (named_m2m or {}):
1409
  names = (named_m2m_names or {}).get(f, {})
1410
  if any(tag_id not in names or not names[tag_id] for tag_id in (v or [])):
1411
  raise RuntimeError("Source tag names could not be resolved")
 
1435
  return out
1436
 
1437
 
1438
+ def _flatten_records(recs, fields, m2m=(), *, named_m2m=None):
1439
  """Resolve analytic and tag names once per source page, without a shared tenant cache."""
1440
  named_m2m_names = {}
1441
+ for field, model in (named_m2m or {}).items():
1442
  if field not in fields:
1443
  continue
1444
  ids = sorted({tag_id for rec in recs for tag_id in (rec.get(field) or [])})
 
1459
  [("id", "in", ids[start:start + 1000]), ("active", "in", [True, False])],
1460
  ["name"], limit=1000, order="id asc")
1461
  names.update({account["id"]: account.get("name") for account in accounts})
1462
+ return [_flatten(rec, fields, m2m, named_m2m=named_m2m, analytic_names=names,
1463
  named_m2m_names=named_m2m_names) for rec in recs]
1464
 
1465
 
 
1618
  cols = ["id BIGINT PRIMARY KEY"]
1619
  for f in spec["fields"]:
1620
  base = f.removesuffix("_id")
1621
+ if f in (spec.get("named_m2m") or {}):
1622
  cols.append(f"{f} VARCHAR")
1623
  elif f.endswith("_id") or f in MANY2ONE_FIELDS:
1624
  cols += [f"{base}_id BIGINT", f"{base}_name VARCHAR"]
 
1655
  return added
1656
 
1657
 
1658
+ def _field_cols(f, *, named_m2m=None):
1659
  """The store column(s) one spec field materialises into (m2o fields become _id + _name)."""
1660
+ if f in (named_m2m or {}):
1661
  return [f]
1662
  if f == "analytic_distribution":
1663
  return [f, f + "_details"]
 
1728
  last, n = (st[1] or 0, st[2] or 0) if st else (0, 0)
1729
  if last:
1730
  log(f" {key}: {operation} resuming at id {last:,} ({n:,} rows already done)")
1731
+ cols = [c for f in fields for c in _field_cols(f, named_m2m=spec.get("named_m2m"))]
1732
  setter = ", ".join(f"{c}=?" for c in cols)
1733
  pages, changed = 0, 0
1734
  while True:
 
1738
  break
1739
  if any(field not in rec for rec in recs for field in fields):
1740
  raise RuntimeError(f"{key}: column backfill response omitted a requested field")
1741
+ rows = _flatten_records(recs, fields, named_m2m=spec.get("named_m2m"))
1742
  if repeat:
1743
  # UPDATE ... RETURNING counts actual changed mirror rows. Fetched,
1744
  # identical and absent rows must not trigger a product-store rebuild.
 
1808
  def _upsert(con, key, spec, recs):
1809
  if not recs:
1810
  return
1811
+ rows = _flatten_records(recs, spec["fields"], spec.get("m2m") or (),
1812
+ named_m2m=spec.get("named_m2m"))
1813
  colnames = [c.split()[0] for c in _cols(spec)]
1814
  ids = [r["id"] for r in rows]
1815
  con.execute(f"DELETE FROM {key} WHERE id IN ({','.join(map(str, ids))})")
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- aace6bdd9a51d9efb884de2655d674ed6c04d12f2273eb5c3e84bb4b08cb35f7
 
1
+ 4c6ee3fbd9bc887050cbb7af8447ef92d6de462c14403434e3773d0fdc7f15d1