Skip to content

feat(host): resolve a dialect Profile at connect via M115 negotiation - #17

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/connect-profile-negotiation
Jun 26, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/connect-profile-negotiation

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Implements #12 (the first producer of the Profile seam from
working/dialect-and-mock-investigation.md).

What

  • Generalizes Capabilities → Profile — one concrete build's host-facing
    behavior: firmware + negotiated caps, plus the dialect variants Marlin does
    not report as caps (advanced_ok, emits_wait_when_idle) and
    emergency_stop_immediate. Capabilities stays as a backwards-compatible alias.
  • connect(*, negotiate=True, advanced_ok=None, emits_wait_when_idle=False) now
    resolves a Profile after establishing readiness: query M115, parse firmware +
    caps, and infer advanced_ok from the terminal ok's distinctive P field
    (queue.cpp ok_to_send under ADVANCED_OK). Result is read at host.profile.
  • M115 is sent bare, so it never consumes a reliable line number — strictly
    more correct than the old query() path, which framed it under reliable=True.
  • Negotiation is tolerant: a board that doesn't answer M115 yields an empty
    profile rather than failing a connection whose readiness is already proven.
  • Profile.emergency_stop_immediate (and an emergency_stop() docstring note)
    surface that M112 only acts mid-move on a build with EMERGENCY_PARSER.

Minimal-first

"Declared baseline ∩ negotiated" reduces to negotiated caps, absent ⇒ off — a
per-version cap enumeration has no consumer yet. #13 adds the literal fields +
dialect matrix test that first consume the seam for real (and emits_wait_when_idle,
which is declared-only here by design).

Note (observable contract change)

capabilities() now reuses the shared bare-M115 helper: it uses startup_timeout
(2s) instead of idle_timeout (10s) and is tolerant of a silent board (empty
profile) rather than raising HostError. The self._halted guard is preserved.

Review

Adversarial review → APPROVE (no blockers/majors), grounded in source: P is
always present under ADVANCED_OK and never otherwise on the M115 ok path
(collision-free); a bare line never bumps Marlin's last_N (reliable-safe); halt
mid-M115 leaves _connected=False/_halted=True consistently. Applied its minors:
re-connect resets _connected, capabilities() halt-guard kept, added the
advanced_ok=False-override and sparse-report tests.

just check && just test green (99 tests, 3.11–3.13). Closes #12.

Generalize Capabilities into Profile — one concrete build's host-facing
behavior: firmware + negotiated caps, plus the dialect variants Marlin does
not report as caps (advanced_ok, emits_wait_when_idle). Capabilities stays as
a backwards-compatible alias.

connect() now resolves a Profile after establishing readiness: query M115
(bare, so it never consumes a reliable line number), parse firmware + caps,
and infer advanced_ok from the terminal ok's distinctive `P` field. Caller
overrides (advanced_ok, emits_wait_when_idle) and negotiate=False are exposed
as keyword args; the resolved profile is read at host.profile. Negotiation is
tolerant — a board that does not answer M115 yields an empty profile rather
than failing a connection whose readiness is already proven.

Profile.emergency_stop_immediate surfaces EMERGENCY_PARSER so callers know an
M112 only acts mid-move on a build that has the emergency parser.

minimal: "declared baseline ∩ negotiated" reduces to "negotiated caps, absent
⇒ off" — a per-version cap enumeration has no consumer yet (#13 adds the
literal fields + dialect matrix test that first consume the seam for real).

Closes #12.
@CameronBrooks11
CameronBrooks11 merged commit 4544f1d into main Jun 26, 2026
5 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/connect-profile-negotiation branch June 26, 2026 17:56
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.

feat(host): connect-time Profile assembly — declared baseline ∩ negotiated caps

1 participant