oficina / estilo Public

Google Drive chooser for incremental Docs and Sheets import closed

On branch feat/google-import

Google Drive import needs one shared chooser for Docs and Sheets. This branch adds an optional browser token/Picker flow that exports a selected native Google file into memory and submits it through each app's ordinary multipart form. Google tokens never reach Oficina. The import page alone allows the required Google origins; file conversion and persisted omission reports remain app-owned.

The first-slice design is in implementation/google-drive-import.md. Claude Fable 5.1 (claude-fable-5-1) reviewed it, requested corrections for nested document text, atomic creation, cached formulas and typed text, and APPROVED the corrected spec on 2026-11-01. This is design approval, not yet whole-branch approval.

Validation: make test passed; go test -tags browser -count=1 ./googleimport passed in Chromium and WebKit using controlled Google responses. Tests exercise cancellation, stale authorization callbacks, duplicate Picker selection callbacks, denied consent/export, shortcut refusal, retry, multipart fields, CSP, narrow-screen layout and scriptless upload. The hidden-control check initially failed because the framework's button display rule overrode hidden; wrapping the buttons fixed the observed failure. Real Google scripts and a Picker frame also initialized under the proposed policy. Live account consent/export still needs a configured Google Cloud project and a person on an authorized canary origin; production configuration remains off.

App integrations are on oficina/docs and oficina/sheets branches feat/google-import. Whole-branch model review and CI are required before merge; nothing is deployed by this branch.

Remote CI for 18723a1 currently fails at vet: rastrillo sessions and ui packages cannot be found. The exact same failure is present on current main cca97df, including a passing module-cache verification before vet. A fresh local download of rastrillo v0.23.0 contains both packages and matches the pinned checksum; local make test passes in full. This is an unresolved remote CI problem, not a green gate. No merge is permitted until CI passes. Whole-branch review by Claude Fable 5.1 is in progress.

Whole-branch review by Claude Fable 5.1: APPROVED on code at 18723a1; remote CI remains a separate, unmet merge gate.

estilo feat/google-import: whole-branch review Reviewer: Claude Fable 5.1 (claude-fable-5-1), 2026-11-01. Branch: feat/google-import at 18723a1, read as one diff against origin/main cca97df (merge base cca97df, one commit, 11 files, +984). Discussion oficina/estilo #31 is the record.

VERDICT ON THE CODE: APPROVED. No blockers. Four non-blocking nits below; none needs a re-review if fixed.

MERGE GATE: CI is RED at vet on 18723a1 (runner reports no required module provides rastrillo/sessions and rastrillo/ui). The same failure reproduces on origin/main cca97df (recorded in #31), local make test and the full make test-browser (every package, Chromium and WebKit) are green at 18723a1, and a fresh local module download holds ui and sessions at the pinned checksums. So the fault is the runner's module cache, not the branch. Do not merge until amadan ci status exits 0. The suite's earlier hub-CI note (per-IP git burst limit on a cold module cache; fix with a retried serial go mod download, not re-runs) is the first thing to check. Approval here does not stand in for the green run.

WHAT I RAN make test at 18723a1: all modules verified, vet (both tags), gofmt, build, go test ./... all pass. The parent additionally reports the full make test-browser green at 18723a1 in both engines; I ran only the googleimport package under the browser tag. ESTILOPLAYWRIGHT=.../docs-general/fixtures/engines/nodemodules/playwright go test -tags browser -count=1 ./googleimport: ok, 8.4 s, Chromium and WebKit, covering keyboard open, cancel, blocked popup, denied scope, shortcut rejection, export 403 then retry, duplicate picker callback, cancel during slow auth and during slow export, 24x24 target, 320 px reflow, empty local and session storage, disabled config renders nothing, no CSP violations, no page errors, no COOP header, scriptless page shows the plain form and the noscript note.

CHECKED AGAINST THE APPROVED SPEC Token model, drive.file only, token in page memory, Authorization header only, credentials omitted, redirects refused, no-referrer: present (google-import.mjs download). Fixed googleapis origin built from a validated ID; MIME checked against the native type so shortcuts are refused before any request: present (selection, plus the node test that asserts no fetch). 10 MiB bound on actual streamed bytes, Content-Length checked first, cancel on overflow: present. exportSizeLimitExceeded and 413 get the distinct tooLarge message; 401/403 denied; 404 and the rest unavailable with the "ask your administrator" copy that R2 asked for on the setAppId mismatch: present. Google error bodies read to 16 KiB for the reason code only, never surfaced: present and tested. File named from the picked name with separators and control characters replaced, 200-char cap, extension appended: present. DataTransfer into the app's own file input and requestSubmit, so one route and one CSRF check serve both paths; the upload test asserts the hidden creation token survives and the bearer never reaches the app: present. Config validated as a trio with regexes; partial config refuses; unset hides the component: present. Policy derived from the app constant, one header, 'none' dropped where a Google source is added, script-src-elem and child-src fallbacks handled, duplicate or multi-header policies refused, no COOP added: present and tested, and the baseline in the test is byte-equal to Docs' and Sheets' ContentSecurityPolicy constants. Twelve locales, the same twelve as chrome's, every label non-empty, template escaping checked with an injected FormID: present. estilo-* attribute for the component root, rst-btn for the buttons: consistent with AGENTS.md's three-way split and the lint tripwire passes. Node tests in untagged go test follow the existing chrome and savestatus precedent, so CI needs nothing new.

NON-BLOCKING NITS N1 google-import.mjs:171. On a bfcache restore (back from the job page) reset('ready') leaves the exported File in the input, so pressing Import again re-uploads it as a second import. Clear input.value in that branch. Docs' creation token absorbs this; Sheets would get a duplicate sheet. N2 google-import.mjs errorcallback maps every GIS error to 'failed', whose copy says "allowing the Google popup". For type popupclosed the person closed it themselves; 'cancelled' reads right there. Same copy serves a script-load failure (an ad blocker on accounts.google.com), where the popup advice misleads slightly. N3 policy.go. When a base policy has default-src 'none' and no script-src, the fallback copies 'none', strips it and leaves only the Google origins, so the app's own module script would be blocked. Neither app has that shape today; a comment, or adding 'self' when the fallback was 'none', closes it for the next consumer. N4 README step 4 says the API key's website restrictions must include https://docs.google.com/*. I did not verify that against Google's current Picker guidance; the live consent check on the canary will settle it either way, so leave it but confirm it there.

NOTED, NOT A FINDING The GIS and Picker scripts load at mount, so viewing a configured import page contacts Google before any click. The disclosure sentence on the page says so, the reason (the popup needs the click's user activation, which an async load would spend) is sound, and the integration is per-deployment opt-in, so suite ruling 6 on egress is met. Operators should know that enabling the three settings has this effect on page view, which the README's disclosure paragraph covers.

STILL PENDING, AS THE BRANCH ITSELF SAYS Live consent and a real export on an authorized canary origin with a configured project. Mocked Google here proves the integration, not the consent. Production Google settings stay unset until that is done.

Parent follow-up: N1–N3 are fixed and Chromium/WebKit checks pass. N4 is confirmed by Google's current Picker setup guidance, which explicitly requires the application website and https://docs.google.com/* when website restrictions are used. No real-account consent/export is claimed.

CI now passes at 514481f1b6469ae849b2d077cb90bf7ed5806d6b (checked with amadan ci status oficina/estilo -branch feat/google-import, exit 0). This is the reviewed implementation plus N1–N3 fixes, which Fable explicitly said need no re-review. Chooser tests pass in Chromium and WebKit at this tip. The prior red run remains recorded above. Landing the shared component; Google stays disabled in apps until configured and live consent remains pending.