Skip to content

Comments

fix: allow whole number heights for custom devices (#1307)#1308

Open
ggfevans wants to merge 2 commits intomainfrom
fix/1307-custom-device-height
Open

fix: allow whole number heights for custom devices (#1307)#1308
ggfevans wants to merge 2 commits intomainfrom
fix/1307-custom-device-height

Conversation

@ggfevans
Copy link
Collaborator

@ggfevans ggfevans commented Feb 25, 2026

User description

Summary

  • The custom device height input had min=0.5 with no step attribute, causing the browser to only accept values in the sequence 0.5, 1.5, 2.5... (offset by the min value)
  • Added step="0.5" so both whole numbers (1, 2, 3) and half-U values (0.5, 1.5) are valid

Test plan

  • Open Add Device form, set height to 2, click Add — should succeed
  • Set height to 1.5 — should also succeed
  • Stepper arrows should increment/decrement by 0.5

Closes #1307


CodeAnt-AI Description

Allow entering whole-number and half-U device heights in Add Device form

What Changed

  • The device height input now accepts both whole numbers (1, 2, 3...) and half-U values (0.5, 1.5, 2.5...) in the Add Device form
  • The number input's stepper now increments and decrements by 0.5 so clicking arrows moves by half-units
  • Submitting a height like 2 or 1.5 now succeeds where whole numbers were previously rejected

Impact

✅ Accept whole and half-U heights
✅ Fewer failed add-device attempts
✅ Precise stepper increments by 0.5

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The number input for device height had min=0.5 but no step attribute,
causing the browser to only accept values in the sequence 0.5, 1.5, 2.5...
Adding step="0.5" allows both whole numbers and half-U values.

Fixes #1307

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 25, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Feb 25, 2026
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 25, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Type Mismatch
    The bound height value coming from the may be a string at runtime. The component validates and compares height against numeric constants (MIN_DEVICE_HEIGHT, MAX_DEVICE_HEIGHT) and passes it to onadd — if height remains a string this can produce subtle bugs (incorrect comparisons, wrong payload types downstream). Ensure height is coerced to a numeric value before validation and before calling onadd.

@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 25, 2026

CodeAnt AI finished reviewing your PR.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77cfe82 and dbc5136.

📒 Files selected for processing (1)
  • src/lib/components/AddDeviceForm.svelte

📝 Walkthrough

Walkthrough

A step attribute of 0.5 is added to the height input field in the AddDeviceForm component, allowing fractional height values in increments of 0.5 while preserving existing validation boundaries.

Changes

Cohort / File(s) Summary
Height Input Enhancement
src/lib/components/AddDeviceForm.svelte
Added step="0.5" attribute to the height input element to enable fractional height values in 0.5 increments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A single step, oh what a delight,
Half-unit hops make heights so right,
From form to field, precision flows,
Where fractional rabbits' numbers grow! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: allow whole number heights for custom devices' directly and clearly summarizes the main change—enabling whole number support for device heights alongside the existing half-unit values.
Description check ✅ Passed The description clearly relates to the changeset, explaining the bug (missing step attribute), the fix applied, and the expected behavior with a detailed test plan.
Linked Issues check ✅ Passed The pull request fully addresses issue #1307 by adding step='0.5' to allow both whole numbers (1, 2, 3) and half-U values (0.5, 1.5) to be saved as custom device heights.
Out of Scope Changes check ✅ Passed The change is narrowly focused—only a single step attribute addition to the height input field with no other logic or validation changes, which is directly in scope of fixing the reported issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/1307-custom-device-height

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to save custom device height as whole number.

1 participant