Skip to content

Fix watched-range validation, lift the 1,000-port cap, show scan progress - #12

Merged
sallaumen merged 1 commit into
mainfrom
claude/range-limits-2ff464
Nov 6, 2026
Merged

sallaumen merged 1 commit into
mainfrom
claude/range-limits-2ff464

Conversation

@sallaumen

Copy link
Copy Markdown
Owner

Summary

  • Validation bug. The range fields were type=number. WebKit treats values such as 4.000, 4e3 and 4000.0 as valid numbers and submits them, but the server only accepted plain digits, so a range that looked valid failed with "Choose a valid range of up to 1,000 ports". I reproduced this in WebKit (4000.0 → error). The fields are now type=text inputmode=numeric. The server accepts plain digits or grouped thousands (4.000, 4,000, 4 000) and returns specific errors (:invalid_range_bound, :reversed_range) with matching copy. The fields keep the submitted values after an error and set aria-invalid/aria-describedby.
  • No 1,000-port cap. Removed it from Settings, config/runtime.exs, the settings copy and the README. Bounds stay 1–65535 with start ≤ end. Scanner keeps 16 concurrent probes with a 3.5 s kill timeout each, and now runs unordered. A local scan of 1–65535 took about 13 s. Monitor still schedules the next scan only after the current one finishes and ignores :scan/refresh while a scan runs. A new test covers this.
  • Scan progress. Scanner.scan/3 takes on_progress: and reports cumulative checked ports about 100 times per scan, always ending at the range size. Monitor broadcasts {:scan_progress, %{checked, total, scanning}} (stale scans are ignored) and adds progress to snapshots. The dashboard shows "Current scan / Last scan · Scanned 1,240 / 61,535" with a native <progress> (aria-valuetext) at the top. The new component is in ScanProgress, and the CSS is appended at the end of app.css to limit conflicts with the parallel UI work.

Verification

  • TDD: tests for Settings, Scanner, Monitor and DashboardLive were written first and failed before the fix.
  • mix test (53 tests, 0 failures), mix format --check-formatted, mix compile --warnings-as-errors.
  • Playwright WebKit against PORT=4102 mix phx.server with an isolated config and range 1–65535: progress counts up live (5,895 / 65,534 → 11,135 / 65,534 …). Checked desktop 1440 px and 375 px in light and dark, with no horizontal overflow. Error and success states were exercised in Settings. The only console entries were the dev live-reload server log (TLS probe notices), with no page errors.

Notes

  • The dashboard port field has the same type=number mismatch. It is not changed here.
  • A 1-65535 range also probes privileged and ephemeral ports. Each scan is about 65k loopback connects.

🤖 Generated with Claude Code

- Watched-range inputs are now text fields with numeric input mode.
  WebKit's type=number accepted values such as 4.000, 4e3 and 4000.0
  that the server then rejected, so a range that looked valid failed
  with "Choose a valid range of up to 1,000 ports". The server accepts
  plain digits or grouped thousands and reports specific errors
  (:invalid_range_bound, :reversed_range); submitted values stay in
  the fields after an error.
- Remove the 1,000-port limit from Settings and config/runtime.exs.
  Bounds stay 1..65535 with start <= end. The scanner keeps 16
  concurrent probes with a 3.5 s timeout each (full port space scans
  in about 13 s locally), and Monitor still schedules the next scan
  only after the current one finishes.
- Scanner reports cumulative checked ports about 100 times per scan.
  Monitor broadcasts {:scan_progress, %{checked, total, scanning}} and
  includes it in snapshots. The dashboard shows "Scanned X / Y" with a
  native <progress> element at the top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sallaumen
sallaumen merged commit 062d983 into main Nov 6, 2026
4 checks passed
sallaumen added a commit that referenced this pull request Nov 6, 2026
The scan progress total from #12 skips the dashboard's own port, so the
range caption now reports the same number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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