Skip to content

๐ŸŽจ Palette: Add dynamic human-readable size preview - #58

Merged
seonghobae merged 5 commits into
mainfrom
palette/dynamic-filesize-preview-8836426316054162301
Jun 12, 2026
Merged

๐ŸŽจ Palette: Add dynamic human-readable size preview#58
seonghobae merged 5 commits into
mainfrom
palette/dynamic-filesize-preview-8836426316054162301

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

๐Ÿ’ก What

Added a dynamic human-readable file size preview (e.g., "2.00 GB", "500.00 MB") right next to the "Target Bytes" input in saas_web.py. The preview updates automatically as the user types using inline JavaScript.

๐ŸŽฏ Why

Users often struggle to conceptualize large raw byte numbers (like 2000000000), which easily leads to magnitude errors (e.g., adding an extra zero). Providing a live preview in familiar units (MB, GB) drastically improves user confidence and prevents submission mistakes.

๐Ÿ“ธ Before/After

Before: Users just see a text box containing 2000000000.
After: Users see a green, bold preview text below the input that says 2.00 GB, which dynamically updates as they edit the input.

โ™ฟ Accessibility

  • The new preview text is linked to the input via the aria-describedby attribute.
  • The preview <span> has aria-live="polite" so screen readers will announce the calculated size as the user finishes typing.
  • The submit button logic was refactored to set aria-busy="true" when clicked, signaling to screen readers that processing is happening.

PR created automatically by Jules for task 8836426316054162301 started by @seonghobae

Adds a dynamic, ARIA-announced preview to the target bytes input in saas_web.py to prevent magnitude errors.
@google-labs-jules

Copy link
Copy Markdown

๐Ÿ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a ๐Ÿ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 3 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

โŒ› How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

๐Ÿšฆ How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d70aee52-2d4d-4e98-a83d-bb45931691b4

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 9265335 and 8e088a8.

๐Ÿ“’ Files selected for processing (2)
  • saas_web.py
  • tests/test_saas_web.py
๐Ÿ“ Walkthrough

Walkthrough

ํŒŒ์ผ ํฌ๊ธฐ ์ž…๋ ฅ ํ•„๋“œ์— ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ์‹ค์‹œ๊ฐ„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ์ ‘๊ทผ์„ฑ ๊ธฐ๋Šฅ ๊ตฌํ˜„. ๊ฐ€์ด๋“œ๋ผ์ธ ๋ฌธ์„œํ™”, HTML/JavaScript ๊ตฌํ˜„, ์ ‘๊ทผ์„ฑ ์†์„ฑ ๊ฒ€์ฆ์„ ํฌํ•จ.

Changes

Accessible File Size Preview

Layer / File(s) Summary
Design and accessibility guidelines
.jules/palette.md
์›์‹œ ๋ฐ”์ดํŠธ ์ž…๋ ฅ ์˜†์— aria-live ์˜์—ญ์œผ๋กœ ์ œ๊ณต๋˜๋Š” ์‚ฌ๋žŒ์ด ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ํŒŒ์ผ ํฌ๊ธฐ(MB/GB) ์‹ค์‹œ๊ฐ„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์— ๋Œ€ํ•œ ์ƒˆ๋กœ์šด ๊ฐ€์ด๋“œ ํ•ญ๋ชฉ ์ถ”๊ฐ€.
Real-time file size preview implementation
saas_web.py
target_bytes ์ž…๋ ฅ์— oninput ๊ฒ€์ฆ ๋ฐ B/KB/MB/GB ๋‹จ์œ„ ๋ณ€ํ™˜ ๋กœ์ง์„ ์ถ”๊ฐ€. aria-live ์†์„ฑ๊ณผ ์ดˆ๊ธฐ๊ฐ’ 2.00 GB๋ฅผ ํฌํ•จํ•˜๋Š” target_bytes_preview ์š”์†Œ๋ฅผ HTML_TEMPLATE์— ์ถ”๊ฐ€. ํผ submit ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ๋กœ ๋ฒ„ํŠผ ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์ด๋™ํ•˜์—ฌ ์ธ๋ผ์ธ onsubmit ์ฒ˜๋ฆฌ ๋Œ€์‹  ๋ถ„๋ฆฌ๋œ JavaScript ์ฒ˜๋ฆฌ ๊ตฌํ˜„.
Accessibility verification tests
tests/test_saas_web.py
test_get_ui_includes_accessible_target_size_preview ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ UI ์‘๋‹ต์˜ aria-describedby, id="target_bytes_preview", aria-live="polite" ์†์„ฑ๊ณผ 2.00 GB ํ‘œ์‹œ ํ…์ŠคํŠธ, aria-busy ์„ค์ • ๋ฌธ์ž์—ด์„ ๊ฒ€์ฆ.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Input as target_bytes input
  participant Handler as oninput handler
  participant Preview as target_bytes_preview element
  participant Form as shrink-form submit
  participant Button as submit button
  User->>Input: ํฌ๊ธฐ ๊ฐ’ ์ž…๋ ฅ
  Input->>Handler: oninput ์ด๋ฒคํŠธ ๋ฐœ์ƒ
  Handler->>Handler: ๋ฐ”์ดํŠธ ๊ฐ’ ๊ฒ€์ฆ
  Handler->>Handler: B/KB/MB/GB ๋‹จ์œ„ ๋ณ€ํ™˜
  Handler->>Preview: ๋ณ€ํ™˜๋œ ํฌ๊ธฐ ํ‘œ์‹œ ๊ฐฑ์‹ 
  Preview->>Preview: aria-live="polite" ์˜์—ญ์œผ๋กœ ์•Œ๋ฆผ
  User->>Form: ํผ ์ œ์ถœ
  Form->>Button: aria-busy='true' ์„ค์ •
  Form->>Button: ๋ฒ„ํŠผ ๋น„ํ™œ์„ฑํ™”
Loading

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~12 minutes

Poem

๐Ÿฐ ๋ฐ”์ดํŠธ ์ž…๋ ฅ์ฐฝ์ด ์šธ์ปฅํ–ˆ์–ด์š”,
๊ธฐ๊ฐ€๋ฐ”์ดํŠธ๋กœ ๋ณ€์‹ ํ•˜๋ฉฐ ๋ชฉ์†Œ๋ฆฌ ๋†’์˜€์–ด์š”,
aria-live๊ฐ€ ๋ชจ๋‘์—๊ฒŒ ์†Œ์‹ ์ „ํ•˜๊ณ ,
์ ‘๊ทผ์„ฑ์€ ์ด์ œ ๋ชจ๋‘์˜ ๊ฒƒ,
ํ…Œ์ŠคํŠธ๋„ ํ•จ๊ป˜ ์›ƒ์Œ์ง€์œผ๋ฉฐ ํ™˜์˜ํ•ด์š”! ๐ŸŽ‰


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

โŒ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage โŒ Error Docstring coverage is 0.00% which is insufficient. The required threshold is 100.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
โœ… Passed checks (4 passed)
Check name Status Explanation
Title check โœ… Passed PR ์ œ๋ชฉ์ด ์ฃผ์š” ๋ณ€๊ฒฝ์‚ฌํ•ญ์ธ ๋™์  ์ธ๊ฐ„-๊ฐ€๋…ํ˜• ํŒŒ์ผ ํฌ๊ธฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ถ”๊ฐ€๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ๋ฐ˜์˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
Description check โœ… Passed PR ์„ค๋ช…์ด ๋ณ€๊ฒฝ์‚ฌํ•ญ, ๋ชฉ์ , ์ ‘๊ทผ์„ฑ ๊ฐœ์„  ๋“ฑ์„ ํฌ๊ด„์ ์œผ๋กœ ๋‹ค๋ฃจ๋ฉฐ ์ „๋ฐ˜์ ์œผ๋กœ ๋ณ€๊ฒฝ ์‚ฌํ•ญ๊ณผ ๊ด€๋ จ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
Linked Issues check โœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check โœ… Passed Check skipped because no linked issues were found for this pull request.
โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette/dynamic-filesize-preview-8836426316054162301
โœจ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch palette/dynamic-filesize-preview-8836426316054162301

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously requested changes Jun 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

๐Ÿงน Nitpick comments (2)
saas_web.py (1)

39-39: ๐Ÿ’ค Low value

ํŒŒ์ผ ํฌ๊ธฐ ๋‹จ์œ„ ๋ณ€ํ™˜ ๊ธฐ์ค€์„ ๋ช…ํ™•ํžˆ ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•˜์„ธ์š”.

ํ˜„์žฌ ๊ตฌํ˜„์€ SI ๋‹จ์œ„(1000 ๊ธฐ๋ฐ˜)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค:

  • 1 KB = 1,000 bytes
  • 1 MB = 1,000,000 bytes
  • 1 GB = 1,000,000,000 bytes

์ด๋Š” ๊ธฐ์ˆ ์ ์œผ๋กœ ์ •ํ™•ํ•˜์ง€๋งŒ, ๋งŽ์€ ์‚ฌ์šฉ์ž๋“ค์€ ์ด์ง„ ๋‹จ์œ„(1024 ๊ธฐ๋ฐ˜: KiB, MiB, GiB)์— ์ต์ˆ™ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, 2,000,000,000 ๋ฐ”์ดํŠธ๋Š”:

  • SI ๋‹จ์œ„: 2.00 GB
  • ์ด์ง„ ๋‹จ์œ„: 1.86 GiB

ํ˜„์žฌ ๊ตฌํ˜„์„ ์œ ์ง€ํ•  ๊ฒฝ์šฐ, ๋‹จ์œ„ ๋ ˆ์ด๋ธ”์„ "GB (decimal)" ๋˜๋Š” "GB"๋กœ ๋ช…์‹œํ•˜๊ฑฐ๋‚˜, ์ด์ง„ ๋‹จ์œ„๋กœ ์ „ํ™˜ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•˜์„ธ์š”.

๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@saas_web.py` at line 39, The byte-to-unit conversion in the oninput handler
for the target_bytes input (id="target_bytes", preview element
id="target_bytes_preview") currently uses 1000-based SI units; either explicitly
label the preview with "GB (decimal)"/"MB (decimal)" or change the conversion to
1024-based binary units (KiB/MiB/GiB) โ€” implement by updating the oninput logic
that computes preview.innerText to use either 1000 or 1024 multipliers and
corresponding unit strings, or add a small toggle control that switches a mode
variable between "decimal" and "binary" and branches the conversion accordingly
so the preview shows the chosen unit system (e.g., "1.86 GiB" vs "2.00 GB").
tests/test_saas_web.py (1)

28-37: โšก Quick win

ํ…Œ์ŠคํŠธ ์–ด์„ค์…˜์˜ ๊ฒฌ๊ณ ์„ฑ์„ ๊ฐœ์„ ํ•˜์„ธ์š”.

Line 37์˜ ์–ด์„ค์…˜์€ JavaScript ์ฝ”๋“œ์˜ ์ •ํ™•ํ•œ ๋ฌธ์ž์—ด์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:

self.assertIn("btn.setAttribute('aria-busy', 'true')", html)

์ด๋Š” ์ทจ์•ฝํ•ฉ๋‹ˆ๋‹ค:

  • ๊ณต๋ฐฑ ๋ณ€๊ฒฝ (์˜ˆ: setAttribute( 'aria-busy')
  • ๋”ฐ์˜ดํ‘œ ์Šคํƒ€์ผ ๋ณ€๊ฒฝ (์˜ˆ: "aria-busy" ๋Œ€์‹  'aria-busy')
  • ์ฝ”๋“œ ํฌ๋งทํ„ฐ ์ ์šฉ

์‹œ ํ…Œ์ŠคํŠธ๊ฐ€ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

๋” ๊ฒฌ๊ณ ํ•œ ๋Œ€์•ˆ:

  1. ์ •๊ทœ์‹ ์‚ฌ์šฉ: assertRegex(html, r"setAttribute\(['\"]aria-busy['\"],\s*['\"]true['\"]")
  2. ๋˜๋Š” ํ•ต์‹ฌ ๊ฐœ๋…๋งŒ ํ™•์ธ: assertIn('aria-busy', html) (์ถฉ๋ถ„ํ•  ์ˆ˜ ์žˆ์Œ)
โ™ป๏ธ ๋” ๊ฒฌ๊ณ ํ•œ ์–ด์„ค์…˜ ์ œ์•ˆ
         self.assertIn('aria-describedby="target_bytes_help target_bytes_preview"', html)
         self.assertIn('id="target_bytes_preview"', html)
         self.assertIn('aria-live="polite"', html)
         self.assertIn(">2.00 GB</span>", html)
-        self.assertIn("btn.setAttribute('aria-busy', 'true')", html)
+        # aria-busy ์†์„ฑ์ด ์„ค์ •๋˜๋Š”์ง€ ํ™•์ธ (์ •ํ™•ํ•œ JavaScript ๊ตฌ๋ฌธ์— ๋œ ์˜์กด)
+        self.assertIn('aria-busy', html)
+        self.assertIn('submit-btn', html)
๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_saas_web.py` around lines 28 - 37, Update the fragile assertion in
test_get_ui_includes_accessible_target_size_preview: instead of asserting the
exact JS substring "btn.setAttribute('aria-busy', 'true')", make the check
resilient to spacing and quote changes by using a regex like
setAttribute\(['"]aria-busy['"],\s*['"]true['"]\) with assertRegex, or simplify
to assertIn('aria-busy', html) if only presence is required; modify the
assertion referencing the test method and the JS occurrence (btn.setAttribute /
aria-busy) accordingly.
๐Ÿค– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@saas_web.py`:
- Line 39: Move the long inline oninput handler for the input with id
"target_bytes" into a separate <script> block: extract the logic into a named
function (e.g., updateTargetBytesPreview) that reads the element value, parses
it with parseInt, handles NaN/<=0, and formats bytes-to-B/KB/MB/GB into the
element with id "target_bytes_preview"; then remove the inline oninput attribute
and attach the function via addEventListener('input', updateTargetBytesPreview)
on the target_bytes element (also call it once on load to initialize the
preview). Ensure the function name and DOM ids ("target_bytes",
"target_bytes_preview") from the diff are used so the handler targets the
correct elements and keep validation (min/required) intact.
- Around line 45-54: Replace the setTimeout-based submit handler for the form
with a synchronous guard: in the 'shrink-form' submit event handler, immediately
get the 'submit-btn' and if it's already disabled, prevent the submission and
return; otherwise synchronously disable the button, set its innerText to
'Processing...' and aria-busy to 'true' before allowing the form to submit. This
removes the setTimeout race and ensures double submissions are blocked by
checking/disabling 'submit-btn' at the start of the handler.

---

Nitpick comments:
In `@saas_web.py`:
- Line 39: The byte-to-unit conversion in the oninput handler for the
target_bytes input (id="target_bytes", preview element
id="target_bytes_preview") currently uses 1000-based SI units; either explicitly
label the preview with "GB (decimal)"/"MB (decimal)" or change the conversion to
1024-based binary units (KiB/MiB/GiB) โ€” implement by updating the oninput logic
that computes preview.innerText to use either 1000 or 1024 multipliers and
corresponding unit strings, or add a small toggle control that switches a mode
variable between "decimal" and "binary" and branches the conversion accordingly
so the preview shows the chosen unit system (e.g., "1.86 GiB" vs "2.00 GB").

In `@tests/test_saas_web.py`:
- Around line 28-37: Update the fragile assertion in
test_get_ui_includes_accessible_target_size_preview: instead of asserting the
exact JS substring "btn.setAttribute('aria-busy', 'true')", make the check
resilient to spacing and quote changes by using a regex like
setAttribute\(['"]aria-busy['"],\s*['"]true['"]\) with assertRegex, or simplify
to assertIn('aria-busy', html) if only presence is required; modify the
assertion referencing the test method and the JS occurrence (btn.setAttribute /
aria-busy) accordingly.
๐Ÿช„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 972db1d2-dfe0-43d1-8cd9-f3631c3044c5

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 81b1f49 and 9265335.

๐Ÿ“’ Files selected for processing (3)
  • .jules/palette.md
  • saas_web.py
  • tests/test_saas_web.py

Comment thread saas_web.py
Comment thread saas_web.py
@seonghobae
seonghobae dismissed coderabbitai[bot]โ€™s stale review June 12, 2026 02:34

Addressed by commits 183c841 and 8e088a8; CodeRabbit threads are resolved on the current head.

@seonghobae
seonghobae enabled auto-merge June 12, 2026 02:35
@seonghobae

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
โœ… Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Adds a dynamic, ARIA-announced preview to the target bytes input in saas_web.py to prevent magnitude errors.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: checks passed, review threads are resolved, and the scheduled PR merge gate found no non-review blockers.

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