Repository navigation
feat(host): resolve a dialect Profile at connect via M115 negotiation - #17
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #12 (the first producer of the
Profileseam fromworking/dialect-and-mock-investigation.md).What
Capabilities→Profile— one concrete build's host-facingbehavior:
firmware+ negotiatedcaps, plus the dialect variants Marlin doesnot report as caps (
advanced_ok,emits_wait_when_idle) andemergency_stop_immediate.Capabilitiesstays as a backwards-compatible alias.connect(*, negotiate=True, advanced_ok=None, emits_wait_when_idle=False)nowresolves a
Profileafter establishing readiness: query M115, parse firmware +caps, and infer
advanced_okfrom the terminalok's distinctivePfield(
queue.cppok_to_sendunderADVANCED_OK). Result is read athost.profile.more correct than the old
query()path, which framed it underreliable=True.profile rather than failing a connection whose readiness is already proven.
Profile.emergency_stop_immediate(and anemergency_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 usesstartup_timeout(2s) instead of
idle_timeout(10s) and is tolerant of a silent board (emptyprofile) rather than raising
HostError. Theself._haltedguard is preserved.Review
Adversarial review → APPROVE (no blockers/majors), grounded in source:
Pisalways present under ADVANCED_OK and never otherwise on the M115
okpath(collision-free); a bare line never bumps Marlin's
last_N(reliable-safe); haltmid-M115 leaves
_connected=False/_halted=Trueconsistently. Applied its minors:re-connect resets
_connected,capabilities()halt-guard kept, added theadvanced_ok=False-override and sparse-report tests.just check && just testgreen (99 tests, 3.11–3.13). Closes #12.