mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-27 13:52:18 +00:00
Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a0abec3b4 | ||
|
|
534abbb95b | ||
|
|
86d5e10230 | ||
|
|
09948bf81c | ||
|
|
7a851cc204 | ||
|
|
85e725a064 | ||
|
|
0a34047342 | ||
|
|
bb628ba8ef | ||
|
|
fd69ab4fbc | ||
|
|
8db95825c5 | ||
|
|
7cf129f76c | ||
|
|
d7da7f34aa | ||
|
|
e609864d88 | ||
|
|
e210e0c244 | ||
|
|
fc1c99d3ff | ||
|
|
e49a8b3d88 | ||
|
|
2ab8fdf22b | ||
|
|
eac0feaced | ||
|
|
a446ee21b6 | ||
|
|
b2aab6940d |
No files matched your search
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RSLXMF_RSRETICULUM_COMMIT: dc6bc4ee82daf66b3b40386f9777dbe62b08fec2
|
||||
RSLXMF_RSRETICULUM_COMMIT: 49aa33db1bbe8c7d93b12c4e8fa378ba5060376e
|
||||
|
||||
jobs:
|
||||
api-compat:
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
run: python3 tools/check-api-compatibility.py
|
||||
working-directory: rsLXMF
|
||||
- name: Check canonical and legacy external consumer
|
||||
run: cargo check --manifest-path api-fixtures/Cargo.toml --locked
|
||||
run: cargo check --manifest-path api/fixtures/Cargo.toml --locked
|
||||
working-directory: rsLXMF
|
||||
|
||||
test:
|
||||
|
||||
@@ -17,8 +17,8 @@ env:
|
||||
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
|
||||
PACKAGE_ROOT: rsLXMF
|
||||
LXMF_BINS: lxmd-rs
|
||||
RSLXMF_RSRETICULUM_VERSION: 1.2.0
|
||||
RSLXMF_RSRETICULUM_COMMIT: dc6bc4ee82daf66b3b40386f9777dbe62b08fec2
|
||||
RSLXMF_RSRETICULUM_VERSION: 1.3.0
|
||||
RSLXMF_RSRETICULUM_COMMIT: 49aa33db1bbe8c7d93b12c4e8fa378ba5060376e
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
cp "target/release/${bin}" "dist/${PACKAGE_ROOT}/bin/${bin}"
|
||||
fi
|
||||
done
|
||||
cp README.md LICENSE CHANGELOG.md RELEASING.md "dist/${PACKAGE_ROOT}/"
|
||||
cp README.md LICENSE CHANGELOG.md "dist/${PACKAGE_ROOT}/"
|
||||
- name: Create tar archive
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
/target/
|
||||
/api-fixtures/target/
|
||||
/api/fixtures/target/
|
||||
*.swp
|
||||
.DS_Store
|
||||
__pycache__/
|
||||
*.pyc
|
||||
proptest-regressions/
|
||||
@@ -1,56 +0,0 @@
|
||||
# API stability
|
||||
|
||||
rsLXMF is currently source-distributed with `publish = false`. The current
|
||||
Rust module tree is useful to source consumers, but only part of it is an
|
||||
intentional long-term library boundary.
|
||||
|
||||
`api-stability.json` classifies every library package and pins the exact
|
||||
pre-boundary commit. `api-baseline/*.txt` contains the complete explicit public
|
||||
surface observed by pinned `cargo-public-api` and rustdoc versions. CI rejects
|
||||
unreviewed drift. These snapshots are compatibility evidence, not a promise
|
||||
that every listed state-machine field or helper will remain public forever.
|
||||
|
||||
`lxmf-core` is **candidate stable** as a package. Its message, presentation,
|
||||
ticket, routing, propagation, sync, and public delivery concepts are intended
|
||||
consumer capabilities. Its current modules also expose handler plumbing,
|
||||
persistence representations, admission machinery, Link-delivery state, and
|
||||
other orchestration details that remain provisional until the API-boundary
|
||||
checkpoint. `lxmf-tools` is **tool internal** and exists to support `lxmd-rs`;
|
||||
it is not a library compatibility commitment.
|
||||
|
||||
[`lxmf_core::message_api`](MESSAGE_API.md) is the canonical candidate message
|
||||
path. It re-exports existing identities without adaptation, and the original
|
||||
module paths remain supported. Router, delivery, propagation, handler, and
|
||||
persistence ownership are not promoted by this narrow facade.
|
||||
|
||||
No visibility, signature, serialization, wire, persistence, or runtime change
|
||||
is made by establishing this baseline. Any later boundary reduction must first
|
||||
show the public API diff, migrate Ratspeak and other first-party users, preserve
|
||||
the supported facade, and make an explicit version/changelog decision.
|
||||
|
||||
The canonical snapshot uses all features on `aarch64-apple-darwin` and omits
|
||||
auto-derived, auto-trait, and blanket implementations. Other target overlays
|
||||
remain covered by existing build and interop gates rather than this first
|
||||
host API snapshot.
|
||||
|
||||
```sh
|
||||
cargo install cargo-public-api --version 0.52.0 --locked
|
||||
rustup toolchain install nightly-2026-08-01 --profile minimal
|
||||
python3 tools/check-api-baseline.py
|
||||
python3 tools/check-api-manifest.py
|
||||
python3 tools/check-api-compatibility.py
|
||||
cargo check --manifest-path api-fixtures/Cargo.toml --locked
|
||||
```
|
||||
|
||||
The immutable floor and current captured snapshot source are separate
|
||||
identities in `api-stability.json`. A capture names its clean basis commit and
|
||||
reviewed change record; CI renders the current tree and requires a byte-exact
|
||||
snapshot, avoiding an impossible self-referential commit identifier. The
|
||||
manifest contract covers features,
|
||||
targets, MSRV, and non-development dependencies that one Apple/all-feature API
|
||||
view cannot prove. The compatibility check currently rejects every removal
|
||||
from the Wave C floor; it complements rather than replaces feature, platform,
|
||||
wire, persistence, and interoperability evidence.
|
||||
|
||||
Run with `--update` only after reviewing and recording the compatibility
|
||||
impact; refreshing a snapshot is never a substitute for that review.
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Encode propagation-control peer addresses explicitly as binary data, avoiding
|
||||
intermittent sync/unpeer failures for hashes that resemble MessagePack values.
|
||||
|
||||
- Adopt rsReticulum 1.3 with a patch-line (`~1.3.0`) requirement so the next
|
||||
breaking core minor release is not admitted implicitly.
|
||||
|
||||
- Promote exact Python RNS 1.4.2 to the complete release baseline while
|
||||
retaining LXMF 1.0.1 for the main corpus and live matrix; the LXMF 1.1.0
|
||||
supplemental lane remains separate and RNS 1.5.0 remains deferred.
|
||||
|
||||
## 1.2.0 - 2026-08-17
|
||||
|
||||
- Added the exact-reexport `lxmf_core::message_api` facade, a compiled message
|
||||
|
||||
Generated
+12
-10
@@ -717,9 +717,9 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.0"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -1052,7 +1052,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-crypto"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"cbc",
|
||||
@@ -1070,7 +1070,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-identity"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand 0.8.5",
|
||||
@@ -1088,7 +1088,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-interface"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1096,6 +1096,7 @@ dependencies = [
|
||||
"jni",
|
||||
"libc",
|
||||
"md-5",
|
||||
"mio",
|
||||
"objc2",
|
||||
"objc2-core-bluetooth",
|
||||
"objc2-foundation",
|
||||
@@ -1116,7 +1117,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-link"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand 0.8.5",
|
||||
@@ -1131,7 +1132,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-protocol"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"hex",
|
||||
@@ -1147,7 +1148,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-runtime"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1169,11 +1170,12 @@ dependencies = [
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rns-transport"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1192,7 +1194,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-wire"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"rns-crypto",
|
||||
"sha2",
|
||||
|
||||
+8
-8
@@ -13,14 +13,14 @@ rust-version = "1.87"
|
||||
|
||||
[workspace.dependencies]
|
||||
# Reticulum crates from a sibling rsReticulum checkout during development.
|
||||
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "1.2.0" }
|
||||
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "1.2.0" }
|
||||
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "1.2.0" }
|
||||
rns-link = { path = "../rsReticulum/crates/rns-link", version = "1.2.0" }
|
||||
rns-protocol = { path = "../rsReticulum/crates/rns-protocol", version = "1.2.0" }
|
||||
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "1.2.0" }
|
||||
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "1.2.0" }
|
||||
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "1.2.0" }
|
||||
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "~1.3.0" }
|
||||
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "~1.3.0" }
|
||||
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "~1.3.0" }
|
||||
rns-link = { path = "../rsReticulum/crates/rns-link", version = "~1.3.0" }
|
||||
rns-protocol = { path = "../rsReticulum/crates/rns-protocol", version = "~1.3.0" }
|
||||
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "~1.3.0" }
|
||||
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "~1.3.0" }
|
||||
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "~1.3.0" }
|
||||
|
||||
# Workspace LXMF crates
|
||||
lxmf-core = { path = "crates/lxmf-core", version = "1.2.0" }
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# LXMF message API
|
||||
|
||||
`lxmf_core::message_api` is the canonical application path for constructing
|
||||
and inspecting LXMF message values. It contains exact re-exports of the
|
||||
existing message, status, and identifier identities; all module-qualified
|
||||
paths remain supported.
|
||||
|
||||
The compiled `lxmf-core` `message` example demonstrates construction, signing,
|
||||
packing, and unpacking. Its imports are the facade conformance contract.
|
||||
|
||||
This first boundary is deliberately narrower than an LXMF router facade.
|
||||
`LxmRouter`, delivery ownership, propagation clients/nodes, handlers,
|
||||
persistence, and raw Reticulum transport channels remain provisional,
|
||||
module-qualified orchestration APIs. The facade does not alter wire fields,
|
||||
signatures, serialization, delivery methods, proofs, or persistence.
|
||||
|
||||
Compatibility is checked by the reviewed API snapshot, the manifest/feature
|
||||
contract, an additions-only comparison with the immutable Wave C floor, and an
|
||||
external crate that compiles both canonical and retained imports. Platform,
|
||||
wire, persistence, and Python interoperability gates remain separate evidence.
|
||||
@@ -27,7 +27,7 @@ LXMF daemons on `PATH` without worry.
|
||||
## Contents
|
||||
|
||||
- [Build It](#build-it)
|
||||
- [Message API](MESSAGE_API.md)
|
||||
- [Rust API](api/README.md)
|
||||
- [Operating lxmd-rs](#operating-lxmd-rs)
|
||||
- [Configuration](#configuration)
|
||||
- [Delivery Model](#delivery-model)
|
||||
@@ -342,11 +342,11 @@ Most daemon and control flags are implemented: `--config`, `--rnsconfig`,
|
||||
Additional rsLXMF-only flags: `--send`, `--send-file`, `--send-method`,
|
||||
`--send-timeout-secs`, and `--send-fields-json`.
|
||||
|
||||
The compatibility-floor corpus is Python LXMF 1.0.1 with Reticulum 1.3.8;
|
||||
current daemon, delivery, Resource/proof, and propagation behavior is also
|
||||
checked against exact LXMF 1.1.0 and Reticulum 1.4.2 sources. Version-specific
|
||||
legacy vectors retain their original provenance instead of being silently
|
||||
rewritten to current expectations.
|
||||
The complete release-baseline corpus and live matrix use Python LXMF 1.0.1
|
||||
with Reticulum 1.4.2. A supplementary lane checks daemon, delivery,
|
||||
Resource/proof, and propagation behavior against exact LXMF 1.1.0 with the
|
||||
same Reticulum 1.4.2 source. Historical vectors retain their original
|
||||
provenance, and RNS 1.5.0 is intentionally deferred.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Source release policy
|
||||
|
||||
rsLXMF source releases are built from immutable Git history. A release is
|
||||
identified by an annotated `vX.Y.Z` tag whose version matches the workspace
|
||||
package version and a dated `X.Y.Z` section in `CHANGELOG.md`.
|
||||
|
||||
Before creating a tag:
|
||||
|
||||
1. Move the relevant `Unreleased` changelog entries into a dated version
|
||||
section.
|
||||
2. Set the workspace version to that same semantic version and keep the
|
||||
declared rsReticulum compatibility version accurate.
|
||||
3. Record the exact rsReticulum commit used by the release workflow. The
|
||||
compatibility version describes the manifest contract; the commit is the
|
||||
source actually built and must be proven in an isolated sibling checkout.
|
||||
4. Run `python3 scripts/ci/check_source_release_contract.py` and the normal CI
|
||||
suite with the committed `Cargo.lock`.
|
||||
5. Create the tag only after the release commit is final. Published tags are
|
||||
immutable and must not be retargeted.
|
||||
|
||||
The release workflow checks out the requested existing tag, verifies that the
|
||||
tag, manifest, changelog, dependency checkout, and release commit agree, and
|
||||
builds with `--locked` on Rust 1.87.0. Release artifacts include this policy
|
||||
and the changelog alongside the README and license.
|
||||
|
||||
All workspace packages are intentionally marked `publish = false`. Changing
|
||||
that safeguard requires a separate package-distribution decision; a source
|
||||
release does not change it.
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"snapshotSourceCommit": "c934ccc5feaaddb55461404094ed6bb514aae2cc",
|
||||
"capabilities": ["LXMF-01"],
|
||||
"canonicalPath": "lxmf_core::message_api",
|
||||
"retainedPaths": [
|
||||
"lxmf_core::message",
|
||||
"lxmf_core::constants",
|
||||
"lxmf_core::types"
|
||||
],
|
||||
"internalSpiExcluded": [
|
||||
"router",
|
||||
"delivery ownership",
|
||||
"propagation",
|
||||
"handlers",
|
||||
"persistence",
|
||||
"raw Reticulum transport channels"
|
||||
],
|
||||
"classification": "additive-minor",
|
||||
"publicApiDiff": {"added": 70, "removed": 0},
|
||||
"semver": "compatible additive facade; version selection is deferred to Wave D",
|
||||
"deprecations": "none",
|
||||
"wirePersistenceRuntimeImpact": "none; exact re-exports only",
|
||||
"consumers": [
|
||||
"Ratspeak messaging",
|
||||
"external canonical fixture",
|
||||
"retained legacy fixture"
|
||||
],
|
||||
"platformEvidence": [
|
||||
"host example/test/clippy/rustdoc",
|
||||
"Rust 1.87 external fixture",
|
||||
"downstream product target gates at dependency handoff"
|
||||
]
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"tool": {
|
||||
"name": "cargo-public-api",
|
||||
"version": "0.52.0",
|
||||
"rustdocToolchain": "nightly-2026-08-01",
|
||||
"target": "aarch64-apple-darwin",
|
||||
"arguments": [
|
||||
"--all-features",
|
||||
"-sss"
|
||||
]
|
||||
},
|
||||
"baseline": {
|
||||
"commit": "b8d7afce73f7f098706029361568e63f22888ea3",
|
||||
"capturedOn": "2026-08-17"
|
||||
},
|
||||
"compatibilityFloor": {
|
||||
"evidenceCommit": "80bb96f799330e28a0125367d4c29826f5147cc3",
|
||||
"sourceCommit": "b8d7afce73f7f098706029361568e63f22888ea3"
|
||||
},
|
||||
"snapshotSource": {
|
||||
"commit": "c934ccc5feaaddb55461404094ed6bb514aae2cc",
|
||||
"capturedOn": "2026-08-17",
|
||||
"changeRecord": "api-reviews/wave-c-message-api.json"
|
||||
},
|
||||
"packages": [
|
||||
{
|
||||
"name": "lxmf-core",
|
||||
"manifestPath": "Cargo.toml",
|
||||
"tier": "candidate-stable",
|
||||
"compatibility": "reviewed-snapshot",
|
||||
"snapshot": "api-baseline/lxmf-core.txt",
|
||||
"itemCount": 1622,
|
||||
"sha256": "c958cfdcb53117b02d1dbe907af6afaf5017d5ba92364267e21d204fe5ef3023"
|
||||
},
|
||||
{
|
||||
"name": "lxmf-tools",
|
||||
"manifestPath": "Cargo.toml",
|
||||
"tier": "tool-internal",
|
||||
"compatibility": "reviewed-snapshot",
|
||||
"snapshot": "api-baseline/lxmf-tools.txt",
|
||||
"itemCount": 185,
|
||||
"sha256": "0427d0fab38f8061cbf7f11b701f29f438490478f133524b0a8e4e7cfe6f3924"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
# Rust API
|
||||
|
||||
Application code that constructs or inspects LXMF messages should use
|
||||
`lxmf_core::message_api`. It re-exports the existing message, status, and
|
||||
identifier types without wrapping or replacing them. The original
|
||||
module-qualified paths remain supported.
|
||||
|
||||
The compiled `lxmf-core` `message` example demonstrates message construction,
|
||||
signing, packing, and unpacking through this path.
|
||||
|
||||
## Stability
|
||||
|
||||
`lxmf-core` is candidate stable, but that classification does not make every
|
||||
public implementation detail a permanent API. The message facade is the
|
||||
recommended application path. Router ownership, delivery orchestration,
|
||||
propagation clients and nodes, handlers, persistence representations,
|
||||
admission machinery, Link-delivery state, and raw Reticulum channels remain
|
||||
provisional module-qualified APIs.
|
||||
|
||||
`lxmf-tools` supports the `lxmd-rs` binary and is not a public library
|
||||
integration target.
|
||||
|
||||
The message facade changes no wire fields, signatures, serialization,
|
||||
delivery methods, proofs, persistence, or runtime behavior. Later reductions
|
||||
to the broader module tree require a reviewed API diff, downstream migration,
|
||||
and an explicit version decision.
|
||||
|
||||
## Delivery-owner integration
|
||||
|
||||
`LinkDeliveryManager::set_link_endpoint_dispatch_handle` opts Direct packet
|
||||
sends into the Reticulum owner's exact local-admission receipts. Supply the
|
||||
handle from the same runtime that owns the manager's transport channel.
|
||||
Local FIFO residence and the subsequent measured-RTT proof wait are different
|
||||
phases; neither is a recipient delivery confirmation.
|
||||
|
||||
Applications using responder-owned backchannels should forward the ordered
|
||||
`LinkManagerAccountingEvent` packet and Resource wait observations through
|
||||
`observe_backchannel_packet_wait` and `observe_backchannel_resource_wait`,
|
||||
retaining the exact packet/resource identity and original timestamps.
|
||||
Forward the optional exact packet-cancellation capability with its original
|
||||
wait observation as well. A separate application owner can then cancel a
|
||||
packet still awaiting local admission without closing the shared Link. This
|
||||
cannot retract driver-admitted bytes. When a command receipt cannot be
|
||||
published to its message owner, retain its exact identity for bounded cleanup;
|
||||
close and drain a oneshot receiver before discarding it to fence concurrent
|
||||
publication.
|
||||
Adapters implementing that close-and-drain protocol can install their sender
|
||||
with `set_cancellation_aware_backchannel_sender`, allowing cancellation before
|
||||
the command receipt arrives to notify the adapter immediately. The existing
|
||||
`set_backchannel_sender` retains legacy receipt-after-cancellation behavior.
|
||||
Each pending send captures its adapter policy; replacing a sender does not
|
||||
retroactively change cancellation semantics for older sends.
|
||||
`message_timeout_window` exposes the finite current owner window for an outer
|
||||
orphan watchdog. Externally observed Resource windows include a bounded
|
||||
180-second notification allowance measured from the original protocol deadline;
|
||||
this does not alter the Resource engine's timeout or delay explicit terminal
|
||||
events. It is not renewed by receiving the same observation or by keepalives.
|
||||
Queued messages without an active protocol owner receive no
|
||||
blanket timeout exemption. Explicit rejection and cancellation are not evidence
|
||||
of a failed route.
|
||||
|
||||
Applications that reserve inbound attachment memory can opt into
|
||||
`set_inbound_resource_completion_handler`. It receives one owned completed
|
||||
payload before the ordinary conclusion callback, so an application can move
|
||||
its exact Link/Resource reservation into a queued payload and retain it through
|
||||
processing. This synchronous callback must not block. It replaces the legacy
|
||||
inbound packet-channel delivery for that Resource, without cloning the data;
|
||||
applications that do not install it keep the existing completion behavior.
|
||||
|
||||
## Compatibility checks
|
||||
|
||||
The `api/` directory contains the evidence used by CI:
|
||||
|
||||
- `stability.json` records package tiers, source commits, snapshot hashes, and
|
||||
the current review decision;
|
||||
- `snapshots/` records the explicit all-feature Apple ARM64 Rust API and the
|
||||
manifest, feature, dependency, target, and MSRV contract; and
|
||||
- `fixtures/` compiles recommended and retained imports as an external
|
||||
consumer.
|
||||
|
||||
These checks catch accidental changes, but they do not replace platform builds,
|
||||
wire and persistence tests, Python interoperability, or manual review. The API
|
||||
snapshot omits auto-derived, auto-trait, and blanket implementations and is not
|
||||
by itself a complete SemVer verdict.
|
||||
|
||||
Run the checks with:
|
||||
|
||||
```sh
|
||||
python3 tools/check-api-baseline.py
|
||||
python3 tools/check-api-manifest.py
|
||||
python3 tools/check-api-compatibility.py
|
||||
cargo check --manifest-path api/fixtures/Cargo.toml --locked
|
||||
```
|
||||
|
||||
Snapshot updates require a clean source commit and an explicit review recorded
|
||||
in `api/stability.json`. Additions, removals, deprecations, platform impact, and
|
||||
version consequences must be reviewed before accepting new evidence.
|
||||
+8
-8
@@ -319,9 +319,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
|
||||
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -478,7 +478,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-crypto"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"cbc",
|
||||
@@ -496,7 +496,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-identity"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand",
|
||||
@@ -514,7 +514,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-link"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand",
|
||||
@@ -529,7 +529,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-protocol"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"hex",
|
||||
@@ -545,7 +545,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-transport"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -564,7 +564,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-wire"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"rns-crypto",
|
||||
"sha2",
|
||||
@@ -7,4 +7,4 @@ publish = false
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
lxmf-core = { path = "../crates/lxmf-core" }
|
||||
lxmf-core = { path = "../../crates/lxmf-core" }
|
||||
@@ -40,3 +40,20 @@ pub mod legacy {
|
||||
let _ = std::mem::size_of::<UnverifiedReason>();
|
||||
}
|
||||
}
|
||||
|
||||
/// Delivery coordination remains a module-qualified opt-in API.
|
||||
pub mod delivery_ownership {
|
||||
use lxmf_core::link_delivery::LinkDeliveryManager;
|
||||
|
||||
pub fn compile_surface(manager: &mut LinkDeliveryManager) {
|
||||
let _ = LinkDeliveryManager::set_link_endpoint_dispatch_handle;
|
||||
let _ = LinkDeliveryManager::set_cancellation_aware_backchannel_sender;
|
||||
let _ = LinkDeliveryManager::observe_backchannel_packet_wait;
|
||||
let _ = LinkDeliveryManager::observe_backchannel_resource_wait;
|
||||
let _ = LinkDeliveryManager::abandon_backchannel_packet;
|
||||
let _ = LinkDeliveryManager::message_timeout_window;
|
||||
manager.set_inbound_resource_completion_handler(|link_id, resource_id, data| {
|
||||
let _: ([u8; 16], [u8; 32], Vec<u8>) = (link_id, resource_id, data);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -468,6 +468,7 @@ pub lxmf_core::link_delivery::DirectLinkStartReport::link_state: rns_link::link:
|
||||
pub lxmf_core::link_delivery::DirectLinkStartReport::queued_deliveries: usize
|
||||
pub struct lxmf_core::link_delivery::LinkDeliveryManager
|
||||
impl lxmf_core::link_delivery::LinkDeliveryManager
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::abandon_backchannel_packet(&mut self, [u8; 16], [u8; 32]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::backchannel_link_snapshot(&self, [u8; 16]) -> core::option::Option<lxmf_core::link_delivery::BackchannelLinkSnapshot>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::cancel_delivery_by_message_hash(&mut self, [u8; 32]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::delivery_link_available(&self, &[u8; 16]) -> bool
|
||||
@@ -485,20 +486,29 @@ pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_request(&mut self,
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_resource_proof(&mut self, &[u8; 16], &[u8]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_resource_reject(&mut self, &[u8; 16], &[u8]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::message_delivery_snapshot(&self, [u8; 32]) -> core::option::Option<lxmf_core::link_delivery::MessageDeliverySnapshot>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::message_timeout_window(&self, [u8; 32]) -> core::option::Option<(std::time::Instant, core::time::Duration)>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::new(tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>, core::option::Option<[u8; 64]>, core::option::Option<rns_crypto::ed25519::Ed25519PrivateKey>) -> Self
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::observe_backchannel_packet_wait(&mut self, [u8; 16], [u8; 32], std::time::Instant, core::time::Duration, bool, core::option::Option<rns_transport::link_endpoint_dispatch::LinkEndpointDispatchCancellation>) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::observe_backchannel_resource_wait(&mut self, [u8; 16], [u8; 32], std::time::Instant, core::time::Duration) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::pending_count(&self) -> usize
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::register_backchannel(&mut self, [u8; 16], [u8; 16])
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::remove_backchannel(&mut self, &[u8; 16]) -> core::option::Option<[u8; 16]>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::session_count(&self) -> usize
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_backchannel_sender(&mut self, tokio::sync::mpsc::bounded::Sender<lxmf_core::link_delivery::BackchannelSendCommand>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_cancellation_aware_backchannel_sender(&mut self, tokio::sync::mpsc::bounded::Sender<lxmf_core::link_delivery::BackchannelSendCommand>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_packet_sender(&mut self, tokio::sync::mpsc::unbounded::UnboundedSender<(alloc::vec::Vec<u8>, [u8; 16])>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_accept_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], &rns_protocol::resource_adv::ResourceAdvertisement) -> bool + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_completion_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], [u8; 32], alloc::vec::Vec<u8>) + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_concluded_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], [u8; 32]) + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_limit_bytes(&mut self, usize)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_link_endpoint_dispatch_handle(&mut self, rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_backchannel_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16]) -> core::result::Result<lxmf_core::link_delivery::BackchannelStartReport, lxmf_core::link_delivery::BackchannelStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_report(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<lxmf_core::link_delivery::DirectLinkStartReport, lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_report_and_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<lxmf_core::link_delivery::DirectLinkStartReport, lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_packed_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, alloc::vec::Vec<u8>, bool) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_packed_delivery_with_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, alloc::vec::Vec<u8>, bool, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::stats(&self) -> lxmf_core::link_delivery::LinkDeliveryStats
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::take_backchannel_resource_cancellations(&mut self) -> alloc::vec::Vec<lxmf_core::link_delivery::BackchannelResourceCancelRequest>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::take_delivery_events(&mut self) -> alloc::vec::Vec<lxmf_core::link_delivery::LxmfDeliveryEvent>
|
||||
@@ -521,6 +531,15 @@ pub lxmf_core::link_delivery::LinkDeliveryStats::pending_backchannel_deliveries:
|
||||
pub lxmf_core::link_delivery::LinkDeliveryStats::pending_backchannel_starts: usize
|
||||
pub lxmf_core::link_delivery::LinkDeliveryStats::queued_deliveries: usize
|
||||
pub lxmf_core::link_delivery::LinkDeliveryStats::sessions: usize
|
||||
pub struct lxmf_core::link_delivery::LinkEstablishmentTiming
|
||||
impl lxmf_core::link_delivery::LinkEstablishmentTiming
|
||||
pub const fn lxmf_core::link_delivery::LinkEstablishmentTiming::first_hop_timeout(self) -> core::time::Duration
|
||||
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_bitrate(u64) -> Self
|
||||
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_bitrate_and_mtu(u64, u32) -> Self
|
||||
pub const fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_timeout(core::time::Duration) -> Self
|
||||
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::timeout_for_hops(self, u8) -> core::time::Duration
|
||||
impl core::default::Default for lxmf_core::link_delivery::LinkEstablishmentTiming
|
||||
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::default() -> Self
|
||||
pub struct lxmf_core::link_delivery::LxmfDeliveryEvent
|
||||
pub lxmf_core::link_delivery::LxmfDeliveryEvent::attempts: u32
|
||||
pub lxmf_core::link_delivery::LxmfDeliveryEvent::delivery_state: lxmf_core::link_delivery::DeliveryState
|
||||
@@ -1414,6 +1433,7 @@ pub fn lxmf_core::router::LxmRouter::set_retain_node_lxms(&mut self, bool)
|
||||
pub fn lxmf_core::router::LxmRouter::set_stamp_cost(&mut self, [u8; 16], u8)
|
||||
pub fn lxmf_core::router::LxmRouter::set_stamp_requirements(&mut self, u8, u8)
|
||||
pub fn lxmf_core::router::LxmRouter::set_transport(&mut self, tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>)
|
||||
pub fn lxmf_core::router::LxmRouter::state_snapshot(&self) -> lxmf_core::router::RouterStateSnapshot
|
||||
pub fn lxmf_core::router::LxmRouter::stats(&self) -> lxmf_core::router::RouterStats
|
||||
pub fn lxmf_core::router::LxmRouter::sync_peer_policies_for_store(&self, u64) -> alloc::vec::Vec<lxmf_core::peer::OutboundOfferPolicy>
|
||||
pub fn lxmf_core::router::LxmRouter::sync_peers(&mut self) -> alloc::vec::Vec<[u8; 16]>
|
||||
@@ -1484,6 +1504,9 @@ pub lxmf_core::router::RouterConfigExt::propagation_cost_min: u8
|
||||
pub lxmf_core::router::RouterConfigExt::retain_synced_on_node: bool
|
||||
impl core::default::Default for lxmf_core::router::RouterConfigExt
|
||||
pub fn lxmf_core::router::RouterConfigExt::default() -> Self
|
||||
pub struct lxmf_core::router::RouterStateSnapshot
|
||||
impl lxmf_core::router::RouterStateSnapshot
|
||||
pub fn lxmf_core::router::RouterStateSnapshot::save_state(&self, &std::path::Path) -> core::io::error::Result<()>
|
||||
pub struct lxmf_core::router::RouterStats
|
||||
pub lxmf_core::router::RouterStats::peers: usize
|
||||
pub lxmf_core::router::RouterStats::pending_deferred_stamps: usize
|
||||
File renamed without changes.
@@ -103,7 +103,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -114,7 +114,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -125,7 +125,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -136,7 +136,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -147,7 +147,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -158,7 +158,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -328,7 +328,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -339,7 +339,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -350,7 +350,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [
|
||||
@@ -363,7 +363,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -374,7 +374,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"tool": {
|
||||
"name": "cargo-public-api",
|
||||
"version": "0.52.0",
|
||||
"rustdocToolchain": "nightly-2026-08-01",
|
||||
"target": "aarch64-apple-darwin",
|
||||
"arguments": [
|
||||
"--all-features",
|
||||
"-sss"
|
||||
]
|
||||
},
|
||||
"baseline": {
|
||||
"commit": "b8d7afce73f7f098706029361568e63f22888ea3",
|
||||
"capturedOn": "2026-08-17"
|
||||
},
|
||||
"compatibilityFloor": {
|
||||
"evidenceCommit": "80bb96f799330e28a0125367d4c29826f5147cc3",
|
||||
"sourceCommit": "b8d7afce73f7f098706029361568e63f22888ea3"
|
||||
},
|
||||
"snapshotSource": {
|
||||
"commit": "8db95825c568ace467c99d2011cefe618e1c60fc",
|
||||
"capturedOn": "2026-09-08",
|
||||
"review": {
|
||||
"areas": [
|
||||
"Exact local packet admission and proof-clock ownership",
|
||||
"Finite original Resource windows and bounded external observation grace",
|
||||
"Cancellation-aware backchannel adapters with legacy compatibility",
|
||||
"Generation-safe cleanup, settlement and queued-message preservation",
|
||||
"Owned reverse Resource completion handoff"
|
||||
],
|
||||
"canonicalPath": "lxmf_core::link_delivery::LinkDeliveryManager",
|
||||
"retainedPaths": [
|
||||
"lxmf_core::message",
|
||||
"lxmf_core::constants",
|
||||
"lxmf_core::types",
|
||||
"lxmf_core::router",
|
||||
"lxmf_core::link_delivery"
|
||||
],
|
||||
"excludedImplementationAreas": [
|
||||
"propagation and handlers",
|
||||
"serialized persistence representations",
|
||||
"raw Reticulum transport channels"
|
||||
],
|
||||
"classification": "compatible additive opt-in provisional delivery-owner integration; existing message facade and public signatures remain unchanged",
|
||||
"publicApiDiff": {
|
||||
"added": 93,
|
||||
"removed": 0
|
||||
},
|
||||
"semver": "compatible additive APIs included in version 1.2.0",
|
||||
"deprecations": "none",
|
||||
"wirePersistenceRuntimeImpact": "No wire-format, cryptography, message identity or persisted-layout change. Exact local Link admission precedes RTT proof timing. Resource owner windows retain original timestamps; only externally observed Resources receive a finite 180-second accounting allowance after the original protocol deadline. Cancellation-aware adapters close and drain unpublished receipts while legacy sender installation retains its previous behavior. Exact cleanup is bounded and cannot erase replacement Links or lose uncancelled queued messages; authenticated settlement remains owned after Link closure. Optional reverse Resource completion hands off the single owned payload before conclusion cleanup, without changing legacy consumers.",
|
||||
"platformEvidence": [
|
||||
"clean committed-source all-feature Apple ARM64 snapshot: seven added methods, zero removed; cumulative compatibility-floor diff is 93 additions and zero removals",
|
||||
"564 LXMF core and 55 daemon tests passed on the final implementation checkpoint; strict all-target Clippy and core Rustdoc passed",
|
||||
"independent actual-actor cancellation, captured legacy/aware policy, 256-owner reservation and replacement-Link/settlement review controls passed",
|
||||
"actual encrypted Resource final-proof expiry and same-message retry produced one receiver publication; signed Link reuse/loss/recovery and completion-lease controls passed",
|
||||
"default/all-feature external consumer fixtures and final working app runtime suite passed; no feature/MSRV/native-export changes",
|
||||
"final clean combined host/MSRV/native/interop and artifact qualification remain separately required; focused software evidence is not physical fading-radio or mobile acceptance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"packages": [
|
||||
{
|
||||
"name": "lxmf-core",
|
||||
"manifestPath": "Cargo.toml",
|
||||
"tier": "candidate-stable",
|
||||
"compatibility": "reviewed-snapshot",
|
||||
"snapshot": "api/snapshots/lxmf-core.txt",
|
||||
"itemCount": 1645,
|
||||
"sha256": "65aebd34c72bb2b621d515331bba1f4d85234c448d1c7039132f24c0a95bbe4a"
|
||||
},
|
||||
{
|
||||
"name": "lxmf-tools",
|
||||
"manifestPath": "Cargo.toml",
|
||||
"tier": "tool-internal",
|
||||
"compatibility": "reviewed-snapshot",
|
||||
"snapshot": "api/snapshots/lxmf-tools.txt",
|
||||
"itemCount": 185,
|
||||
"sha256": "0427d0fab38f8061cbf7f11b701f29f438490478f133524b0a8e4e7cfe6f3924"
|
||||
}
|
||||
]
|
||||
}
|
||||
+2872
-201
File diff suppressed because it is too large.
Load diff
@@ -745,6 +745,17 @@ impl PropagationNode {
|
||||
PropagationEntry::new_stamped(tid, message_hash, destination_hash, size, sv);
|
||||
pe.stored_at = ts;
|
||||
|
||||
// Older app hosts persisted opaque blobs without their PN
|
||||
// stamp. Their filename TID hashes the entire file, whereas
|
||||
// canonical stamped storage hashes the file before its final
|
||||
// 32-byte stamp. Recover that exact legacy representation so
|
||||
// client /get cannot truncate ciphertext after a restart.
|
||||
// This distinguishes storage format, not stamp authenticity;
|
||||
// retain the existing policy for other opaque/malformed files.
|
||||
if data.len() > DESTINATION_LENGTH && message_hash == tid {
|
||||
pe.stamped = false;
|
||||
}
|
||||
|
||||
if let Ok(msg) = LxMessage::unpack(&data) {
|
||||
pe.message_hash = msg.hash.unwrap_or([0u8; 32]);
|
||||
pe.destination_hash = msg.destination_hash;
|
||||
@@ -2840,9 +2851,140 @@ mod tests {
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(value.as_array().unwrap().len(), 1);
|
||||
|
||||
let full_id = rns_crypto::sha::full_hash(&lxmf_data);
|
||||
let get_request = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut get_buf = Vec::new();
|
||||
rmpv::encode::write_value(&mut get_buf, &get_request).unwrap();
|
||||
let response = reloaded
|
||||
.handle_get_request(&get_buf, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(
|
||||
value.as_array().unwrap()[0].as_slice().unwrap(),
|
||||
lxmf_data.as_slice(),
|
||||
"legacy opaque blobs have no stamp to strip after restart"
|
||||
);
|
||||
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_opaque_blob_reload_preserves_bytes_and_accounting_at_minimum_lengths() {
|
||||
use rmpv::Value;
|
||||
|
||||
// These are storage-format controls, not authenticated ciphertext or
|
||||
// stamp-validation tests. Retain the existing public ingress minimum.
|
||||
for stamped in [false, true] {
|
||||
for len in [17, 31, 32, 33, 48, 49, 144] {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(!node.accept_propagated_blob(&[0xBB; 16], 0));
|
||||
assert!(!node.accept_stamped_propagated_blob(&[0xBB; 16], &[0; 32], 0));
|
||||
assert_eq!(node.message_count(), 0);
|
||||
let mut blob = vec![0xBB; 16];
|
||||
blob.resize(len, 0xCC);
|
||||
let stamp = [0x5A; 32];
|
||||
let full_id = rns_crypto::sha::full_hash(&blob);
|
||||
let mut stored = blob.clone();
|
||||
if stamped {
|
||||
stored.extend_from_slice(&stamp);
|
||||
assert!(node.accept_stamped_propagated_blob(&blob, &stamp, 0));
|
||||
} else {
|
||||
assert!(node.accept_propagated_blob(&blob, 0));
|
||||
}
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
let path = dir
|
||||
.path()
|
||||
.join(node.store.get(&full_id).unwrap().filename());
|
||||
assert_eq!(std::fs::read(&path).unwrap(), stored);
|
||||
drop(node);
|
||||
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
assert_eq!(node.store.get(&full_id).unwrap().stamped, stamped);
|
||||
// Duplicate admission must neither replace the known format
|
||||
// nor grow the byte/accounting reservation after reload.
|
||||
assert!(!node.accept_propagated_blob(&blob, 0));
|
||||
assert!(!node.accept_stamped_propagated_blob(&blob, &stamp, 0));
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
assert!(node.pending_write_ids.is_empty());
|
||||
assert_eq!(node.pending_write_bytes, 0);
|
||||
let get = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut request = Vec::new();
|
||||
rmpv::encode::write_value(&mut request, &get).unwrap();
|
||||
let response = node
|
||||
.handle_get_request(&request, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
let messages = value.as_array().unwrap();
|
||||
assert_eq!(messages.len(), 1);
|
||||
assert_eq!(messages[0].as_slice().unwrap(), blob);
|
||||
assert_eq!(
|
||||
node.message_get_request(&[full_id]),
|
||||
vec![(full_id, stored.clone())]
|
||||
);
|
||||
assert_eq!(std::fs::read(&path).unwrap(), stored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reloaded_legacy_message_keeps_original_get_bytes() {
|
||||
use rmpv::Value;
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let message = make_signed_message([0xBB; 16], [0xCC; 16], "legacy", "full message");
|
||||
let packed = message.pack().unwrap();
|
||||
let full_id = message.transient_id.or(message.hash).unwrap();
|
||||
assert_ne!(full_id, rns_crypto::sha::full_hash(&packed));
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(node.accept_message(&message));
|
||||
drop(node);
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), packed.len());
|
||||
assert!(!node.store.get(&full_id).unwrap().stamped);
|
||||
let get = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut request = Vec::new();
|
||||
rmpv::encode::write_value(&mut request, &get).unwrap();
|
||||
let response = node
|
||||
.handle_get_request(&request, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(value.as_array().unwrap()[0].as_slice().unwrap(), packed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_handle_get_request_purge_phase() {
|
||||
let dir = std::env::temp_dir().join("lxmf_test_get_purge");
|
||||
|
||||
+126
-15
@@ -20,7 +20,7 @@ use crate::peer::{LxmPeer, OutboundOfferPolicy};
|
||||
use crate::propagation::PropagationStore;
|
||||
use crate::propagation_client::PropagationTransferStatus;
|
||||
use crate::stamper;
|
||||
use crate::ticket::{Ticket, TicketStore};
|
||||
use crate::ticket::{Ticket, TicketStore, TicketStoreSnapshot};
|
||||
use crate::types::PropagationTransientId;
|
||||
|
||||
/// Router configuration.
|
||||
@@ -352,6 +352,37 @@ pub struct StampCostEntry {
|
||||
pub recorded_at: f64,
|
||||
}
|
||||
|
||||
/// Owned, coherent snapshot of the router state written by [`LxmRouter::save_state`].
|
||||
///
|
||||
/// Creating the snapshot only clones in-memory state. The caller can therefore
|
||||
/// release any lock that protects the router before calling [`Self::save_state`],
|
||||
/// keeping filesystem I/O out of the router's critical section.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RouterStateSnapshot {
|
||||
outbound_stamp_costs: HashMap<[u8; 16], StampCostEntry>,
|
||||
tickets: TicketStoreSnapshot,
|
||||
local_deliveries: HashMap<PropagationTransientId, f64>,
|
||||
locally_processed: HashMap<PropagationTransientId, f64>,
|
||||
node_stats: crate::persist::PersistedNodeStats,
|
||||
}
|
||||
|
||||
impl RouterStateSnapshot {
|
||||
/// Persist this owned snapshot using the router's MessagePack layout.
|
||||
///
|
||||
/// Each file is written atomically via rename, matching
|
||||
/// [`LxmRouter::save_state`].
|
||||
pub fn save_state(&self, state_dir: &std::path::Path) -> std::io::Result<()> {
|
||||
use crate::persist;
|
||||
|
||||
persist::save_stamp_costs(state_dir, &self.outbound_stamp_costs)?;
|
||||
persist::save_tickets(state_dir, &self.tickets)?;
|
||||
persist::save_local_deliveries(state_dir, &self.local_deliveries)?;
|
||||
persist::save_locally_processed(state_dir, &self.locally_processed)?;
|
||||
persist::save_node_stats(state_dir, &self.node_stats)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl LxmRouter {
|
||||
pub fn new(config: RouterConfig) -> Self {
|
||||
Self {
|
||||
@@ -1129,25 +1160,29 @@ impl LxmRouter {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Persist runtime state to `state_dir` using MessagePack. Safe to call
|
||||
/// periodically; each file is written atomically via rename.
|
||||
pub fn save_state(&self, state_dir: &std::path::Path) -> std::io::Result<()> {
|
||||
use crate::persist;
|
||||
|
||||
persist::save_stamp_costs(state_dir, &self.outbound_stamp_costs)?;
|
||||
persist::save_tickets(state_dir, &self.ticket_store.snapshot())?;
|
||||
persist::save_local_deliveries(state_dir, self.propagation_store.locally_delivered_ids())?;
|
||||
persist::save_locally_processed(state_dir, self.propagation_store.locally_processed_ids())?;
|
||||
persist::save_node_stats(
|
||||
state_dir,
|
||||
&persist::PersistedNodeStats {
|
||||
/// Clone all runtime state written by [`Self::save_state`] into one owned
|
||||
/// value. Embedders can take this snapshot while holding the router lock,
|
||||
/// release the lock, and perform persistence through
|
||||
/// [`RouterStateSnapshot::save_state`].
|
||||
pub fn state_snapshot(&self) -> RouterStateSnapshot {
|
||||
RouterStateSnapshot {
|
||||
outbound_stamp_costs: self.outbound_stamp_costs.clone(),
|
||||
tickets: self.ticket_store.snapshot(),
|
||||
local_deliveries: self.propagation_store.locally_delivered_ids().clone(),
|
||||
locally_processed: self.propagation_store.locally_processed_ids().clone(),
|
||||
node_stats: crate::persist::PersistedNodeStats {
|
||||
client_propagation_messages_received: self.client_propagation_messages_received,
|
||||
client_propagation_messages_served: self.client_propagation_messages_served,
|
||||
unpeered_propagation_incoming: self.unpeered_propagation_incoming,
|
||||
unpeered_propagation_rx_bytes: self.unpeered_propagation_rx_bytes,
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Persist runtime state to `state_dir` using MessagePack. Safe to call
|
||||
/// periodically; each file is written atomically via rename.
|
||||
pub fn save_state(&self, state_dir: &std::path::Path) -> std::io::Result<()> {
|
||||
self.state_snapshot().save_state(state_dir)
|
||||
}
|
||||
|
||||
/// Return peer destination hashes that are due for sync and mark each as
|
||||
@@ -3051,6 +3086,82 @@ mod tests {
|
||||
assert_eq!(r2.unpeered_propagation_rx_bytes, 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_state_snapshot_is_an_owned_coherent_copy() {
|
||||
let dest = [0xA1; 16];
|
||||
let transient = [0xB2; 32];
|
||||
|
||||
let mut router = LxmRouter::new(RouterConfig::default());
|
||||
router.set_stamp_cost(dest, 8);
|
||||
router.remember_ticket(dest, [0xC3; 16], 4_102_444_800.0);
|
||||
router.propagation_store.mark_locally_delivered(transient);
|
||||
router.propagation_store.mark_locally_processed(transient);
|
||||
router.client_propagation_messages_received = 10;
|
||||
router.client_propagation_messages_served = 11;
|
||||
router.unpeered_propagation_incoming = 12;
|
||||
router.unpeered_propagation_rx_bytes = 13;
|
||||
|
||||
let snapshot = router.state_snapshot();
|
||||
|
||||
// Mutating every persisted router dataset after capture must not alter
|
||||
// the snapshot that a background persistence task owns.
|
||||
router.set_stamp_cost(dest, 42);
|
||||
router.remember_ticket(dest, [0xD4; 16], 4_102_444_800.0);
|
||||
router
|
||||
.propagation_store
|
||||
.replace_locally_delivered(HashMap::new());
|
||||
router
|
||||
.propagation_store
|
||||
.replace_locally_processed(HashMap::new());
|
||||
router.client_propagation_messages_received = 20;
|
||||
router.client_propagation_messages_served = 21;
|
||||
router.unpeered_propagation_incoming = 22;
|
||||
router.unpeered_propagation_rx_bytes = 23;
|
||||
|
||||
assert_eq!(snapshot.outbound_stamp_costs[&dest].cost, 8);
|
||||
assert_eq!(snapshot.tickets.outbound.len(), 1);
|
||||
assert_eq!(snapshot.tickets.outbound[0].token, [0xC3; 16]);
|
||||
assert!(snapshot.local_deliveries.contains_key(&transient));
|
||||
assert!(snapshot.locally_processed.contains_key(&transient));
|
||||
assert_eq!(snapshot.node_stats.client_propagation_messages_received, 10);
|
||||
assert_eq!(snapshot.node_stats.client_propagation_messages_served, 11);
|
||||
assert_eq!(snapshot.node_stats.unpeered_propagation_incoming, 12);
|
||||
assert_eq!(snapshot.node_stats.unpeered_propagation_rx_bytes, 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_state_snapshot_persists_after_router_is_dropped() {
|
||||
let tmp = tempfile::TempDir::new().unwrap();
|
||||
let dest = [0xA5; 16];
|
||||
let transient = [0xB6; 32];
|
||||
|
||||
let snapshot = {
|
||||
let mut router = LxmRouter::new(RouterConfig::default());
|
||||
router.set_stamp_cost(dest, 9);
|
||||
router.remember_ticket(dest, [0xC7; 16], 4_102_444_800.0);
|
||||
router.propagation_store.mark_locally_delivered(transient);
|
||||
router.propagation_store.mark_locally_processed(transient);
|
||||
router.client_propagation_messages_received = 30;
|
||||
router.client_propagation_messages_served = 31;
|
||||
router.unpeered_propagation_incoming = 32;
|
||||
router.unpeered_propagation_rx_bytes = 33;
|
||||
router.state_snapshot()
|
||||
};
|
||||
|
||||
snapshot.save_state(tmp.path()).unwrap();
|
||||
|
||||
let mut restored = LxmRouter::new(RouterConfig::default());
|
||||
restored.load_state(tmp.path()).unwrap();
|
||||
assert_eq!(restored.outbound_stamp_costs[&dest].cost, 9);
|
||||
assert_eq!(restored.get_outbound_ticket(&dest), Some([0xC7; 16]));
|
||||
assert!(restored.propagation_store.is_locally_delivered(&transient));
|
||||
assert!(restored.propagation_store.is_locally_processed(&transient));
|
||||
assert_eq!(restored.client_propagation_messages_received, 30);
|
||||
assert_eq!(restored.client_propagation_messages_served, 31);
|
||||
assert_eq!(restored.unpeered_propagation_incoming, 32);
|
||||
assert_eq!(restored.unpeered_propagation_rx_bytes, 33);
|
||||
}
|
||||
|
||||
/// T1-10: persisted dedup timestamps are the REAL first-seen times —
|
||||
/// restored on load (not reset to save-time), so age-based expiry is
|
||||
/// stable across arbitrarily many save/load cycles.
|
||||
|
||||
@@ -869,6 +869,46 @@ fn direct_reusable_link_state(
|
||||
}
|
||||
}
|
||||
|
||||
async fn forward_backchannel_receipt(
|
||||
mut runtime_rx: tokio::sync::oneshot::Receiver<
|
||||
Result<
|
||||
rns_runtime::link_manager::LinkPayloadSendReceipt,
|
||||
rns_runtime::link_manager::LinkSendError,
|
||||
>,
|
||||
>,
|
||||
mut owner_tx: tokio::sync::oneshot::Sender<
|
||||
Result<BackchannelSendReceipt, BackchannelSendError>,
|
||||
>,
|
||||
abandon_tx: mpsc::Sender<BackchannelSendReceipt>,
|
||||
) {
|
||||
let result = tokio::select! {
|
||||
biased;
|
||||
result = &mut runtime_rx => Some(result),
|
||||
_ = owner_tx.closed() => None,
|
||||
_ = tokio::time::sleep(std::time::Duration::from_secs(10)) => None,
|
||||
};
|
||||
let Some(result) = result else {
|
||||
// close preserves an already-published value and rejects future sends.
|
||||
// The runtime cancels exact admission if its receipt publication fails.
|
||||
runtime_rx.close();
|
||||
if let Ok(Ok(receipt)) = runtime_rx.try_recv() {
|
||||
let _ = abandon_tx
|
||||
.send(backchannel_receipt_from_runtime(receipt))
|
||||
.await;
|
||||
}
|
||||
let _ = owner_tx.send(Err(BackchannelSendError::TransportUnavailable));
|
||||
return;
|
||||
};
|
||||
let result = match result {
|
||||
Ok(Ok(receipt)) => Ok(backchannel_receipt_from_runtime(receipt)),
|
||||
Ok(Err(error)) => Err(backchannel_error_from_runtime(error)),
|
||||
Err(_) => Err(BackchannelSendError::TransportUnavailable),
|
||||
};
|
||||
if let Err(Ok(receipt)) = owner_tx.send(result) {
|
||||
let _ = abandon_tx.send(receipt).await;
|
||||
}
|
||||
}
|
||||
|
||||
fn backchannel_receipt_from_runtime(
|
||||
receipt: rns_runtime::link_manager::LinkPayloadSendReceipt,
|
||||
) -> BackchannelSendReceipt {
|
||||
@@ -1179,12 +1219,19 @@ struct LxmdRunner {
|
||||
mpsc::UnboundedReceiver<rns_runtime::link_manager::DestinationDeliveryProof>,
|
||||
opportunistic_in_flight: HashMap<[u8; 32], PendingOpportunisticDelivery>,
|
||||
backchannel_command_rx: Option<mpsc::Receiver<BackchannelSendCommand>>,
|
||||
backchannel_abandon_tx: mpsc::Sender<BackchannelSendReceipt>,
|
||||
backchannel_abandon_rx: mpsc::Receiver<BackchannelSendReceipt>,
|
||||
pending_backchannel_abandon: Option<BackchannelSendReceipt>,
|
||||
backchannel_bridge_slots: Arc<tokio::sync::Semaphore>,
|
||||
pending_backchannel_resource_cancellations:
|
||||
VecDeque<lxmf_core::link_delivery::BackchannelResourceCancelRequest>,
|
||||
last_delivery_failure: Option<String>,
|
||||
propagation_sync: Option<lxmf_core::propagation_sync::PropagationSyncTask>,
|
||||
propagation_client: Option<lxmf_core::propagation_client::PropagationClient>,
|
||||
propagation_node: Option<Arc<Mutex<PropagationNode>>>,
|
||||
propagation_admission: Option<Arc<Mutex<PnInboundRuntime>>>,
|
||||
prop_link_command_tx: Option<mpsc::Sender<rns_runtime::link_manager::LinkManagerCommand>>,
|
||||
endpoint_dispatch: Option<rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle>,
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
pending_runtime_transport: VecDeque<TransportMessage>,
|
||||
required_announces: AnnounceMailbox,
|
||||
@@ -1293,6 +1340,9 @@ impl LxmdRunner {
|
||||
config: DaemonConfig,
|
||||
config_dir: &Path,
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
endpoint_dispatch: Option<
|
||||
rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle,
|
||||
>,
|
||||
) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let paths = LxmdPaths::new(config_dir);
|
||||
std::fs::create_dir_all(&paths.config_dir)?;
|
||||
@@ -1383,6 +1433,7 @@ impl LxmdRunner {
|
||||
// LinkManager handles link handshakes (ECDH), keepalive, identification,
|
||||
// and resource transfers; it forwards plaintext application data here.
|
||||
let (delivery_tx, delivery_rx) = mpsc::channel(256);
|
||||
let (backchannel_abandon_tx, backchannel_abandon_rx) = mpsc::channel(256);
|
||||
let (link_packet_tx, link_packet_rx) = mpsc::unbounded_channel::<(Vec<u8>, [u8; 16])>();
|
||||
let (delivery_accounting_tx, delivery_accounting_rx) =
|
||||
mpsc::unbounded_channel::<LinkManagerAccountingEvent>();
|
||||
@@ -1434,6 +1485,9 @@ impl LxmdRunner {
|
||||
DELIVERY_APP_NAME,
|
||||
signing_key,
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
link_mgr.set_link_packet_channel(link_packet_tx);
|
||||
link_mgr.set_accounting_event_channel(delivery_accounting_tx);
|
||||
link_mgr.set_resource_event_channel(delivery_resource_event_tx);
|
||||
@@ -1572,6 +1626,9 @@ impl LxmdRunner {
|
||||
"lxmf.propagation",
|
||||
Some(prop_signing_key),
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
prop_link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
prop_link_mgr.set_link_packet_channel(prop_link_packet_tx);
|
||||
prop_link_mgr.set_accounting_event_channel(prop_accounting_tx);
|
||||
prop_link_mgr.set_resource_strategy(rns_runtime::prelude::ResourceStrategy::AcceptApp);
|
||||
@@ -1728,6 +1785,9 @@ impl LxmdRunner {
|
||||
CONTROL_APP_NAME,
|
||||
Some(control_signing_key),
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
control_link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
let control_link_identities = control_link_mgr.link_identities_handle();
|
||||
let stats_path_hash =
|
||||
rns_crypto::sha::truncated_hash(lxmf_core::constants::STATS_GET_PATH.as_bytes());
|
||||
@@ -1854,12 +1914,18 @@ impl LxmdRunner {
|
||||
destination_delivery_proof_rx,
|
||||
opportunistic_in_flight: HashMap::new(),
|
||||
backchannel_command_rx: None,
|
||||
backchannel_abandon_tx,
|
||||
backchannel_abandon_rx,
|
||||
pending_backchannel_abandon: None,
|
||||
backchannel_bridge_slots: Arc::new(tokio::sync::Semaphore::new(256)),
|
||||
pending_backchannel_resource_cancellations: VecDeque::new(),
|
||||
last_delivery_failure: None,
|
||||
propagation_sync: None,
|
||||
propagation_client: None,
|
||||
propagation_node: None,
|
||||
propagation_admission,
|
||||
prop_link_command_tx,
|
||||
endpoint_dispatch,
|
||||
transport_tx: transport_tx.clone(),
|
||||
pending_runtime_transport: VecDeque::new(),
|
||||
required_announces,
|
||||
@@ -2395,12 +2461,77 @@ impl LxmdRunner {
|
||||
}
|
||||
|
||||
fn drain_core_backchannel_send_commands(&mut self) {
|
||||
while let Some(receipt) = self
|
||||
.pending_backchannel_abandon
|
||||
.take()
|
||||
.or_else(|| self.backchannel_abandon_rx.try_recv().ok())
|
||||
{
|
||||
match receipt {
|
||||
BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
if !ld.abandon_backchannel_packet(link_id, packet_hash) {
|
||||
self.pending_backchannel_abandon =
|
||||
Some(BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
BackchannelSendReceipt::Resource {
|
||||
link_id,
|
||||
resource_hash,
|
||||
} => {
|
||||
self.pending_backchannel_resource_cancellations.push_back(
|
||||
lxmf_core::link_delivery::BackchannelResourceCancelRequest {
|
||||
link_id,
|
||||
resource_hash,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
self.pending_backchannel_resource_cancellations
|
||||
.extend(ld.take_backchannel_resource_cancellations());
|
||||
}
|
||||
while let Some(request) = self.pending_backchannel_resource_cancellations.front() {
|
||||
let command = LinkManagerCommand::CancelLinkResource {
|
||||
link_id: request.link_id,
|
||||
resource_id: request.resource_hash,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
result_tx: None,
|
||||
};
|
||||
match self.link_command_tx.try_send(command) {
|
||||
Ok(()) => {
|
||||
self.pending_backchannel_resource_cancellations.pop_front();
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Full(_)) => break,
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
self.pending_backchannel_resource_cancellations.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let Some(rx) = self.backchannel_command_rx.as_mut() else {
|
||||
return;
|
||||
};
|
||||
let command_tx = self.link_command_tx.clone();
|
||||
|
||||
while let Ok(command) = rx.try_recv() {
|
||||
if command.result_tx.is_closed() {
|
||||
continue;
|
||||
}
|
||||
let Ok(bridge_slot) = self.backchannel_bridge_slots.clone().try_acquire_owned() else {
|
||||
let _ = command
|
||||
.result_tx
|
||||
.send(Err(BackchannelSendError::TransportUnavailable));
|
||||
continue;
|
||||
};
|
||||
let (result_tx, result_rx) = tokio::sync::oneshot::channel();
|
||||
let link_id = command.link_id;
|
||||
let link_command = rns_runtime::link_manager::LinkManagerCommand::SendLinkPayload {
|
||||
@@ -2411,13 +2542,10 @@ impl LxmdRunner {
|
||||
};
|
||||
match command_tx.try_send(link_command) {
|
||||
Ok(()) => {
|
||||
let abandon_tx = self.backchannel_abandon_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = match result_rx.await {
|
||||
Ok(Ok(receipt)) => Ok(backchannel_receipt_from_runtime(receipt)),
|
||||
Ok(Err(err)) => Err(backchannel_error_from_runtime(err)),
|
||||
Err(_) => Err(BackchannelSendError::TransportUnavailable),
|
||||
};
|
||||
let _ = command.result_tx.send(result);
|
||||
let _bridge_slot = bridge_slot;
|
||||
forward_backchannel_receipt(result_rx, command.result_tx, abandon_tx).await;
|
||||
});
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -2849,6 +2977,7 @@ impl LxmdRunner {
|
||||
self.handle_link_delivery_result(result);
|
||||
}
|
||||
}
|
||||
self.drain_core_backchannel_send_commands();
|
||||
|
||||
self.drive_propagation_sync();
|
||||
|
||||
@@ -3334,6 +3463,68 @@ impl LxmdRunner {
|
||||
|
||||
fn handle_delivery_accounting_event(&mut self, event: LinkManagerAccountingEvent) {
|
||||
match event {
|
||||
LinkManagerAccountingEvent::OutboundPacketWait {
|
||||
receipt,
|
||||
started_at,
|
||||
timeout,
|
||||
awaiting_admission,
|
||||
cancellation,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
ld.observe_backchannel_packet_wait(
|
||||
receipt.link_id,
|
||||
receipt.packet_hash,
|
||||
started_at,
|
||||
timeout,
|
||||
awaiting_admission,
|
||||
cancellation,
|
||||
);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::OutboundResourceWait {
|
||||
link_id,
|
||||
resource_id,
|
||||
started_at,
|
||||
timeout,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
ld.observe_backchannel_resource_wait(link_id, resource_id, started_at, timeout);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::ResourceEvent(LinkResourceEvent::Concluded {
|
||||
link_id,
|
||||
resource_id,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
conclusion,
|
||||
}) => {
|
||||
let result = self.link_delivery.as_mut().and_then(|ld| match conclusion {
|
||||
LinkResourceConclusion::Complete => {
|
||||
ld.handle_backchannel_resource_proof(link_id, resource_id)
|
||||
}
|
||||
LinkResourceConclusion::Rejected => ld.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Rejected,
|
||||
"resource rejected",
|
||||
),
|
||||
LinkResourceConclusion::Failed(reason) => ld
|
||||
.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Failed,
|
||||
reason,
|
||||
),
|
||||
LinkResourceConclusion::Cancelled => ld.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Failed,
|
||||
"resource cancelled",
|
||||
),
|
||||
});
|
||||
if let Some(result) = result {
|
||||
self.handle_link_delivery_result(result);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::ResourceEvent(event) => {
|
||||
if let Some(event) = delivery_resource_event_from_runtime(event) {
|
||||
self.router.handle_inbound_resource_event(event);
|
||||
@@ -4352,11 +4543,15 @@ impl LxmdRunner {
|
||||
|
||||
fn ensure_link_delivery(&mut self) {
|
||||
if self.link_delivery.is_none() {
|
||||
self.link_delivery = Some(lxmf_core::link_delivery::LinkDeliveryManager::new(
|
||||
let mut delivery = lxmf_core::link_delivery::LinkDeliveryManager::new(
|
||||
self.transport_tx.clone(),
|
||||
Some(self.identity.get_public_key()),
|
||||
self.identity.get_signing_key(),
|
||||
));
|
||||
);
|
||||
if let Some(handle) = &self.endpoint_dispatch {
|
||||
delivery.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
self.link_delivery = Some(delivery);
|
||||
}
|
||||
self.ensure_backchannel_sender();
|
||||
}
|
||||
@@ -4368,7 +4563,7 @@ impl LxmdRunner {
|
||||
|
||||
let (tx, rx) = mpsc::channel(256);
|
||||
if let Some(ref mut ld) = self.link_delivery {
|
||||
ld.set_backchannel_sender(tx);
|
||||
ld.set_cancellation_aware_backchannel_sender(tx);
|
||||
self.backchannel_command_rx = Some(rx);
|
||||
}
|
||||
}
|
||||
@@ -4712,7 +4907,12 @@ pub(crate) async fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let mut runner = match LxmdRunner::new(daemon_config.clone(), &config_dir, transport_tx) {
|
||||
let mut runner = match LxmdRunner::new(
|
||||
daemon_config.clone(),
|
||||
&config_dir,
|
||||
transport_tx,
|
||||
Some(rns_handle.link_endpoint_dispatch_handle()),
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to initialize LXMF daemon: {e}");
|
||||
@@ -4720,6 +4920,10 @@ pub(crate) async fn main() {
|
||||
}
|
||||
};
|
||||
if let Err(error) = runner.install_announce_subscriptions(&rns_handle).await {
|
||||
if shutdown.is_triggered() {
|
||||
tracing::info!("Startup announce cancelled by shutdown");
|
||||
return;
|
||||
}
|
||||
tracing::error!(%error, "failed to install lxmd announce subscriptions");
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -5140,6 +5344,111 @@ pub(crate) async fn main() {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn backchannel_accounting_retains_exact_windows_and_resource_cancellation() {
|
||||
use rns_crypto::ed25519::Ed25519PrivateKey;
|
||||
use std::time::{Duration, Instant};
|
||||
let unique = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos();
|
||||
let temp = std::env::temp_dir().join(format!(
|
||||
"lxmd-backchannel-accounting-{}-{unique}",
|
||||
std::process::id()
|
||||
));
|
||||
let (tx, _rx) = mpsc::channel(64);
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx, None).unwrap();
|
||||
runner.ensure_link_delivery();
|
||||
let (send_tx, mut send_rx) = mpsc::channel(8);
|
||||
runner
|
||||
.link_delivery
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_backchannel_sender(send_tx);
|
||||
let link_id = [0x61; 16];
|
||||
let dest = [0x62; 16];
|
||||
let resource_hash = [0x63; 32];
|
||||
let mut message = LxMessage::new(
|
||||
dest,
|
||||
[0x64; 16],
|
||||
"accounting",
|
||||
"bounded",
|
||||
DeliveryMethod::Direct,
|
||||
);
|
||||
message.sign(&Ed25519PrivateKey::generate()).unwrap();
|
||||
let hash = message.hash.unwrap();
|
||||
let ld = runner.link_delivery.as_mut().unwrap();
|
||||
ld.register_backchannel(dest, link_id);
|
||||
ld.start_backchannel_delivery(message, dest).unwrap();
|
||||
send_rx
|
||||
.try_recv()
|
||||
.unwrap()
|
||||
.result_tx
|
||||
.send(Ok(BackchannelSendReceipt::Resource {
|
||||
link_id,
|
||||
resource_hash,
|
||||
}))
|
||||
.unwrap();
|
||||
assert!(ld.tick().is_empty());
|
||||
let original = Instant::now() - Duration::from_secs(400);
|
||||
runner.handle_delivery_accounting_event(LinkManagerAccountingEvent::OutboundResourceWait {
|
||||
link_id,
|
||||
resource_id: resource_hash,
|
||||
started_at: original,
|
||||
timeout: Duration::from_secs(800),
|
||||
});
|
||||
let ld = runner.link_delivery.as_mut().unwrap();
|
||||
assert_eq!(
|
||||
ld.message_timeout_window(hash),
|
||||
Some((original, Duration::from_secs(980)))
|
||||
);
|
||||
assert!(ld.tick().is_empty());
|
||||
assert!(ld.cancel_delivery_by_message_hash(hash));
|
||||
let (command_tx, mut command_rx) = mpsc::channel(1);
|
||||
command_tx
|
||||
.try_send(LinkManagerCommand::CancelLinkResource {
|
||||
link_id: [0; 16],
|
||||
resource_id: [0; 32],
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
result_tx: None,
|
||||
})
|
||||
.unwrap();
|
||||
runner.link_command_tx = command_tx;
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert_eq!(runner.pending_backchannel_resource_cancellations.len(), 1);
|
||||
command_rx.try_recv().unwrap();
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert!(
|
||||
matches!(command_rx.try_recv(), Ok(LinkManagerCommand::CancelLinkResource {
|
||||
link_id: observed_link, resource_id, direction: LinkResourceDirection::Outbound, ..
|
||||
}) if observed_link == link_id && resource_id == resource_hash)
|
||||
);
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert!(runner.pending_backchannel_resource_cancellations.is_empty());
|
||||
assert!(command_rx.try_recv().is_err());
|
||||
// A late terminal is reconciled as already cancelled, not retried or
|
||||
// published a second time by the daemon's second notification path.
|
||||
runner.handle_delivery_accounting_event(LinkManagerAccountingEvent::ResourceEvent(
|
||||
LinkResourceEvent::Concluded {
|
||||
link_id,
|
||||
resource_id: resource_hash,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
conclusion: LinkResourceConclusion::Rejected,
|
||||
},
|
||||
));
|
||||
assert_eq!(runner.link_delivery.as_ref().unwrap().pending_count(), 0);
|
||||
assert!(
|
||||
runner
|
||||
.link_delivery
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.message_timeout_window(hash)
|
||||
.is_none()
|
||||
);
|
||||
drop(runner);
|
||||
let _ = std::fs::remove_dir_all(temp);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn propagation_download_auth_uses_live_allowed_identity_set() {
|
||||
let allowed = [0x11; 16];
|
||||
@@ -5489,7 +5798,7 @@ mod tests {
|
||||
enforce_stamps,
|
||||
..Default::default()
|
||||
};
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx, None).expect("runner");
|
||||
let raw = runner.create_announce_packet().expect("delivery announce");
|
||||
let (_, announce) = unpack_announce(&raw);
|
||||
let (_, stamp_cost) = lxmf_core::handlers::parse_announce_app_data(
|
||||
@@ -5734,7 +6043,7 @@ mod tests {
|
||||
stamp_cost: Some(8),
|
||||
..Default::default()
|
||||
};
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx, None).expect("runner");
|
||||
|
||||
let dest = [0xAB; 16];
|
||||
assert_ne!(dest, runner.lxmf_dest_hash);
|
||||
@@ -5784,7 +6093,7 @@ mod tests {
|
||||
std::process::id()
|
||||
));
|
||||
let (tx, _rx) = mpsc::channel::<TransportMessage>(64);
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx, None).expect("runner");
|
||||
|
||||
let deliveries = Arc::new(AtomicUsize::new(0));
|
||||
let observed = Arc::clone(&deliveries);
|
||||
|
||||
@@ -45,6 +45,7 @@ impl ControlCommandKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// Query propagation control with a raw peer hash, or no payload for status.
|
||||
pub async fn query_control(
|
||||
transport_tx: tokio::sync::mpsc::Sender<rns_transport::messages::TransportMessage>,
|
||||
identity: Identity,
|
||||
@@ -59,13 +60,25 @@ pub async fn query_control(
|
||||
target_identity_hash,
|
||||
CONTROL_APP_NAME,
|
||||
path,
|
||||
payload,
|
||||
encode_control_payload(payload),
|
||||
0,
|
||||
Duration::from_secs_f64(timeout_secs.max(0.0)),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
fn encode_control_payload(payload: Vec<u8>) -> Vec<u8> {
|
||||
// LinkClient accepts an encoded MessagePack value. Raw hash bytes can
|
||||
// themselves form a complete value (e.g. 0xaf followed by 15 bytes), so
|
||||
// letting Link infer the type can truncate or reinterpret a peer address.
|
||||
// Python sends a bytes object for sync/unpeer and None for status.
|
||||
encode_value(&if payload.is_empty() {
|
||||
Value::Nil
|
||||
} else {
|
||||
Value::Binary(payload)
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn resolve_remote_identity_hash(
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
remote_destination_hash: [u8; 16],
|
||||
@@ -844,6 +857,37 @@ fn encode_value(value: &Value) -> Vec<u8> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn control_payload_preserves_every_peer_hash_prefix_as_binary() {
|
||||
for prefix in 0..=u8::MAX {
|
||||
let mut hash = vec![0x41; 16];
|
||||
hash[0] = prefix;
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(hash.clone())),
|
||||
Value::Binary(hash),
|
||||
"peer prefix {prefix:#04x} must not select a MessagePack type"
|
||||
);
|
||||
}
|
||||
for hash in [
|
||||
hex::decode("af55b3f0e0b336fdfdbe263c12a688e0").unwrap(),
|
||||
[vec![0xc4, 14], vec![0x41; 14]].concat(),
|
||||
[vec![0x9f], vec![0; 15]].concat(),
|
||||
] {
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(hash.clone())),
|
||||
Value::Binary(hash)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_control_payload_matches_python_status_nil() {
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(Vec::new())),
|
||||
Value::Nil
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn remote_identity_resolution_uses_recall_and_path_request_without_handlers() {
|
||||
use rns_transport::messages::{
|
||||
|
||||
@@ -65,9 +65,11 @@ def check_packages(document: dict[str, object]) -> tuple[str, str]:
|
||||
)
|
||||
|
||||
requirement = reticulum_requirements.pop()
|
||||
if not requirement.startswith("^"):
|
||||
# The project permits breaking core APIs in a minor release; caret ranges
|
||||
# would silently admit the next incompatible minor line.
|
||||
if not re.fullmatch(r"~\d+\.\d+\.\d+", requirement):
|
||||
fail(f"unexpected rsReticulum compatibility requirement {requirement!r}")
|
||||
return str(versions.pop()), requirement.removeprefix("^")
|
||||
return str(versions.pop()), requirement.removeprefix("~")
|
||||
|
||||
|
||||
def check_workflow_actions() -> None:
|
||||
|
||||
+40
-37
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
CONFIG_PATH = ROOT / "api-stability.json"
|
||||
CONFIG_PATH = ROOT / "api" / "stability.json"
|
||||
SHA_PATTERN = re.compile(r"^[0-9a-f]{40}$")
|
||||
HASH_PATTERN = re.compile(r"^[0-9a-f]{64}$")
|
||||
TIERS = {
|
||||
@@ -60,32 +60,41 @@ def load_config() -> dict[str, object]:
|
||||
return config
|
||||
|
||||
|
||||
def validate_change_record(path: str, snapshot_commit: str) -> None:
|
||||
record_path = ROOT / path
|
||||
try:
|
||||
record = json.loads(record_path.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError) as error:
|
||||
fail(f"cannot read snapshot change record {path}: {error}")
|
||||
def validate_snapshot_review(record: object) -> None:
|
||||
if not isinstance(record, dict):
|
||||
fail("snapshot review is missing")
|
||||
required = {
|
||||
"schemaVersion", "snapshotSourceCommit", "capabilities", "classification",
|
||||
"publicApiDiff", "semver", "deprecations", "platformEvidence",
|
||||
"areas",
|
||||
"canonicalPath",
|
||||
"classification",
|
||||
"publicApiDiff",
|
||||
"semver",
|
||||
"deprecations",
|
||||
"wirePersistenceRuntimeImpact",
|
||||
"platformEvidence",
|
||||
}
|
||||
if not required.issubset(record) or record.get("schemaVersion") != 1:
|
||||
fail("snapshot change record is incomplete")
|
||||
if record.get("snapshotSourceCommit") != snapshot_commit:
|
||||
fail("snapshot change record does not match the snapshot source commit")
|
||||
if not isinstance(record.get("capabilities"), list) or not record["capabilities"]:
|
||||
fail("snapshot change record must name capability IDs")
|
||||
if not required.issubset(record):
|
||||
fail("snapshot review is incomplete")
|
||||
if not isinstance(record.get("areas"), list) or not record["areas"]:
|
||||
fail("snapshot review must name the affected API areas")
|
||||
if not all(isinstance(area, str) and area for area in record["areas"]):
|
||||
fail("snapshot review API areas must be non-empty strings")
|
||||
diff = record.get("publicApiDiff")
|
||||
if not isinstance(diff, dict) or set(diff) != {"added", "removed"}:
|
||||
fail("snapshot change record must classify added and removed API lines")
|
||||
fail("snapshot review must classify added and removed API lines")
|
||||
if not all(isinstance(diff[key], int) and diff[key] >= 0 for key in diff):
|
||||
fail("snapshot change record API counts must be non-negative integers")
|
||||
fail("snapshot review API counts must be non-negative integers")
|
||||
if not isinstance(record.get("platformEvidence"), list) or not record["platformEvidence"]:
|
||||
fail("snapshot change record must name platform evidence")
|
||||
for key in ("classification", "semver", "deprecations"):
|
||||
fail("snapshot review must name platform evidence")
|
||||
for key in (
|
||||
"canonicalPath",
|
||||
"classification",
|
||||
"semver",
|
||||
"deprecations",
|
||||
"wirePersistenceRuntimeImpact",
|
||||
):
|
||||
if not isinstance(record.get(key), str) or not record[key]:
|
||||
fail(f"snapshot change record must name {key}")
|
||||
fail(f"snapshot review must name {key}")
|
||||
|
||||
|
||||
def public_packages(manifest_path: str) -> set[str]:
|
||||
@@ -183,10 +192,7 @@ def validate_metadata(
|
||||
)
|
||||
if snapshot_ancestor.returncode != 0:
|
||||
fail(f"snapshot source commit {snapshot_commit} is not an ancestor of HEAD")
|
||||
change_record = snapshot_source.get("changeRecord")
|
||||
if not isinstance(change_record, str) or not change_record.startswith("api-reviews/"):
|
||||
fail("snapshot source must name a reviewed change record")
|
||||
validate_change_record(change_record, snapshot_commit)
|
||||
validate_snapshot_review(snapshot_source.get("review"))
|
||||
|
||||
packages = config.get("packages")
|
||||
if not isinstance(packages, list) or not packages:
|
||||
@@ -209,7 +215,7 @@ def validate_metadata(
|
||||
fail(f"{name} has an unknown stability tier")
|
||||
if package.get("compatibility") != "reviewed-snapshot":
|
||||
fail(f"{name} must use the reviewed-snapshot compatibility policy")
|
||||
if not isinstance(snapshot, str) or not snapshot.startswith("api-baseline/"):
|
||||
if not isinstance(snapshot, str) or not snapshot.startswith("api/snapshots/"):
|
||||
fail(f"{name} has an invalid snapshot path")
|
||||
snapshot_path = ROOT / snapshot
|
||||
if not snapshot_path.is_file() and not updating:
|
||||
@@ -292,29 +298,26 @@ def main() -> None:
|
||||
parser.add_argument("--metadata-only", action="store_true")
|
||||
parser.add_argument("--update", action="store_true")
|
||||
parser.add_argument("--snapshot-source-commit")
|
||||
parser.add_argument("--change-record")
|
||||
args = parser.parse_args()
|
||||
if args.metadata_only and args.update:
|
||||
fail("--metadata-only and --update are mutually exclusive")
|
||||
|
||||
config = load_config()
|
||||
if args.update:
|
||||
if not args.snapshot_source_commit or not args.change_record:
|
||||
fail("--update requires --snapshot-source-commit and --change-record")
|
||||
if not args.snapshot_source_commit:
|
||||
fail("--update requires --snapshot-source-commit")
|
||||
head = run(["git", "rev-parse", "HEAD"]).strip()
|
||||
if args.snapshot_source_commit != head:
|
||||
fail("snapshot source must be the clean source commit at HEAD")
|
||||
if not args.change_record.startswith("api-reviews/"):
|
||||
fail("change record must be stored below api-reviews/")
|
||||
status = run(["git", "status", "--porcelain=v1", "--untracked-files=all"])
|
||||
dirty_paths = {line[3:] for line in status.splitlines() if len(line) > 3}
|
||||
if dirty_paths - {args.change_record}:
|
||||
fail("snapshot source has uncommitted changes outside the review record")
|
||||
config["snapshotSource"] = {
|
||||
"commit": args.snapshot_source_commit,
|
||||
"capturedOn": date.today().isoformat(),
|
||||
"changeRecord": args.change_record,
|
||||
}
|
||||
if dirty_paths - {"api/stability.json"}:
|
||||
fail("snapshot source has uncommitted changes outside api/stability.json")
|
||||
snapshot_source = config.get("snapshotSource")
|
||||
if not isinstance(snapshot_source, dict):
|
||||
fail("snapshot source identity is missing")
|
||||
snapshot_source["commit"] = args.snapshot_source_commit
|
||||
snapshot_source["capturedOn"] = date.today().isoformat()
|
||||
packages = validate_metadata(config, updating=args.update)
|
||||
if args.metadata_only:
|
||||
print("api baseline metadata: ok")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Reject removals from the immutable Wave C public-API compatibility floor."""
|
||||
"""Reject removals from the reviewed public-API compatibility floor."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -10,7 +10,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
LEDGER_PATH = ROOT / "api-stability.json"
|
||||
LEDGER_PATH = ROOT / "api" / "stability.json"
|
||||
|
||||
|
||||
def fail(message: str) -> None:
|
||||
@@ -32,21 +32,41 @@ def git_show(commit: str, path: str) -> str:
|
||||
return result.stdout
|
||||
|
||||
|
||||
def load_floor_ledger(commit: str) -> dict[str, object]:
|
||||
for path in ("api/stability.json", "api-stability.json"):
|
||||
result = subprocess.run(
|
||||
["git", "show", f"{commit}:{path}"],
|
||||
cwd=ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return json.loads(result.stdout)
|
||||
fail(f"cannot read API ledger at compatibility floor {commit}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
metadata = subprocess.run(
|
||||
[sys.executable, "tools/check-api-baseline.py", "--metadata-only"], cwd=ROOT
|
||||
)
|
||||
if metadata.returncode != 0:
|
||||
fail("snapshot metadata or reviewed change record is invalid")
|
||||
fail("snapshot metadata or review is invalid")
|
||||
ledger = json.loads(LEDGER_PATH.read_text(encoding="utf-8"))
|
||||
floor = ledger.get("compatibilityFloor", {}).get("evidenceCommit")
|
||||
if not isinstance(floor, str):
|
||||
fail("api-stability.json has no compatibility-floor commit")
|
||||
fail("api/stability.json has no compatibility-floor commit")
|
||||
floor_ledger = load_floor_ledger(floor)
|
||||
floor_snapshots = {
|
||||
package["name"]: package["snapshot"] for package in floor_ledger["packages"]
|
||||
}
|
||||
total_added = 0
|
||||
total_removed = 0
|
||||
for package in ledger["packages"]:
|
||||
path = package["snapshot"]
|
||||
before = set(git_show(floor, path).splitlines())
|
||||
floor_path = floor_snapshots.get(package["name"])
|
||||
if not isinstance(floor_path, str):
|
||||
fail(f"{package['name']} is absent from the compatibility floor")
|
||||
before = set(git_show(floor, floor_path).splitlines())
|
||||
after = set((ROOT / path).read_text(encoding="utf-8").splitlines())
|
||||
added = sorted(after - before)
|
||||
removed = sorted(before - after)
|
||||
@@ -58,17 +78,15 @@ def main() -> None:
|
||||
print(f"- {line}", file=sys.stderr)
|
||||
if total_removed:
|
||||
fail(
|
||||
f"{total_removed} public API lines were removed from the Wave C floor; "
|
||||
f"{total_removed} public API lines were removed from the compatibility floor; "
|
||||
"the current policy permits additions only"
|
||||
)
|
||||
change_record = json.loads(
|
||||
(ROOT / ledger["snapshotSource"]["changeRecord"]).read_text(encoding="utf-8")
|
||||
)
|
||||
if change_record["publicApiDiff"] != {
|
||||
review = ledger["snapshotSource"]["review"]
|
||||
if review["publicApiDiff"] != {
|
||||
"added": total_added,
|
||||
"removed": total_removed,
|
||||
}:
|
||||
fail("reviewed change record does not match the measured API diff")
|
||||
fail("snapshot review does not match the measured API diff")
|
||||
print(f"api compatibility: additive-only (+{total_added}, -0)")
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
LEDGER_PATH = ROOT / "api-stability.json"
|
||||
CONTRACT_PATH = ROOT / "api-baseline" / "manifest-contract.json"
|
||||
LEDGER_PATH = ROOT / "api" / "stability.json"
|
||||
CONTRACT_PATH = ROOT / "api" / "snapshots" / "manifest-contract.json"
|
||||
|
||||
|
||||
def fail(message: str) -> None:
|
||||
|
||||
Reference in new issue
Block a user