[object Object]

← back to Rentv Sheet Enrich Refine

FIX write off-by-hr: 9 tabs have a title row above the header (hr=1) so write_cell's hardcoded row0+1 wrote to the HEADER row instead of the data row. Snapshot now stores hr per tab; write_cell targets hr+1+row0. Verified against live sheet (retail panel / ARIZONA BROKERAGE etc.).

1c5e09268553bc5ab4ec1d1decd9c7b17f80b71d · 2026-08-13 18:10:22 -0700 · Steve Abrams

yoloforever cycle 3 (Cody title-row hint).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 1c5e09268553bc5ab4ec1d1decd9c7b17f80b71d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Aug 13 18:10:22 2026 -0700

    FIX write off-by-hr: 9 tabs have a title row above the header (hr=1) so write_cell's hardcoded row0+1 wrote to the HEADER row instead of the data row. Snapshot now stores hr per tab; write_cell targets hr+1+row0. Verified against live sheet (retail panel / ARIZONA BROKERAGE etc.).
    
    yoloforever cycle 3 (Cody title-row hint).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 __pycache__/live_server.cpython-314.pyc | Bin 23023 -> 23129 bytes
 __pycache__/snapshot.cpython-314.pyc    | Bin 11661 -> 11686 bytes
 live_server.py                          |  10 ++++++----
 snapshot.py                             |   4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/__pycache__/live_server.cpython-314.pyc b/__pycache__/live_server.cpython-314.pyc
index c2daa43..eadb3e4 100644
Binary files a/__pycache__/live_server.cpython-314.pyc and b/__pycache__/live_server.cpython-314.pyc differ
diff --git a/__pycache__/snapshot.cpython-314.pyc b/__pycache__/snapshot.cpython-314.pyc
index e41e39d..09ed68c 100644
Binary files a/__pycache__/snapshot.cpython-314.pyc and b/__pycache__/snapshot.cpython-314.pyc differ
diff --git a/live_server.py b/live_server.py
index e679192..d0766f8 100644
--- a/live_server.py
+++ b/live_server.py
@@ -156,13 +156,15 @@ def resolve_combined(gids, crow, ucol):
     return None
 
 def write_cell(gid, row0, col0, value, formula=False):
-    # 1) LIVE write to the sheet (row0 is 0-based over DATA rows; +1 for the header)
-    cell = {"row0": int(row0) + 1, "col0": int(col0), "value": value}
+    # row0 is 0-based over DATA (body) rows; the real sheet grid row = hr + 1 + row0
+    # (hr = the tab's header row; tabs with a title row ABOVE the header have hr>0)
+    t = SNAP["_by_gid"].get(int(gid))
+    hr = t.get("hr", 0) if t else 0
+    cell = {"row0": int(row0) + hr + 1, "col0": int(col0), "value": value}
     if formula:
         cell["formula"] = True
     retry(lambda: lib.batch_fill(tok(), int(gid), [cell]))
-    # 2) patch the in-memory local copy so the UI reflects it instantly + marks green
-    t = SNAP["_by_gid"].get(int(gid))
+    # 2) patch the in-memory local copy (body-indexed) so the UI reflects it instantly + marks green
     if t:
         r, c = int(row0), int(col0)
         while len(t["rows"]) <= r:
diff --git a/snapshot.py b/snapshot.py
index 10a38c6..8d16f87 100644
--- a/snapshot.py
+++ b/snapshot.py
@@ -76,7 +76,7 @@ def build(tok=None):
     for (gid, title), vr in zip(sheets, value_ranges):
         rows = vr.get("values", [])
         if not rows:
-            tabs.append({"gid": gid, "title": title, "headers": [], "rows": [], "green": [], "colors": {}})
+            tabs.append({"gid": gid, "title": title, "headers": [], "rows": [], "green": [], "colors": {}, "hr": 0})
             continue
         hr = header_row(rows)
         width = max((len(r) for r in rows), default=0)
@@ -110,7 +110,7 @@ def build(tok=None):
                 v = str(r[sidx]).strip() if sidx < len(r) else ""
                 if v:
                     svalue_tally[v] = svalue_tally.get(v, 0) + 1
-        tabs.append({"gid": gid, "title": title, "headers": headers, "rows": body, "green": green, "colors": colors})
+        tabs.append({"gid": gid, "title": title, "headers": headers, "rows": body, "green": green, "colors": colors, "hr": hr})
     status_colors = {v: max(cnts, key=cnts.get) for v, cnts in scolor_tally.items()}
     status_values = [v for v, _ in sorted(svalue_tally.items(), key=lambda kv: -kv[1])]
     return {"generated": int(time.time()), "tabs": tabs,

← 8150eeb Live console: guard drag-to-fill against phantom writes — na  ·  back to Rentv Sheet Enrich Refine  ·  rentv :9797 exact-colors: Cody fixes — readable text on pain 707c9b1 →