Files
houseplan-card/docs/specs/039-large-backdrops.md
T
Matysh 112c260314
Validate / hacs (push) Failing after 12s
Validate / hassfest (push) Failing after 13s
Validate / frontend (push) Successful in 3m2s
Validate / golden (push) Failing after 51s
Validate / backend (push) Failing after 6m50s
Validate / smoke (push) Failing after 13m44s
Validate / performance (push) Failing after 24m13s
Release v1.61.0-beta.1
2026-08-09 21:51:33 +03:00

59 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ТЗ #39 — Безопасная работа с большими подложками
- Issue: https://github.com/Matysh/houseplan-card/issues/39
- Приоритет: P2
- Статус ТЗ: research-first, thresholds утверждаются по benchmark
## Цель
До upload предупреждать о raster, способном исчерпать память tablet/WebView,
и предлагать уменьшенную копию без потери текущего плана при ошибке.
## Локальная диагностика
Для PNG/JPEG/WebP до сетевого запроса:
- MIME/signature и file bytes;
- decoded width×height через `createImageBitmap`, fallback isolated `<img>`;
- megapixels и minimum decoded RGBA memory `w*h*4`;
- estimated working peak: bitmap + canvas + encoded output (conservative 2.5×);
- рекомендуемый target dimensions.
Object URLs всегда revoke; decode timeout/error не заменяет текущий backdrop.
SVG получает file-size/security validation, но не raster memory/downscale.
## Threshold protocol
Перед code default провести matrix на reference low-end wall tablet WebView и
desktop Chromium: 4/8/16/32/64 MP, transparency, JPEG/WebP. Ship constants
документируются как `WARN_DECODED_BYTES` и `MAX_SAFE_DIMENSION`. Рекомендуемый
начальный guard для исследования: warning при >32 MP либо estimated peak
>128 MiB; это не становится product constant без результатов.
## UX
- Safe: обычный upload.
- Warning: dialog показывает resolution, file size, estimated memory и действия
«Загрузить уменьшенную копию», «Оставить оригинал», Cancel.
- Hard browser limit/decode failure: только Cancel и инструкция уменьшить файл
desktop tool; нельзя продолжать blind.
- Downscale сохраняет aspect; longest side до benchmark target. PNG с alpha
остаётся PNG, opaque photo — JPEG/WebP с documented quality; metadata не
требуется.
## Transaction
Existing backdrop/config остаются до успешного upload+validation+config save.
Downscaled Blob проходит тот же quota/copy-on-write backend path. При upload,
save или decode failure staging очищается, старый ref не удаляется. Undo и
explicit plan deletion работают как сейчас.
## Проверки и приёмка
- header fixtures без выделения гигантского canvas до warning;
- alpha/aspect/orientation (EXIF), corrupt/truncated, decode timeout;
- failed upload/save preserves previous plan and files;
- memory benchmark report + documented thresholds;
- mobile dialog без horizontal scroll;
- SVG никогда автоматически не растеризуется.