Skip to content

M2 (#38): wire the controller proxy — seamless reconnect build #142

Description

@aradanmn

Turns the reconnect design (docs/DESIGN-38-RECONNECT-WIRING.md, decisions locked) into a buildable sequence. Lights up the DARK controller_proxy module so a dropped wireless pad re-attaches to its running instance.

Why this is the right approach (settled this session)

Build sequence (each PR gated; raw-binding never regresses)

PR-a — slot_manager.sh (behavior-neutral, flag off)

  • New module: slot record schema (phys_uniq/vendor/product/event_node, disconnected, disconnected_at)
  • GET: slot_by_uniq, slot_by_event_node, free_slot, most_recent_abandoned_within, slot_is_active/disconnected
  • SET: slot_claimSPAWN|RESUME|ADOPT|REJECT (full policy, but only SPAWN reachable while flag off)
  • RELEASE: slot_release (CONTROLLER_REMOVE → mark abandoned+ts), slot_free (SLOT_DIED)
  • Consolidate the scattered helpers (_find_free_slot, update_slot_state, slot_is_active, _find_slot_by_event_node)
  • Unit-test decision matrix (design §12) — hardware-free
  • Register in CI baseline
  • Gate: CI green; existing behavior identical (flag off)

PR-b — proxy launch wiring (behind MCSS_PROXY_ENABLE, default off)

  • On SPAWN + flag on: proxy_start_slot → bind the virt node into bwrap instead of the raw js
  • Record identity fields via slot_reserve
  • js-owner re-verify (design §7 belt-and-suspenders)
  • Gate: flag-off raw binding unchanged; flag-on launches + binds virt (on-Deck smoke)

PR-c — reconnect policy live

  • CONTROLLER_ADDslot_claim → execute outcome
  • RESUME = proxy_repoint_slot; ADOPT = proxy_restart (device-id changes); grace 180s
  • REJECT = log only
  • Gate: handler unit tests; on-Deck single-pad drop→reconnect rejoins same slot (flag on)

PR-d — watchdog supervision + on-Deck verify → flip default

Tracking

Design: docs/DESIGN-38-RECONNECT-WIRING.md · Blocks/absorbs: #112 · Milestone headline: #38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions