Skip to content

feat(manager): auto-compact player numbers after a pad stays off#8

Merged
NicolasPogorzelski merged 1 commit into
mainfrom
feat/player-renumber-compaction
Jul 15, 2026
Merged

feat(manager): auto-compact player numbers after a pad stays off#8
NicolasPogorzelski merged 1 commit into
mainfrom
feat/player-renumber-compaction

Conversation

@NicolasPogorzelski

Copy link
Copy Markdown
Owner

Stacked on #fix branch fix/monitor-poll-crash; GitHub retargets this to main once that merges.

What

When a pad is switched off long enough to be dropped, its number left a permanent hole in the player numbering (e.g. 1, 3, 4) — remaining pads kept their numbers on both the tray labels and the white player LEDs, and nothing ever closed the gap.

This compacts the connected pads to a contiguous 1..N, order-preserving so no two continuously-connected pads swap places and nobody overtakes anybody:

  • Automatically once a hole has stood for COMPACT_GRACE (5 min). The window is sized for a battery/accu swap: a pad that returns within it reclaims its old number and no renumber happens; only a pad that stays off past it gives up its slot.
  • Manually and immediately via a new tray entry, "Renumber players", shown only while a hole exists.

The absent pad's stale _players reservation is left untouched — a later return finds its old number worn by a lower-numbered peer and takes the next free one, so a reclaim never reopens a closed hole.

Design

Timer lives in the existing 2 s monitor (_poll) via a _compact_due deadline — no new thread, no GLib timer, no GUI toolkit. Discussed and chosen with the maintainer: order-preserving compaction, 5-minute grace, timer + manual tray entry.

Tests & docs

  • tests/test_multi_pad.py: auto-compaction after the timer, battery-swap reclaim within the window (no renumber), manual renumber order-preserving, and the tray entry appearing/routing only on a gap.
  • Updated docs/decisions/player-leds.md and runbooks/verify-multi-controller.md.

Verified live: manual renumber via the tray works; player LEDs and tray follow.

@NicolasPogorzelski
NicolasPogorzelski changed the base branch from fix/monitor-poll-crash to main July 15, 2026 07:22
A pad switched off past the removal grace left a permanent hole in the
player numbering (e.g. 1, 3, 4) — remaining pads kept their numbers on
both the tray labels and the white player LEDs, and nothing ever closed
the gap.

Compact the connected pads to a contiguous 1..N, order-preserving so no
two continuously-connected pads swap places, once a hole has stood for
COMPACT_GRACE (5 min). The window is sized for a battery/accu swap: a pad
that returns within it reclaims its old number and no renumber happens;
only a pad that stays off past it gives up its slot. The absent pad's
stale _players reservation is left untouched — a later return finds its
old number worn by a lower-numbered peer and takes the next free one, so
a reclaim never reopens a closed hole.

A tray entry, "Renumber players", forces the compaction immediately and
is shown only while a hole exists.
@NicolasPogorzelski
NicolasPogorzelski force-pushed the feat/player-renumber-compaction branch from dae1b08 to 9342b81 Compare July 15, 2026 07:22
@NicolasPogorzelski
NicolasPogorzelski merged commit 74792fd into main Jul 15, 2026
2 checks passed
@NicolasPogorzelski
NicolasPogorzelski deleted the feat/player-renumber-compaction branch July 15, 2026 07:22
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