medre-adapter-meshcore
Meshcore provider for MEDRE. This separately installed distribution owns its transport SDK, configuration, native codec and offline fake. MEDRE core owns routing, storage, lifecycle and delivery evidence.
Install
Use uv to install MEDRE and this provider in the same persistent tool environment:
uv tool install medre
medre adapters install meshcore
medre adapters
On Windows, the package-changing command prints a uv command to run after
medre.exe exits, rather than replacing an executable still in use.
Core 0.1.1 and later use package-index defaults for new adapter requests.
Existing saved Git requests and catalogs are preserved; Git is needed when
using those sources. For reproducible deployments, pin released versions in
a locked project or select exact Git revisions. Use the MEDRE Getting Started guide
for fake smoke, guided route creation and native setup. Use the
adapter-source guide
for a locked uv deployment project, private Git, local checkouts, index sources,
and the same-environment requirement. Neither MEDRE nor the provider installs
packages during runtime startup.
Packaging and provenance
This distribution registers the medre.adapters entry point and retains the
import namespace medre.adapters.meshcore. Its original adapter source history
was extracted from MEDRE commit e59c29dd31a95860d1cdbc19e531896616627a68;
Git author and committer identities remain preserved. Runtime configuration and
adapter discovery do not depend on this repository's distribution name.
Ownership and imports
This distribution owns MeshCore's transport implementation, configuration models, runtime wrapper, fake adapter, native addressing behavior, SDK requirements, and protocol/SDK tests. MEDRE core owns generic events, routing, lifecycle, storage, evidence, configuration orchestration, and installed-package discovery.
| Surface | Adapter-owned import |
|---|---|
| Config models | medre.config.adapters.meshcore |
| Runtime wrapper | medre.config.adapters.meshcore_runtime.MeshCoreRuntimeConfig |
| SDK-free fake | medre.adapters.fakes.meshcore.FakeMeshCoreAdapter |
Import the runtime wrapper from this distribution directly. Core has no named
wrapper compatibility bridge or transport SDK extras. The supported MEDRE
interface range and native SDK pins are declared in this project's
pyproject.toml. Use a compatible released core, or the exact qualified
core revision for development and native qualification.
Community adapter authors can use their own distribution names, import packages,
and hosting sources with the same medre.adapters entry-point contract.
MEDRE-authored adapter source is MIT-licensed. This grant does not relicense installed dependencies. Their license terms still apply to any combined deployment or redistribution. See dependency license notes.
Offline samples and diagnostics
This distribution contributes native fake values and an opaque conversation
address to medre config sample. Core includes only installed contributors;
a single contributor gets two fake instances for offline routing. Native
packet simulation methods remain adapter-specific. Run-session canonical
callback injection uses AdapterContract.publish_inbound(event).
medre adapters check --config bridge.yaml distinguishes missing distributions
from broken/conflicting entry points. Basic CLI help and unrelated healthy
providers remain available when another provider fails discovery.
MeshCore group messages have a 160-byte firmware text limit including the
firmware's <device name>: prefix. MEDRE reserves that space, uses a conservative
127-byte budget before the device name is known, and refreshes the effective
budget from the live handshake. max_text_bytes (default 160) is an operator
upper bound. Rendering truncates safely at UTF-8 boundaries and records that
fact; native sends that bypass this budget fail permanently before SDK I/O.
All core-rendered native messages use the durable packet grant, including short and clipped single packets. A timeout, disconnect or cancellation after submission retains uncertainty and does not trigger an internal resend. Empty native wire text is rejected before dispatch. Direct session calls keep their legacy retry policy and do not provide this guarantee. See guarded native text.
Replies and threads relay as inline fallback text. They do not emit native
reply/thread operations. Delivery evidence identifies fallback_text;
reactions, edits, and deletes remain unsupported and are suppressed.
Fake adapters expose the same planning capabilities as their health reports.
Tests
Protocol and SDK contract tests live in this repository with adapter-owned helpers. Cross-adapter routing and lifecycle tests remain in MEDRE. Run the tests through the locked uv core environment described in contributing. That workflow supports arbitrary core and provider checkouts, including forks, without a separate manually configured virtual environment. Select SDK, service, hardware, local integration and soak tiers explicitly. Re-run the SDK-free sync before claiming an SDK-free proof.
Deterministic local endpoint integration is also owned here. After installing the SDK tier, select it explicitly:
uv run --project "${MEDRE_CORE:?Set MEDRE_CORE to the core checkout}" --no-sync medre dev test --project "${MEDRE_CORE}" --editable meshcore=. meshcore -- -v -m "local_integration and not soak and not live and not hardware and not docker"
Soak remains opt-in and is separate from deterministic local integration.
Fake smoke sources
The fake provides a synchronous make_event(text=..., event_kind=...) returning
a canonical event with its own adapter instance ID. After installing all
providers referenced by a fake bridge config, exercise a source with:
medre smoke --config bridge.yaml --source-adapter ADAPTER_ID --json
Use the configured instance ID, which may differ from the transport name. Each
normal smoke tests one source; inspect source_candidates and
coverage_scope: single_source in its report. Eligible sources must have started
and provide the helper. A pass requires delivery for every matched configured
route target, including targets unavailable after construction or startup.
Factory errors fail the smoke and trigger runtime cleanup. The result proves
fake direct-pipeline behavior; native callbacks and recipient delivery have
separate qualification tiers.
Coordinated CI
The repository CI installs MEDRE core and this adapter. Its fake job omits
native SDK dependencies; its SDK job installs this distribution's declared pins.
CI resolves MEDRE main once per run by default. Keep the repository Actions variable
MEDRE_CORE_REF unset so pull-request checks retain that baseline. Qualify a
candidate pair with a one-run dispatch and a full core commit SHA:
gh workflow run test.yml --ref ADAPTER_BRANCH -f core_ref=FULL_CORE_COMMIT_SHA
Record both revisions with the result. The candidate run does not replace the
adapter PR's checks against core main. Follow the
coordinated-change policy
for dependency order and merged compatibility pins.
Core's compatibility matrix tests each selected adapter at the exact commit recorded in its manifest, along with cross-adapter behavior. In a coordinated checkout containing the selected sibling repos, run from MEDRE:
python scripts/ci/adapter_matrix.py --check-local
# Once all adapter changes are committed:
python scripts/ci/adapter_matrix.py --sync-local
The helper validates clean sibling checkouts and their entry points, and compares
Python distribution names using normalized case/separator spelling. Synchronizing
updates the manifest atomically without fetching or installing packages. Review
the manifest diff, merge adapter commits into their default branches first, then publish
the core pin update and run python scripts/ci/adapter_matrix.py --check-merged. A failed write preserves the original manifest and cleans up the temporary
file. Deployment projects should separately lock their chosen complete
package graph.
Standalone CI records the exact core and adapter SHAs tested against its configured core baseline. MEDRE core CI qualifies the pinned compatibility pair; a standalone green result does not qualify another core revision. SDK qualification extras come from the selected core compatibility manifest, while SDK versions remain authoritative in this adapter's package metadata.
Provider contract and quality
The registration reference
documents every hook, its loading phase, and the minimal fake constructor/event
calls. Shared native-metadata helpers are public under medre.adapters.metadata.
Conformance tests use medre.testing; SDK pin checks read this distribution's
installed metadata while this repository chooses its SDK qualification extras.
The fake constructor and explicit-keyword event factory are checked in the
SDK-free tier. Native schemas and validated examples live in docs/schemas here.
Python policy is declared in pyproject.toml. Local work and CI use the same
committed Trunk launcher and pinned tools for all-file checks, alongside the
fake/native qualification tiers.
The native adapter package includes its own py.typed marker.
Offline startup and recovery
A long-lived MEDRE adapter returns from initial setup in degraded health when its configured radio is unavailable. Each complete native connection attempt has a 15-second TCP/serial budget or a 45-second BLE budget (including BlueZ cleanup and discovery). One session-owned recovery loop then retries with exponential backoff and jitter, capped at 30 seconds between attempts, until the radio connects or the adapter stops. The SDK's own auto-reconnect stays disabled. Initial unavailability and later disconnects use the same serialized setup path. Missing SDKs and invalid configuration still fail explicitly.
A disconnected started session reports transient send failure before any native handoff. MEDRE owns delivery retries and their configured limits; connection recovery does not guarantee unlimited message retention or native delivery. Stopping the adapter cancels recovery before native teardown. Session stop clears the inbound callback before its first await, so inbound delivery ends when stop begins, even if the stop is cancelled mid-teardown. Native cancellation still depends on the pinned SDK and driver cooperating; this is not a process isolation boundary.
Direct one-shot MeshCoreSession.start() callers retain strict connection
failure by default; the production adapter explicitly requests degraded startup
with recover_on_failure=True.
Connect-time device-buffer drain
The pinned SDK's start_auto_message_fetching() issues one get_msg() while
MeshCoreSession.start() is still awaiting inside MeshCoreAdapter.start(),
so a frame buffered on the device reaches the adapter callback before the
adapter has marked itself started. Because GET_NEXT_MSG pops the frame from
the device queue, dropping it would lose the message unless the mesh
re-delivered it. While start() is in flight, inbound payloads are held in a
bounded FIFO (64 items) and flushed through the normal inbound path —
classification, dedup, and bounded callback admission — in arrival order once
startup completes. A full buffer drops with a cumulative counter and a
rate-limited, content-free warning. stop() and failed or cancelled starts
discard the buffer and never replay it into a later session; callbacks outside
the start window (never started, post-stop) keep the pre-existing silent drop.
The simulation helper requires a context and raises RuntimeError when none
exists. Buffered mappings are snapshotted, and callbacks from retired sessions
cannot enter a replacement lifetime. A second concurrent start is rejected, and
so is a start while an earlier start's session is still installed, such as the
partial session a cancelled start retains for rollback: stop() retires it
first, including the bounded BlueZ stale-link release for BLE.
Diagnostics expose prestart_buffered, prestart_flushed, and
prestart_overflow_dropped, reset at each start boundary. The contract is
specified in docs/spec/prestart-inbound-buffer.md.
Development tooling
See contributing for the shared Trunk quality gate and uv-based editable development workflow.
Metadata
Release files for medre-adapter-meshcore 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| medre_adapter_meshcore-0.2.0.tar.gz | 227.6 kB | With provenance | Details for medre_adapter_meshcore-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| medre_adapter_meshcore-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for medre_adapter_meshcore-0.2.0-py3-none-any.whl |
Total release size: 305.2 kB
Release files / medre_adapter_meshcore-0.2.0.tar.gz
| Download URL | medre_adapter_meshcore-0.2.0.tar.gz |
|---|---|
| Size | 227.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95b24d8d49a444370e98e749746a9c1bb38c6acc23d3668ce6c479341c92227e
|
|
BLAKE2b-256 checksum How to use checksums |
1bd5c8a5a3738494aa961f360077b5927875d0982adce14f1b082fa579c25ef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / medre_adapter_meshcore-0.2.0-py3-none-any.whl
| Download URL | medre_adapter_meshcore-0.2.0-py3-none-any.whl |
|---|---|
| Size | 77.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ba40c7fc96d3aef9d5151bef570eebb6ea2fbc3f20f101c98701ab7d9eddd3b
|
|
BLAKE2b-256 checksum How to use checksums |
4f2a376d28f8f97cb42de5d4df1b43b231220da6193f47a41e4770acece85f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for medre-adapter-meshcore 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for medre_adapter_meshcore-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.