fsanyoto commited on
Commit
37fac8a
Β·
verified Β·
1 Parent(s): f11e183

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "91baf64 (91baf64)",
3
  "releases": [
4
  {
5
  "version": "v75",
 
1
  {
2
+ "current": "cd77f53 (cd77f53)",
3
  "releases": [
4
  {
5
  "version": "v75",
VERSION CHANGED
@@ -1 +1 @@
1
- 91baf64 (91baf64)
 
1
+ cd77f53 (cd77f53)
api/routes_sheet.py CHANGED
@@ -1117,8 +1117,17 @@ def _reresolved_for_reader(session: Session, book, *, endings_only=False):
1117
  _snapshot_cell(cell, hit["cell"])
1118
  elif not seen[db]:
1119
  _snapshot_cell(cell, _binding_refusal("database_unreadable", f"You cannot read {db}."))
1120
- elif owner and not cache.get("refreshCells") and session.user.get("role") == "admin":
 
1121
  # Existing workbooks keep their pre-C2 last result until the first Refresh.
 
 
 
 
 
 
 
 
1122
  pass
1123
  else:
1124
  _snapshot_cell(cell, _binding_refusal("sheet_refresh_required",
@@ -2570,6 +2579,8 @@ def _is_view_binding(cell) -> bool:
2570
  _BINDING_REFUSAL_DISPLAY = {
2571
  "database_unreadable": "#NO ACCESS",
2572
  "field_unknown": "#FIELD?",
 
 
2573
  }
2574
 
2575
 
 
1117
  _snapshot_cell(cell, hit["cell"])
1118
  elif not seen[db]:
1119
  _snapshot_cell(cell, _binding_refusal("database_unreadable", f"You cannot read {db}."))
1120
+ elif (owner and session.user.get("role") == "admin"
1121
+ and (not cache.get("refreshCells") or cell.get("state") in ("fresh", "refused"))):
1122
  # Existing workbooks keep their pre-C2 last result until the first Refresh.
1123
+ # ⭐⭐ HOTFIX 2026-09-24: AND AN ADMIN OWNER KEEPS THE STORED RESULT ON ANY MISS.
1124
+ # The slot is per caller, so a binding written by ANOTHER account (the Daily
1125
+ # Sales repair ran as `admin`, revs 271 to 288) leaves the owner with no slot of
1126
+ # their own, and this branch used to fall through to `sheet_refresh_required`,
1127
+ # painted `#ERROR!` over rows 31 and 32 until somebody pressed Refresh. C5 is
1128
+ # not what that protected: an admin has no row wall (`row_scope_applies`), and
1129
+ # the stored figure is the owner's own document's last computed answer. A `stale`
1130
+ # cell is excluded because it has no answer to keep. Non-owners are unchanged.
1131
  pass
1132
  else:
1133
  _snapshot_cell(cell, _binding_refusal("sheet_refresh_required",
 
2579
  _BINDING_REFUSAL_DISPLAY = {
2580
  "database_unreadable": "#NO ACCESS",
2581
  "field_unknown": "#FIELD?",
2582
+ # HOTFIX 2026-09-24: "needs a Refresh" is not a calculation error and must not read as one.
2583
+ "sheet_refresh_required": "#REFRESH",
2584
  }
2585
 
2586
 
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 8e8f73bacdb3600d495ec32e74298e1436d38d7d864d4a68cf0fe58bcfb8e2c5
 
1
+ b465948a6931b88069774049c1b98749006d6f4b53b30810ed6a36dc0c5e8cd3
web/src/sheet/SheetGrid.tsx CHANGED
@@ -99,7 +99,9 @@ import type {
99
  DataEditorRef, DrawCellCallback, DrawHeaderCallback, EditableGridCell, GridColumn,
100
  GridKeyEventArgs, GridMouseEventArgs, GridSelection, Item, GridCell, Rectangle,
101
  } from "@glideapps/glide-data-grid";
102
- import { CompactSelection, DataEditor, GridCellKind } from "@glideapps/glide-data-grid";
 
 
103
  // β›”β›” THIS IMPORT IS THE GRID. Without it glide's STRUCTURAL stylesheet is not in this chunk and
104
  // no canvas is ever created; the block comment at the head of this file has the measurement. It
105
  // is one line and it looks like housekeeping, which is exactly why it went missing.
@@ -365,6 +367,9 @@ const BINDING_REFUSAL_COPY: Readonly<Record<string, { display: string; message:
365
  database_unreadable: { display: "#NO ACCESS", message: "You do not have access to this database." },
366
  field_unknown: { display: "#FIELD?", message: "This field is no longer in the database." },
367
  scope_not_applicable: { display: "#ERROR!", message: "The database cannot apply this cell's row restrictions." },
 
 
 
368
  };
369
  const BINDING_REFUSAL_FALLBACK = { display: "#ERROR!", message: "This cell's database binding could not be calculated." };
370
 
@@ -1607,6 +1612,16 @@ export default function SheetGrid({
1607
  (real: number) => viewIndexOf(allVisRows, real) - bandRows,
1608
  [allVisRows, bandRows],
1609
  );
 
 
 
 
 
 
 
 
 
 
1610
  /** The A1 address glide's cell stands for. THE one door from a view coordinate to an address. */
1611
  const addrAt = useCallback(
1612
  (col: number, row: number) => addressOf(realCol(col), realRow(row)),
@@ -6270,6 +6285,7 @@ export default function SheetGrid({
6270
  headerHeight={HEADER_HEIGHT}
6271
  drawHeader={drawColumnHeader}
6272
  rowMarkers="number"
 
6273
  rowMarkerWidth={ROW_MARKER_WIDTH}
6274
  smoothScrollX
6275
  // β›” DRIVEN, NEVER DRIVING. The main grid reports its visible region and this
@@ -6398,6 +6414,8 @@ export default function SheetGrid({
6398
  // the grid above this one and are NOT among the rows here, so without this the sheet
6399
  // would show two rows called 1. glide offers the start index as a first class prop.
6400
  rowMarkerStartIndex={bandRows + 1}
 
 
6401
  // β›”β›” W51-T34: NO SECOND ROW OF COLUMN LETTERS. While a band is on screen the band
6402
  // grid carries the header and this one is given a height of zero for it, which glide
6403
  // guards itself (`drawGridHeaders` returns before drawing at a total of zero). With no
 
99
  DataEditorRef, DrawCellCallback, DrawHeaderCallback, EditableGridCell, GridColumn,
100
  GridKeyEventArgs, GridMouseEventArgs, GridSelection, Item, GridCell, Rectangle,
101
  } from "@glideapps/glide-data-grid";
102
+ import { CompactSelection, GridCellKind } from "@glideapps/glide-data-grid";
103
+ // ⭐ glide's editor with a row marker that paints the SHEET's row. See `sheetDataEditor.tsx`.
104
+ import { DataEditor } from "./sheetDataEditor";
105
  // β›”β›” THIS IMPORT IS THE GRID. Without it glide's STRUCTURAL stylesheet is not in this chunk and
106
  // no canvas is ever created; the block comment at the head of this file has the measurement. It
107
  // is one line and it looks like housekeeping, which is exactly why it went missing.
 
367
  database_unreadable: { display: "#NO ACCESS", message: "You do not have access to this database." },
368
  field_unknown: { display: "#FIELD?", message: "This field is no longer in the database." },
369
  scope_not_applicable: { display: "#ERROR!", message: "The database cannot apply this cell's row restrictions." },
370
+ // HOTFIX 2026-09-24: a cell with no answer computed for this reader yet is not a failed
371
+ // calculation, and painting it `#ERROR!` is what made a working binding look broken.
372
+ sheet_refresh_required: { display: "#REFRESH", message: "Press Refresh to calculate this cell for your access." },
373
  };
374
  const BINDING_REFUSAL_FALLBACK = { display: "#ERROR!", message: "This cell's database binding could not be calculated." };
375
 
 
1612
  (real: number) => viewIndexOf(allVisRows, real) - bandRows,
1613
  [allVisRows, bandRows],
1614
  );
1615
+ /**
1616
+ * ⭐ HOTFIX 2026-09-24: THE NUMBER glide's ROW MARKER PAINTS, AS THE SHEET'S OWN ROW.
1617
+ * glide paints `rowMarkerStartIndex + drawnRow`, blind to hidden rows, so an imported workbook
1618
+ * hiding rows 9 to 27 labelled sheet row 31 as 12 while the name box said F31. ONE function
1619
+ * serves both mounts: the main grid starts at `bandRows + 1` and the band at 1, and in both
1620
+ * cases `shown - bandRows - 1` is exactly the view row `realRow` already speaks (negative in
1621
+ * the band), so the marker, the name box and the selected row's overlay read one number.
1622
+ */
1623
+ const rowLabel = useCallback((shown: number) => realRow(shown - bandRows - 1) + 1,
1624
+ [realRow, bandRows]);
1625
  /** The A1 address glide's cell stands for. THE one door from a view coordinate to an address. */
1626
  const addrAt = useCallback(
1627
  (col: number, row: number) => addressOf(realCol(col), realRow(row)),
 
6285
  headerHeight={HEADER_HEIGHT}
6286
  drawHeader={drawColumnHeader}
6287
  rowMarkers="number"
6288
+ rowLabel={rowLabel}
6289
  rowMarkerWidth={ROW_MARKER_WIDTH}
6290
  smoothScrollX
6291
  // β›” DRIVEN, NEVER DRIVING. The main grid reports its visible region and this
 
6414
  // the grid above this one and are NOT among the rows here, so without this the sheet
6415
  // would show two rows called 1. glide offers the start index as a first class prop.
6416
  rowMarkerStartIndex={bandRows + 1}
6417
+ // ⭐ HOTFIX 2026-09-24: ...and each number is the SHEET's row, hidden rows skipped.
6418
+ rowLabel={rowLabel}
6419
  // β›”β›” W51-T34: NO SECOND ROW OF COLUMN LETTERS. While a band is on screen the band
6420
  // grid carries the header and this one is given a height of zero for it, which glide
6421
  // guards itself (`drawGridHeaders` returns before drawing at a total of zero). With no
web/src/sheet/sheetDataEditor.tsx ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ⭐⭐ HOTFIX 2026-09-24 β€” THE ROW NUMBER IS THE SHEET'S ROW, NOT GLIDE'S COUNT OF DRAWN ROWS.
3
+ *
4
+ * Owner, on the imported Daily Sales workbook: *"the sheet module row when highlighted is the
5
+ * wrong number."* That workbook hides rows 9 to 27, so the row reading `Current YTD` is sheet row
6
+ * 31. The name box said F31, the selected row's marker (`.sheet-active-row-header`, which goes
7
+ * through `realRow`) said 31, and glide's own canvas marker said 12, because `rowMarkers="number"`
8
+ * paints `rowMarkerStartIndex + drawnIndex` and knows nothing about hidden rows. Every formula in
9
+ * the workbook addresses row 31, and Excel numbers that row 31, so the CANVAS was the wrong half.
10
+ *
11
+ * β›” glide 6.0.3 HAS NO ROW-LABEL CALLBACK, and `drawCell` never receives a marker cell
12
+ * (`isInnerOnlyCell`). The marker is painted by `markerCellRenderer`, looked up by cell kind in
13
+ * the `renderers` prop. β›”β›” AND THE PACKAGE'S OWN `DataEditor` IGNORES THAT PROP: it is
14
+ * `DataEditorAll`, which spreads the caller's props and then sets `renderers: AllCellRenderers`
15
+ * over them. So this is `DataEditorAll` rebuilt on `DataEditorCore`, with the same sprites and
16
+ * image loader it supplies, and one renderer swapped: the marker, given the number it would
17
+ * have painted, paints `rowLabel(thatNumber)` instead.
18
+ *
19
+ * ⚠ THE EXPORT KEEPS THE NAME `DataEditor` ON PURPOSE. `verify_api.py`'s W51-T34 legs census the
20
+ * two sheet mounts by the pattern `<DataEditor[\s/>]`, so the mounts stay spelled that way and
21
+ * only their import moves here.
22
+ */
23
+ import { forwardRef, useMemo } from "react";
24
+ import {
25
+ AllCellRenderers,
26
+ DataEditorCore,
27
+ ImageWindowLoaderImpl,
28
+ InnerGridCellKind,
29
+ markerCellRenderer,
30
+ sprites,
31
+ type DataEditorProps as GlideDataEditorProps,
32
+ type DataEditorRef,
33
+ type MarkerCell,
34
+ } from "@glideapps/glide-data-grid";
35
+
36
+ type Renderer = (typeof AllCellRenderers)[number];
37
+
38
+ export interface DataEditorProps extends GlideDataEditorProps {
39
+ /** The row number the marker column paints, given the one glide would have painted. */
40
+ rowLabel?: (shown: number) => number;
41
+ }
42
+
43
+ /** glide's marker renderer, painting (and announcing) `rowLabel(row)` in place of `row`. */
44
+ function relabelledMarker(rowLabel: (shown: number) => number): Renderer {
45
+ const base = markerCellRenderer;
46
+ const shown = (cell: MarkerCell): MarkerCell => ({ ...cell, row: rowLabel(cell.row) });
47
+ const marker: typeof markerCellRenderer = {
48
+ ...base,
49
+ // ⚠ The stock renderer reads the number off `args.cell`, not off its second argument, so
50
+ // both carry the relabelled cell.
51
+ draw: (args, cell) => {
52
+ const next = shown(cell);
53
+ base.draw({ ...args, cell: next }, next);
54
+ },
55
+ getAccessibilityString: (cell) => base.getAccessibilityString(shown(cell)),
56
+ };
57
+ return marker as unknown as Renderer;
58
+ }
59
+
60
+ export const DataEditor = forwardRef<DataEditorRef, DataEditorProps>(function DataEditor(
61
+ { rowLabel, headerIcons, imageWindowLoader, ...rest }, ref,
62
+ ) {
63
+ const renderers = useMemo(
64
+ () => (rowLabel
65
+ ? AllCellRenderers.map((r) => (r.kind === InnerGridCellKind.Marker ? relabelledMarker(rowLabel) : r))
66
+ : AllCellRenderers),
67
+ [rowLabel],
68
+ );
69
+ const allSprites = useMemo(() => ({ ...sprites, ...headerIcons }), [headerIcons]);
70
+ const loader = useMemo(() => imageWindowLoader ?? new ImageWindowLoaderImpl(), [imageWindowLoader]);
71
+ return (
72
+ <DataEditorCore {...rest} ref={ref} renderers={renderers} headerIcons={allSprites}
73
+ imageWindowLoader={loader} />
74
+ );
75
+ });