Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2026-08-02 - Dynamic Limits and Client Side Form Validation
**Learning:** Client-side file size validations using hardcoded UI text values fall out of sync easily when logic bounds like `MAX_UPLOAD_BYTES` are changed, degrading user experience. Validating the combined total size of batched file uploads provides better immediate inline feedback.
**Action:** Use `formatBinaryBytes(MAX_UPLOAD_BYTES)` in JavaScript code to construct file limit strings dynamically, keeping UI validation messages consistent with server-side limits. Ensure batch uploads evaluate total file sizes to give immediate feedback before lengthy submission attempts.
## 2024-07-12 - Intercepting batch form submissions for testing visual loading states
**Learning:** Extending the learning from 2024-06-13, intercepting form submissions using `e.preventDefault()` via `page.evaluate()` is essential for capturing screenshot and video evidence of loading states (e.g., button disabling, spinner appearing) on forms like batch upload where the submission would normally reload the page or download an archive.
**Action:** When testing visual loading states with Playwright, always inject an event listener using `page.evaluate()` to call `e.preventDefault()` on the form's `submit` event to freeze the UI in its loading state for verification.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
### Added
- 닀쀑 파일 μ—…λ‘œλ“œ 선택 μ‹œ 즉각적인 파일 개수 ν”Όλ“œλ°± 및 μ œν•œ 초과 κ²½κ³  λ©”μ‹œμ§€ μΆ”κ°€
- 일괄 μ—…λ‘œλ“œ 폼에 λŒ€μƒ λ°”μ΄νŠΈ 프리셋 λ²„νŠΌκ³Ό 총 파일 크기 미리보기λ₯Ό μΆ”κ°€ν•˜μ—¬ μ‚¬μš©μ„±μ„ κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€.
- 닀쀑 파일 μ—…λ‘œλ“œ 선택 μ‹œ 총 파일 크기 검증 κΈ°λŠ₯κ³Ό 동적 μ œν•œ λ©”μ‹œμ§€ μΆ”κ°€
13 changes: 11 additions & 2 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ async def add_security_headers(request: Request, call_next):
return;
}
const text = formatBinaryBytes(file.size);
const limitStr = formatBinaryBytes(MAX_UPLOAD_BYTES);
if (file.size > MAX_UPLOAD_BYTES) {
input.setCustomValidity('File exceeds 5 GiB limit.');
input.setCustomValidity('File exceeds ' + limitStr + ' limit.');
input.setAttribute('aria-invalid', 'true');
preview.innerText = 'Selected file size: ' + text + ' (exceeds 5 GiB limit)';
preview.innerText = 'Selected file size: ' + text + ' (exceeds ' + limitStr + ' limit)';
preview.style.color = '#dc3545';
return;
}
Expand Down Expand Up @@ -325,6 +326,14 @@ async def add_security_headers(request: Request, call_next):
preview.style.color = '#dc3545';
return;
}
const limitStr = formatBinaryBytes(MAX_UPLOAD_BYTES);
if (totalSize > MAX_UPLOAD_BYTES) {
input.setCustomValidity('Total size exceeds ' + limitStr + ' limit.');
input.setAttribute('aria-invalid', 'true');
preview.innerText = 'Selected ' + files.length + ' file(s) (' + formatBinaryBytes(totalSize) + ', total size exceeds ' + limitStr + ' limit)';
preview.style.color = '#dc3545';
return;
}
preview.innerText = 'Selected ' + files.length + ' file(s) (' + formatBinaryBytes(totalSize) + ')';
}

Expand Down
4 changes: 3 additions & 1 deletion tests/test_saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def test_get_ui_includes_binary_file_size_validation(self):

self.assertIn("const MAX_UPLOAD_BYTES = 5 * 1024 * 1024 * 1024;", html)
self.assertIn("['B', 'KiB', 'MiB', 'GiB']", html)
self.assertIn("File exceeds 5 GiB limit.", html)
self.assertIn("const limitStr = formatBinaryBytes(MAX_UPLOAD_BYTES);", html)
self.assertIn("File exceeds ' + limitStr + ' limit.", html)
self.assertIn("Total size exceeds ' + limitStr + ' limit.", html)
self.assertIn("preview.style.color = '#0f6674';", html)
self.assertIn('onchange="updateFileSizePreview(this)"', html)

Expand Down
Loading