fsanyoto commited on
Commit
3149343
Β·
verified Β·
1 Parent(s): ce4ad7b

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "c9d5eec",
3
  "releases": [
4
  {
5
  "version": "v69",
 
1
  {
2
+ "current": "95ae9fd",
3
  "releases": [
4
  {
5
  "version": "v69",
VERSION CHANGED
@@ -1 +1 @@
1
- c9d5eec
 
1
+ 95ae9fd
api/routes_shares.py CHANGED
@@ -508,6 +508,49 @@ def _owns_object(session, kind, oid):
508
  return False
509
 
510
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  def _can_see_object(session, kind, oid):
512
  """May this caller READ an object's grant list β€” i.e. can they reach the object at all?
513
 
@@ -525,10 +568,16 @@ def _can_see_object(session, kind, oid):
525
  # SECRECY OF THE COLUMN. So the two strata whose EXISTENCE the caller can already observe
526
  # are admitted and nothing else is:
527
  #
528
- # * `shared` β€” a shared column's existence is tenant-wide by `shared_overlay.fields`'
529
- # own docstring ("that is the whole feature"). "Who else has this?" is this reader's
530
- # fair question, and `get_share` still serves `people: []` to anybody who may not
531
- # administer, so no directory travels.
 
 
 
 
 
 
532
  # * `catalogue` β€” the database's own declared column, BUT ONLY ON A DATABASE THIS
533
  # CALLER MAY OPEN. `user_tables.may_open` is the resolver (the same one the
534
  # `database` kind uses one function up, never a second answer to "may they open it").
@@ -548,7 +597,7 @@ def _can_see_object(session, kind, oid):
548
  if not isinstance(defn, dict):
549
  return False
550
  if stratum == "shared":
551
- return True
552
  if stratum != "catalogue":
553
  return False
554
  # β›” A CATALOGUE COLUMN IS ADMITTED ONLY ON A DATABASE THIS CALLER MAY OPEN, and on a
 
508
  return False
509
 
510
 
511
+ def _field_is_governed(session, grant_topic, field_key, definition):
512
+ """Is this shared column's visibility decided by a per-FIELD grant?
513
+
514
+ β›”β›” W50 COMBINE β€” THIS IS THE TEST `_can_see_object`'s `shared` ARM WAS MISSING, AND ITS
515
+ ABSENCE WAS AN INFORMATION DISCLOSURE. "A shared column's existence is tenant-wide" is true of
516
+ an UNGOVERNED one and false of a governed one: `perm_scope.field_grant_hidden` removes a
517
+ governed column from the grid of every account that holds no grant on it, so answering that
518
+ account's `GET /share/field/<oid>` with a grant list tells a stranger the column exists, who
519
+ owns it, and how many people hold it. `get_share` only reaches here when `shares.role_for`
520
+ already answered `None`, so every caller of this predicate is by construction a NON-GRANTEE.
521
+
522
+ ⭐⭐ TWO WITNESSES, EITHER ONE IS ENOUGH, AND THE SECOND IS THE ONE THE v67 HOTFIX ADDED.
523
+ The MARK is read through `perm_scope.granted_field_keys` β€” the wall's own cheap half, never a
524
+ local `f.get('granted') is True` (`field_permissions._governed` forbids the second reader by
525
+ name). The REGISTRY RECORD is the second, because *the grant, not the marker, is the
526
+ decision*: `field_permissions.reconcile_shared_permissions` stamps the mark onto any shared
527
+ definition whose record carries `owner` OR `entries`, and refuses only the record it has
528
+ "never heard of" β€” so this predicate is the SAME test, asked one read earlier. The reconcile
529
+ runs from `migrate_legacy_fields`, i.e. on the grid read; this route does not run it, so
530
+ without the second witness a column inside that window arrives here looking ungoverned and is
531
+ disclosed. `owner` with no entries is deliberately included for exactly that reason: it is
532
+ "managed and shared with nobody", which is the narrowest audience there is, not the widest.
533
+
534
+ ⚠ FAIL CLOSED. Anything unresolvable answers "governed", i.e. the caller is refused. This
535
+ guards a disclosure, and the only safe degraded answer for a disclosure door is silence.
536
+ """
537
+ if not isinstance(definition, dict) or not definition:
538
+ return True
539
+ try:
540
+ import core.perm_scope as perm_scope
541
+ key = str(field_key or "")
542
+ if perm_scope.granted_field_keys([dict(definition, key=key)]):
543
+ return True
544
+ except Exception: # noqa: BLE001
545
+ return True
546
+ try:
547
+ record = shares.grants("field", shares.field_oid(grant_topic, field_key),
548
+ st=session.runtime)
549
+ return bool(record.get("owner") or record.get("entries"))
550
+ except Exception: # noqa: BLE001
551
+ return True
552
+
553
+
554
  def _can_see_object(session, kind, oid):
555
  """May this caller READ an object's grant list β€” i.e. can they reach the object at all?
556
 
 
568
  # SECRECY OF THE COLUMN. So the two strata whose EXISTENCE the caller can already observe
569
  # are admitted and nothing else is:
570
  #
571
+ # * `shared` β€” an UNGOVERNED shared column's existence is tenant-wide by
572
+ # `shared_overlay.fields`' own docstring ("that is the whole feature"). "Who else has
573
+ # this?" is this reader's fair question, and `get_share` still serves `people: []` to
574
+ # anybody who may not administer, so no directory travels.
575
+ # β›”β›” W50 COMBINE β€” AND THE WORD **UNGOVERNED** IS LOAD BEARING; WITHOUT IT THIS ARM
576
+ # IS AN INFORMATION DISCLOSURE. A GOVERNED column is not tenant-wide at all: the
577
+ # per-field wall takes it off the grid of everyone who holds no grant, so a stranger
578
+ # answered `200` here learns the column exists, who owns it and how many people hold
579
+ # it β€” the id-probe S-3 closed, arriving through the arm that was opened for the
580
+ # OWNER. `_field_is_governed` is the test and it fails closed.
581
  # * `catalogue` β€” the database's own declared column, BUT ONLY ON A DATABASE THIS
582
  # CALLER MAY OPEN. `user_tables.may_open` is the resolver (the same one the
583
  # `database` kind uses one function up, never a second answer to "may they open it").
 
597
  if not isinstance(defn, dict):
598
  return False
599
  if stratum == "shared":
600
+ return not _field_is_governed(session, grant_topic, field_key, defn)
601
  if stratum != "catalogue":
602
  return False
603
  # β›” A CATALOGUE COLUMN IS ADMITTED ONLY ON A DATABASE THIS CALLER MAY OPEN, and on a
platform/core/shared_overlay.py CHANGED
@@ -149,6 +149,41 @@ def _read(table_key, st=None):
149
  'cells': dict(data.get('cells') or {})}
150
 
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  def document(table_key, st=None):
153
  """One captured shared-stratum document for consumers in a single request.
154
 
@@ -209,6 +244,12 @@ def fold_legacy_bucket(legacy_key, table_key, st=None):
209
  canon = str(table_key or '').strip()
210
  if not legacy or not canon or legacy == canon:
211
  return {'fields': 0, 'cells': 0}
 
 
 
 
 
 
212
  src = _read(legacy, st=st)
213
  if not src['fields'] and not src['cells']:
214
  return {'fields': 0, 'cells': 0}
 
149
  'cells': dict(data.get('cells') or {})}
150
 
151
 
152
+ def _may_hold_anything(table_key, st=None):
153
+ """Could this stratum's bucket hold anything, answered WITHOUT reading the document?
154
+
155
+ ⭐⭐ W50 COMBINE / D-213 β€” THE READ THIS SAVES RAN ON EVERY DATABASE SWITCH.
156
+ `fold_legacy_bucket` runs from `field_permissions.migrate_legacy_fields`, i.e. on every
157
+ shared-field read, and its FIRST act was a whole read of the OTHER spelling β€” a document that
158
+ is absent for every topic that never carried residue, which is almost all of them. That is a
159
+ ninth entry in `verify_scopes`' named whole-document budget for a switch, and that budget is
160
+ an exact list rather than a ceiling on purpose.
161
+
162
+ β›” A PROJECTION CANNOT EXPRESS THIS, WHICH IS WHY THE ANSWER IS AN EXISTENCE PROBE.
163
+ `store.get_projection` drops keys from each top-level VALUE; this document's two top-level
164
+ values are `fields` and `cells`, so a projection of it would drop keys from inside each field
165
+ DEFINITION and each row, and still fetch the whole thing. The only cheaper read is no read.
166
+
167
+ ⚠ COST, BY BACKEND, SO THE NEXT READER DOES NOT RE-DERIVE IT: on `store_pg` (production)
168
+ `exists` is a single-key `SELECT 1` against `store_kv`, strictly cheaper than fetching and
169
+ decoding the document. On the HF backend it is a repo listing, and that backend is retired as
170
+ an architecture; it also answers True on any uncertainty, so it degrades into the old read.
171
+
172
+ β›” FAIL OPEN, TO THE READ. Every failure path answers True, so a store that cannot answer
173
+ "does this exist" is handled exactly as it was before this function existed: the document is
174
+ read and the fold decides on its contents. A skipped fold is a column that silently does not
175
+ exist, which is the defect the fold was written for.
176
+ """
177
+ handle = _st(st)
178
+ probe = getattr(handle, 'exists', None)
179
+ if not callable(probe):
180
+ return True
181
+ try:
182
+ return bool(probe(bucket(table_key)))
183
+ except Exception:
184
+ return True
185
+
186
+
187
  def document(table_key, st=None):
188
  """One captured shared-stratum document for consumers in a single request.
189
 
 
244
  canon = str(table_key or '').strip()
245
  if not legacy or not canon or legacy == canon:
246
  return {'fields': 0, 'cells': 0}
247
+ # ⭐⭐ W50 COMBINE β€” ASK WHETHER THE LEGACY BUCKET EXISTS BEFORE READING IT. This runs on every
248
+ # shared-field read; a topic with no residue must not pay a whole document read per database
249
+ # switch to be told so. `_may_hold_anything` fails OPEN, so nothing below changes for a store
250
+ # that cannot answer, and a bucket that exists is read and folded exactly as before.
251
+ if not _may_hold_anything(legacy, st=st):
252
+ return {'fields': 0, 'cells': 0}
253
  src = _read(legacy, st=st)
254
  if not src['fields'] and not src['cells']:
255
  return {'fields': 0, 'cells': 0}
web/src/views-trash/trashApi.ts CHANGED
@@ -91,6 +91,11 @@ async function refusal(res: Response, fallback = FALLBACK): Promise<TrashApiErro
91
  * their literals began with the helper call rather than the prefix. Writing each path out in full
92
  * turns one phantom into three real checks.
93
  *
 
 
 
 
 
94
  * Do NOT write the prefix token followed by a slash anywhere in this comment: the scan reads
95
  * COMMENTS too, and the first draft of this very note put a fresh phantom back into the gate.
96
  * Wave-50 combine, 2026-09-03.
@@ -98,10 +103,7 @@ async function refusal(res: Response, fallback = FALLBACK): Promise<TrashApiErro
98
 
99
  /** The caller's own deleted views, newest deletion first. */
100
  export async function fetchTrash(tableKey: string): Promise<TrashList> {
101
- const res = await fetch(
102
- `${API_V1}/tables/${encodeURIComponent(tableKey)}/views/trash`,
103
- { credentials: CREDENTIALS },
104
- )
105
  if (!res.ok) throw await refusal(res, 'the deleted views could not be read just now.')
106
  const body = await res.json()
107
  return {
@@ -117,8 +119,7 @@ export async function restoreView(
117
  tableKey: string,
118
  viewId: string,
119
  ): Promise<{ restored: string; owner: string; name: string }> {
120
- const res = await fetch(
121
- `${API_V1}/tables/${encodeURIComponent(tableKey)}/views/${encodeURIComponent(viewId)}/restore`, {
122
  method: 'POST',
123
  credentials: CREDENTIALS,
124
  headers: { 'Content-Type': 'application/json' },
@@ -136,8 +137,7 @@ export async function restoreView(
136
  /** The Administrator trail for this database, newest first, or
137
  * `TRAIL_FORBIDDEN` when this account may not read it. */
138
  export async function fetchTrail(tableKey: string, limit = 60): Promise<TrailAnswer> {
139
- const res = await fetch(
140
- `${API_V1}/tables/${encodeURIComponent(tableKey)}/views/audit?limit=${encodeURIComponent(String(limit))}`, {
141
  credentials: CREDENTIALS,
142
  })
143
  if (res.status === 403) return TRAIL_FORBIDDEN
 
91
  * their literals began with the helper call rather than the prefix. Writing each path out in full
92
  * turns one phantom into three real checks.
93
  *
94
+ * β›” AND EACH URL STAYS ON ITS OWN `fetch(` LINE. `verify_shared_views.py:947` scans for a line
95
+ * containing BOTH `fetch(` and `?`, so wrapping the audit call across two lines made the C4
96
+ * seam report `sent: []` and fail its own "else this section proves nothing" guard - a
97
+ * reformat, with no behaviour change, blinded the check.
98
+ *
99
  * Do NOT write the prefix token followed by a slash anywhere in this comment: the scan reads
100
  * COMMENTS too, and the first draft of this very note put a fresh phantom back into the gate.
101
  * Wave-50 combine, 2026-09-03.
 
103
 
104
  /** The caller's own deleted views, newest deletion first. */
105
  export async function fetchTrash(tableKey: string): Promise<TrashList> {
106
+ const res = await fetch(`${API_V1}/tables/${encodeURIComponent(tableKey)}/views/trash`, { credentials: CREDENTIALS })
 
 
 
107
  if (!res.ok) throw await refusal(res, 'the deleted views could not be read just now.')
108
  const body = await res.json()
109
  return {
 
119
  tableKey: string,
120
  viewId: string,
121
  ): Promise<{ restored: string; owner: string; name: string }> {
122
+ const res = await fetch(`${API_V1}/tables/${encodeURIComponent(tableKey)}/views/${encodeURIComponent(viewId)}/restore`, {
 
123
  method: 'POST',
124
  credentials: CREDENTIALS,
125
  headers: { 'Content-Type': 'application/json' },
 
137
  /** The Administrator trail for this database, newest first, or
138
  * `TRAIL_FORBIDDEN` when this account may not read it. */
139
  export async function fetchTrail(tableKey: string, limit = 60): Promise<TrailAnswer> {
140
+ const res = await fetch(`${API_V1}/tables/${encodeURIComponent(tableKey)}/views/audit?limit=${encodeURIComponent(String(limit))}`, {
 
141
  credentials: CREDENTIALS,
142
  })
143
  if (res.status === 403) return TRAIL_FORBIDDEN