Make sorting view-only and keep Default Entries first #11

Closed
opened 2026-09-03 10:18:50 +00:00 by phg · 0 comments
Owner

Context

The TUI sort handlers call list.sort directly on hosts_file.entries. Sorting is available in Read-only Mode, but a later save or auto-saved mutation can serialize that in-memory order to /etc/hosts. The TUI path also bypasses the model sorting methods that keep Default Entries first.

Sorting is intended only to change the displayed order. Persistent reordering already has explicit move commands.

Acceptance criteria

  • Sorting by IP address or Canonical Hostname does not mutate the underlying Hosts File order.
  • Default Entries remain first in the displayed order for both ascending and descending sorts.
  • Sorting in Read-only Mode, then entering Privileged Mode and performing a mutation, does not change file order.
  • Tests cover display order separately from serialized order without touching the real /etc/hosts.
  • The temporary sorting warning is removed from user documentation once fixed.
Context The TUI sort handlers call `list.sort` directly on `hosts_file.entries`. Sorting is available in Read-only Mode, but a later save or auto-saved mutation can serialize that in-memory order to `/etc/hosts`. The TUI path also bypasses the model sorting methods that keep Default Entries first. Sorting is intended only to change the displayed order. Persistent reordering already has explicit move commands. Acceptance criteria - Sorting by IP address or Canonical Hostname does not mutate the underlying Hosts File order. - Default Entries remain first in the displayed order for both ascending and descending sorts. - Sorting in Read-only Mode, then entering Privileged Mode and performing a mutation, does not change file order. - Tests cover display order separately from serialized order without touching the real `/etc/hosts`. - The temporary sorting warning is removed from user documentation once fixed.
phg added the
Priority
High
Kind/Bug
labels 2026-09-03 10:18:50 +00:00
phg referenced this issue from a commit 2026-09-04 06:51:11 +00:00
phg closed this issue 2026-09-04 06:51:29 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: phg/hosts#11
No description provided.