oficina / sheets Public

fix(drive): chrome.mjs names its sheet by renaming it, not by a field

The sibling of the drive.mjs fix in the commit before this, and the
same breakage: chrome.mjs filled #title on the sheet list to name the
sheet it builds, and that field no longer exists. It landed after this
branch was cut, so the rebase is where the two met.

It now clicks the top bar's Create and renames from the title. That is
not just a substitution: the rename is a real form submit, so the
manual gate now covers the scriptless naming path, which is the only
way a sheet is ever named.

Verified by running it rather than by reading it — all 22 checks pass,
including "export downloads a real xlsx / ...named after the sheet",
which is the one that would have failed loudly if the rename had not
actually taken, since the filename comes from the title.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 51bc3e0559f99ab7b5a21dfaa163d56071c0b331 parent 465160f
1 file changed, +17 −3
  • tools/drive/chrome.mjs +17 −3
diff --git a/tools/drive/chrome.mjs b/tools/drive/chrome.mjs
index 65083a8..95aaa11 100644
--- a/tools/drive/chrome.mjs
+++ b/tools/drive/chrome.mjs
@@ -63,9 +63,23 @@ if (!m) { console.error('no magic link in the log'); process.exit(1); }
await page.goto(m[0]);
await page.waitForURL(/\/sheets/);
-/* A sheet with something in it. */
-await page.fill('#title', 'Commission Q2');
-await Promise.all([page.waitForURL(/\/sheets\/\d+$/), page.click('form[action="/sheets"] button[type=submit]')]);
+/* A sheet with something in it.
+ *
+ * Created from the top bar's Create button, then named by renaming it.
+ * The list page's #title field is gone: it carries no forms now, Create
+ * posts an empty one and the sheet lands as "Untitled sheet", so the
+ * only place a sheet is ever named is the title in the top bar. The
+ * rename is a real form submit, so driving it here covers the
+ * scriptless path as well as the button. */
+await Promise.all([
+ page.waitForURL(/\/sheets\/\d+$/),
+ page.click('[rst-shell-tail] form[action="/sheets"] button[type=submit]'),
+]);
+await page.fill('[data-doc-title-input]', 'Commission Q2');
+await Promise.all([
+ page.waitForURL(/\/sheets\/\d+$/),
+ page.press('[data-doc-title-input]', 'Enter'),
+]);
const url = page.url();
await page.waitForFunction(() => window.SheetsGrid && window.SheetsGrid.worksheet());