Skip to content

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

Closed

Description

@CameronBrooks11

Problem

The host has no per-connection dialect profile. host.capabilities()
(marlin_host/host.py:220-230) already parses the M115 banner + Cap:KEY:1/0
block into Capabilities(firmware, caps) (host.py:76-86) — that is the
negotiated half of a dialect descriptor, but it sits as a standalone return
value with no relationship to the behavior knobs the host (and the mock) need.

Prior art (OctoPrint/printrun/Cura — see design doc Lane C): mature hosts
negotiate behavior from the M115 Cap: report, not from version-sniffing the
banner.
The pattern is: ship a declared default profile = the upper bound of
what the pinned Marlin SHA's M115.cpp can advertise → intersect with what the
connected board actually reports at connect → negotiated wins. Banner is for
identity/logging + a thin safety deny-list only, never protocol routing.

Proposed approach

At connect: build the declared default profile from the pinned SHA's cap set; run
capabilities(); intersect (negotiated wins; a cap absent from the report ⇒
absent — note M115 is doubly compile-gated by CAPABILITIES_REPORT /
EXTENDED_CAPABILITIES_REPORT, and MINIMAL_CAP_LINES can make the report
sparse, so the safe direction is "absent ⇒ off"). Infer advanced_ok from the
first observed ok line (protocol.py:89-95). Provide a user-override hook
(declared beats inference). Surface EMERGENCY_PARSER-absent so emergency_stop
(host.py:264-267) isn't advertised as truly immediate (it blocks behind buffered
moves without the emergency parser).

Do the Capabilities → Profile merge here, lazily, so the rename lands in the
same reviewable change as its first real caller — not as a standalone refactor.

Acceptance criteria

  • After connect the host exposes a resolved profile reflecting negotiated caps over
    the declared baseline.
  • advanced_ok inferred from the first ok, user-overridable.
  • With EMERGENCY_PARSER absent, the caller can observe M112 may block.
  • Banner used for identity/logging only — never to route protocol.
  • just check && just test green; existing capabilities() callers/tests pass.

Evidence

marlin_host/host.py:76-86,133-177,220-230,264-267,
_reference/Marlin/Marlin/src/gcode/host/M115.cpp, gcode/gcode.cpp:684-685.
Design: working/dialect-and-mock-investigation.md (Next). Depends on #11.

Part of #5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions