Skip to content

fix(app): CSV downloads save instead of opening as a page - #46

Merged
goetchstone merged 3 commits into
mainfrom
fix/app-window-downloads
Oct 8, 2026
Merged

goetchstone merged 3 commits into
mainfrom
fix/app-window-downloads

Conversation

@goetchstone

Copy link
Copy Markdown
Owner

What and why

The bug. In the app window, Builder → a read → Download CSV replaced the page with the CSV shown as text, and the window has no Back, so the only way out was to quit. The Audit export and the onboarding template CSV did the same. Logged in docs/failure-log/2026-10-08-a-csv-download-opened-as-a-page-in-the-app-window.md.

The cause. pywebview 6.2.1's macOS backend downloads a response only when WebKit can't display it (canShowMIMEType) or when the link has the HTML download attribute (shouldPerformDownload). CSV is text, so WebKit displays it and ignores Content-Disposition: attachment. ALLOW_DOWNLOADS = True only enables those two paths. A browser downloads either way, so TestClient and the Chrome a11y run never saw it, and CI never launches the .app.

The fix. download on every link to an attachment route (audit.html, onboarding.html, _records_meta.html). WebKit then hands it to pywebview's save panel, in the window's own session (token cookie included). tests/test_app_window_downloads.py finds every GET route that sends an attachment and fails unless each is linked with download.

Also: the first live account delete is recorded (README row, offboarding runbook, plan): the offboarded leaver, from the user page, after the transfer completed.

How it was verified

  • .venv/bin/python -m pytest -q passes (1607 passed); the new test fails with the attribute removed
  • make lint is clean; make a11y passes (axe 0)

Live status: the save panel appearing is reasoned from pywebview's source and unproven until the operator clicks Download CSV in the rebuilt app. The delete ran live on the operator's tenant.

Nothing private

  • No credentials, real domain names, real addresses, or captures from a real tenant

🤖 Generated with Claude Code

goetchstone and others added 2 commits October 8, 2026 07:14
In the app window a CSV link replaced the page with the CSV as text and
left no way back: pywebview downloads only what WebKit can't show, or a
link with the download attribute, and CSV is text. Every link to an
attachment route now carries download, and a test holds every such
route to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The offboarded leaver was deleted from the user page after the transfer
completed (GAM 7.48.22). The README row, the offboarding runbook and the
plan now say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goetchstone
goetchstone enabled auto-merge (squash) October 8, 2026 11:15
no-failure-log: records the operator's check of this branch's own fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goetchstone
goetchstone merged commit 5f8193e into main Oct 8, 2026
17 checks passed
@goetchstone
goetchstone deleted the fix/app-window-downloads branch October 8, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant