mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-22 23:10:33 +00:00
api: organize compatibility evidence
This commit is contained in:
1 parent
dc6bc4ee82
commit
e0889f7188
25 files changed
+191
-215
No files matched your search
@@ -35,8 +35,8 @@ jobs:
|
|||||||
run: python3 tools/check-api-compatibility.py
|
run: python3 tools/check-api-compatibility.py
|
||||||
- name: Check canonical and legacy external consumer
|
- name: Check canonical and legacy external consumer
|
||||||
run: |
|
run: |
|
||||||
cargo check --manifest-path api-fixtures/Cargo.toml --locked
|
cargo check --manifest-path api/fixtures/Cargo.toml --locked
|
||||||
cargo check --manifest-path api-fixtures/Cargo.toml --all-features --locked
|
cargo check --manifest-path api/fixtures/Cargo.toml --all-features --locked
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test (${{ matrix.os }})
|
name: Test (${{ matrix.os }})
|
||||||
|
|||||||
+1
-1
@@ -9,4 +9,4 @@ proptest-regressions/
|
|||||||
/tools/*
|
/tools/*
|
||||||
!/tools/check-api-manifest.py
|
!/tools/check-api-manifest.py
|
||||||
!/tools/check-api-compatibility.py
|
!/tools/check-api-compatibility.py
|
||||||
/api-fixtures/target/
|
/api/fixtures/target/
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
# API stability
|
|
||||||
|
|
||||||
rsReticulum is currently distributed as source with `publish = false`. Its
|
|
||||||
package versions describe protocol/source compatibility; they do not mean that
|
|
||||||
every reachable Rust item is already a permanent stable API.
|
|
||||||
|
|
||||||
`api-stability.json` is the machine-readable package ledger. The corresponding
|
|
||||||
`api-baseline/*.txt` files record every explicit public item visible with all
|
|
||||||
features on the canonical Apple ARM64 rustdoc target. CI regenerates those
|
|
||||||
snapshots with exact `cargo-public-api` and nightly versions. A diff is a review
|
|
||||||
barrier, not an automatic verdict: additions, removals, and signature changes
|
|
||||||
must be classified before a snapshot is deliberately updated.
|
|
||||||
|
|
||||||
## Tiers
|
|
||||||
|
|
||||||
- **Candidate stable:** intended protocol or integration surface, but not yet a
|
|
||||||
final SemVer promise. Compatibility is the default while boundaries are
|
|
||||||
curated.
|
|
||||||
- **Provisional:** externally reachable low-level or mixed surface. Consumers
|
|
||||||
may use it, but boundary work and a migration decision are still required.
|
|
||||||
- **Experimental:** incomplete or optional surface that may change with an
|
|
||||||
explicit version and changelog decision.
|
|
||||||
- **Tool internal:** support code for repository binaries, not a library API
|
|
||||||
commitment.
|
|
||||||
|
|
||||||
The package ledger currently classifies `rns-identity`, `rns-link`,
|
|
||||||
`rns-protocol`, and `rns-interface` as candidate stable. `rns-crypto`,
|
|
||||||
`rns-wire`, and `rns-transport` remain provisional low-level packages.
|
|
||||||
`rns-runtime` is also provisional because it mixes the intended application
|
|
||||||
facade (`rns_runtime::prelude`, lifecycle handles, destination resolution, and
|
|
||||||
Link sessions) with broad actor, RPC, manager, and command modules. `rns-ratkey`
|
|
||||||
is experimental, and the `rns-tools` library target is tool internal.
|
|
||||||
|
|
||||||
The existing [`rns_runtime::prelude`](APPLICATION_API.md) is the canonical
|
|
||||||
application spine. It re-exports the original type identities, and all current
|
|
||||||
module-qualified paths remain supported. Actor, mailbox, RPC, transport-table,
|
|
||||||
concrete-driver, and endpoint-ownership modules remain provisional SPI; their
|
|
||||||
reachability in a snapshot does not promote them.
|
|
||||||
|
|
||||||
No existing module is hidden, moved, or made private by this baseline. That
|
|
||||||
work requires the next explicit API-boundary checkpoint, downstream migration
|
|
||||||
evidence from rsLXMF/rsLXST/Ratspeak, and a versioning decision.
|
|
||||||
|
|
||||||
## Baseline scope and use
|
|
||||||
|
|
||||||
The canonical snapshot is all-features `aarch64-apple-darwin`. It intentionally
|
|
||||||
omits auto-derived, auto-trait, and blanket implementations to keep diffs
|
|
||||||
reviewable. Target-only Linux, Android, and Windows overlays remain protected
|
|
||||||
by their existing compile, package, and integration gates; they are not yet a
|
|
||||||
stable cross-target Rust API promise.
|
|
||||||
|
|
||||||
To verify the baseline:
|
|
||||||
|
|
||||||
```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
|
|
||||||
cargo check --manifest-path api-fixtures/Cargo.toml --all-features --locked
|
|
||||||
```
|
|
||||||
|
|
||||||
The immutable floor and current captured snapshot source are separate
|
|
||||||
identities in `api-stability.json`. The compatibility check currently enforces
|
|
||||||
an additions-only Wave C policy. Snapshot equality remains only one layer of
|
|
||||||
SemVer evidence: feature/cfg contracts, external fixtures, platform builds,
|
|
||||||
and behavioral tests remain mandatory.
|
|
||||||
|
|
||||||
Use `--update` only after reviewing the generated API diff and recording the
|
|
||||||
compatibility/version decision. Snapshot updates do not by themselves make a
|
|
||||||
breaking change acceptable.
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
# Reticulum application API
|
|
||||||
|
|
||||||
`rns_runtime::prelude` is the canonical application-facing import path for an
|
|
||||||
owned Reticulum runtime. It gathers existing identities from the protocol,
|
|
||||||
identity, Link, interface, and runtime crates; it does not wrap or replace
|
|
||||||
them. Module-qualified paths remain supported.
|
|
||||||
|
|
||||||
The compiled examples under `crates/rns-runtime/examples/` are the executable
|
|
||||||
application guide. They cover runtime startup and shutdown, Destinations,
|
|
||||||
announces, packets and receipts, persistent Links, requests, Channels, Buffer
|
|
||||||
streams, Resources, and RNode observation.
|
|
||||||
|
|
||||||
```rust
|
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::atomic::AtomicBool;
|
|
||||||
|
|
||||||
use rns_runtime::prelude::*;
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() -> Result<(), ReticulumError> {
|
|
||||||
let shutdown = ShutdownSignal::new();
|
|
||||||
let runtime = init(
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
shutdown,
|
|
||||||
Arc::new(AtomicBool::new(true)),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
let identity = Identity::new();
|
|
||||||
|
|
||||||
// Application work owns `runtime`; shutdown is explicit and awaitable.
|
|
||||||
runtime.shutdown_and_wait().await;
|
|
||||||
drop(identity);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Finite destination discovery uses `resolve_destination_on_transport` with one
|
|
||||||
deadline and validated identity recall. Long-lived observation uses
|
|
||||||
`ReticulumHandle::subscribe_announces`, whose returned
|
|
||||||
`AnnounceSubscription` owns exactly one registration. A finite lookup never
|
|
||||||
installs or removes an announce handler.
|
|
||||||
|
|
||||||
The prelude is intentionally not a blanket stability promise. Low-level actor,
|
|
||||||
mailbox, RPC, transport-table, concrete-driver, and Link endpoint ownership
|
|
||||||
paths remain provisional SPI. Advanced integrations may continue using those
|
|
||||||
module-qualified paths, but application code should start with the prelude and
|
|
||||||
the compiled examples.
|
|
||||||
|
|
||||||
Compatibility is checked in layers:
|
|
||||||
|
|
||||||
- `api-baseline/*.txt` records the explicit all-feature Apple ARM64 surface;
|
|
||||||
- `api-baseline/manifest-contract.json` records features, targets, MSRV, and
|
|
||||||
non-development dependencies;
|
|
||||||
- `api-fixtures` compiles canonical and retained legacy imports as an external
|
|
||||||
consumer; and
|
|
||||||
- `tools/check-api-compatibility.py` rejects removals from the immutable Wave C
|
|
||||||
floor.
|
|
||||||
|
|
||||||
These checks complement platform builds and protocol/interoperability tests;
|
|
||||||
they do not replace them.
|
|
||||||
@@ -30,7 +30,7 @@ rsReticulum can live beside other Reticulum tools on `PATH` without worry.
|
|||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
- [Build It](#build-it)
|
- [Build It](#build-it)
|
||||||
- [Application API](APPLICATION_API.md)
|
- [Rust API](api/README.md)
|
||||||
- [Tool Usage](#tool-usage)
|
- [Tool Usage](#tool-usage)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Interface Support](#interface-support)
|
- [Interface Support](#interface-support)
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"snapshotSourceCommit": "51763a97dcd3d348ce3e3c44c86da089cc895ea6",
|
|
||||||
"capabilities": ["RET-01", "RET-02", "RET-03", "RET-04", "RET-05", "RET-06", "RET-07", "RET-08", "RET-09", "RET-11"],
|
|
||||||
"canonicalPath": "rns_runtime::prelude",
|
|
||||||
"classification": "existing candidate application prelude",
|
|
||||||
"publicApiDiff": {"added": 0, "removed": 0},
|
|
||||||
"semver": "no version consequence; documentation, fixtures, and compatibility tooling only",
|
|
||||||
"deprecations": "none",
|
|
||||||
"wirePersistenceRuntimeImpact": "none",
|
|
||||||
"platformEvidence": [
|
|
||||||
"compiled application examples and external canonical/legacy fixture",
|
|
||||||
"stable and Rust 1.87 strict Clippy",
|
|
||||||
"downstream desktop and mobile product gates"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# Rust API
|
||||||
|
|
||||||
|
Application code should begin with `rns_runtime::prelude`. It collects the
|
||||||
|
runtime handle and the commonly used identity, destination, packet, Link,
|
||||||
|
request, Channel, Resource, interface, and shutdown types without wrapping or
|
||||||
|
replacing them. Existing module-qualified imports remain supported.
|
||||||
|
|
||||||
|
The examples in `crates/rns-runtime/examples/` are compiled as part of CI and
|
||||||
|
show complete flows for runtime startup, Destinations, announces, receipts,
|
||||||
|
Links, requests, Channels, Buffer streams, Resources, and RNode observation.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::sync::atomic::AtomicBool;
|
||||||
|
|
||||||
|
use rns_runtime::prelude::*;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), ReticulumError> {
|
||||||
|
let runtime = init(
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
ShutdownSignal::new(),
|
||||||
|
Arc::new(AtomicBool::new(true)),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let identity = Identity::new();
|
||||||
|
// Use `runtime` and `identity` to create application Destinations.
|
||||||
|
|
||||||
|
runtime.shutdown_and_wait().await;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Finite destination discovery uses `resolve_destination_on_transport` with one
|
||||||
|
deadline and validated identity recall. Long-lived announce observation uses
|
||||||
|
`ReticulumHandle::subscribe_announces`; the returned `AnnounceSubscription`
|
||||||
|
owns exactly one registration. Finite lookups do not install or remove
|
||||||
|
announce handlers.
|
||||||
|
|
||||||
|
## Stability
|
||||||
|
|
||||||
|
The application prelude is the recommended integration path, but the workspace
|
||||||
|
is not yet a blanket stability promise for every public Rust item.
|
||||||
|
|
||||||
|
- `rns-identity`, `rns-link`, `rns-protocol`, and `rns-interface` are candidate
|
||||||
|
stable.
|
||||||
|
- `rns-crypto`, `rns-wire`, and `rns-transport` are provisional low-level
|
||||||
|
packages.
|
||||||
|
- `rns-runtime` is provisional because it contains both the application
|
||||||
|
prelude and lower-level actor, RPC, manager, and command APIs.
|
||||||
|
- `rns-ratkey` is experimental, and the `rns-tools` library target supports the
|
||||||
|
repository's binaries rather than a public library integration.
|
||||||
|
|
||||||
|
Low-level actor, mailbox, RPC, transport-table, concrete-driver, and Link
|
||||||
|
endpoint ownership APIs remain available for compatibility. They should not be
|
||||||
|
treated as stable merely because they are publicly reachable.
|
||||||
|
|
||||||
|
## 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 import paths as an external
|
||||||
|
consumer.
|
||||||
|
|
||||||
|
These checks catch accidental changes, but they do not replace platform builds,
|
||||||
|
protocol interoperability tests, or manual review. In particular, 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
|
||||||
|
cargo check --manifest-path api/fixtures/Cargo.toml --all-features --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.
|
||||||
File renamed without changes.
@@ -11,4 +11,4 @@ default = []
|
|||||||
all = ["rns-runtime/ble", "rns-runtime/rnode-tcp", "rns-runtime/serial"]
|
all = ["rns-runtime/ble", "rns-runtime/rnode-tcp", "rns-runtime/serial"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rns-runtime = { path = "../crates/rns-runtime", default-features = false }
|
rns-runtime = { path = "../../crates/rns-runtime", default-features = false }
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,29 @@
|
|||||||
"snapshotSource": {
|
"snapshotSource": {
|
||||||
"commit": "51763a97dcd3d348ce3e3c44c86da089cc895ea6",
|
"commit": "51763a97dcd3d348ce3e3c44c86da089cc895ea6",
|
||||||
"capturedOn": "2026-08-17",
|
"capturedOn": "2026-08-17",
|
||||||
"changeRecord": "api-reviews/wave-c-application-prelude.json"
|
"review": {
|
||||||
|
"areas": [
|
||||||
|
"runtime application facade",
|
||||||
|
"identity and destination construction",
|
||||||
|
"announces and destination resolution",
|
||||||
|
"packets, receipts, Links, requests, Channels, and Resources",
|
||||||
|
"interface lifecycle and RNode observation"
|
||||||
|
],
|
||||||
|
"canonicalPath": "rns_runtime::prelude",
|
||||||
|
"classification": "existing candidate application facade",
|
||||||
|
"publicApiDiff": {
|
||||||
|
"added": 0,
|
||||||
|
"removed": 0
|
||||||
|
},
|
||||||
|
"semver": "no version consequence; documentation, fixtures, and compatibility tooling only",
|
||||||
|
"deprecations": "none",
|
||||||
|
"wirePersistenceRuntimeImpact": "none",
|
||||||
|
"platformEvidence": [
|
||||||
|
"compiled application examples and external canonical and legacy fixtures",
|
||||||
|
"stable and Rust 1.87 strict Clippy",
|
||||||
|
"downstream desktop and mobile product gates"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
@@ -29,7 +51,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "provisional",
|
"tier": "provisional",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-crypto.txt",
|
"snapshot": "api/snapshots/rns-crypto.txt",
|
||||||
"itemCount": 91,
|
"itemCount": 91,
|
||||||
"sha256": "4d1e3c0a13e48a84f2510c6586024b3d8f5781b367459bc17d714ca485f1aa63"
|
"sha256": "4d1e3c0a13e48a84f2510c6586024b3d8f5781b367459bc17d714ca485f1aa63"
|
||||||
},
|
},
|
||||||
@@ -38,7 +60,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "provisional",
|
"tier": "provisional",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-wire.txt",
|
"snapshot": "api/snapshots/rns-wire.txt",
|
||||||
"itemCount": 369,
|
"itemCount": 369,
|
||||||
"sha256": "e82cf03eeed3f13ccde7fda8d87e58de0a9403a98860f8c576d84922ef2336c9"
|
"sha256": "e82cf03eeed3f13ccde7fda8d87e58de0a9403a98860f8c576d84922ef2336c9"
|
||||||
},
|
},
|
||||||
@@ -47,7 +69,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "candidate-stable",
|
"tier": "candidate-stable",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-identity.txt",
|
"snapshot": "api/snapshots/rns-identity.txt",
|
||||||
"itemCount": 374,
|
"itemCount": 374,
|
||||||
"sha256": "f2b692070a3fa1a2cc98edbb40bc75d205daadfa9da9d9994ee194e8436e00c9"
|
"sha256": "f2b692070a3fa1a2cc98edbb40bc75d205daadfa9da9d9994ee194e8436e00c9"
|
||||||
},
|
},
|
||||||
@@ -56,7 +78,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "provisional",
|
"tier": "provisional",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-transport.txt",
|
"snapshot": "api/snapshots/rns-transport.txt",
|
||||||
"itemCount": 1574,
|
"itemCount": 1574,
|
||||||
"sha256": "d4377c893fe8a140a6c3d154f4a4f1004756856ccf462127c8bcc7c096b406ec"
|
"sha256": "d4377c893fe8a140a6c3d154f4a4f1004756856ccf462127c8bcc7c096b406ec"
|
||||||
},
|
},
|
||||||
@@ -65,7 +87,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "candidate-stable",
|
"tier": "candidate-stable",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-link.txt",
|
"snapshot": "api/snapshots/rns-link.txt",
|
||||||
"itemCount": 358,
|
"itemCount": 358,
|
||||||
"sha256": "9fe7901e33a3c5b4adc6492751187cdb48cd31f564a425a249d6f8831319b3ca"
|
"sha256": "9fe7901e33a3c5b4adc6492751187cdb48cd31f564a425a249d6f8831319b3ca"
|
||||||
},
|
},
|
||||||
@@ -74,7 +96,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "candidate-stable",
|
"tier": "candidate-stable",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-protocol.txt",
|
"snapshot": "api/snapshots/rns-protocol.txt",
|
||||||
"itemCount": 623,
|
"itemCount": 623,
|
||||||
"sha256": "fc12a8e4a0b457f2391308573c194b4633a2041d10ec9ae03247491b5b162aa1"
|
"sha256": "fc12a8e4a0b457f2391308573c194b4633a2041d10ec9ae03247491b5b162aa1"
|
||||||
},
|
},
|
||||||
@@ -83,7 +105,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "candidate-stable",
|
"tier": "candidate-stable",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-interface.txt",
|
"snapshot": "api/snapshots/rns-interface.txt",
|
||||||
"itemCount": 1405,
|
"itemCount": 1405,
|
||||||
"sha256": "362144086c716b98383543912e7bed1e8281709de07957aeb89af1c40eb371e7"
|
"sha256": "362144086c716b98383543912e7bed1e8281709de07957aeb89af1c40eb371e7"
|
||||||
},
|
},
|
||||||
@@ -92,7 +114,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "provisional",
|
"tier": "provisional",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-runtime.txt",
|
"snapshot": "api/snapshots/rns-runtime.txt",
|
||||||
"itemCount": 1994,
|
"itemCount": 1994,
|
||||||
"sha256": "8bcad2034f13b8edd6fa0d3583988674765eb0b12ff9ec6b6863f72f2f18cf6c"
|
"sha256": "8bcad2034f13b8edd6fa0d3583988674765eb0b12ff9ec6b6863f72f2f18cf6c"
|
||||||
},
|
},
|
||||||
@@ -101,7 +123,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "tool-internal",
|
"tier": "tool-internal",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-tools.txt",
|
"snapshot": "api/snapshots/rns-tools.txt",
|
||||||
"itemCount": 15,
|
"itemCount": 15,
|
||||||
"sha256": "662566afbf8a21928529a33dcec4a23b0a4686e9b2d94a7721b111738a5b4a6b"
|
"sha256": "662566afbf8a21928529a33dcec4a23b0a4686e9b2d94a7721b111738a5b4a6b"
|
||||||
},
|
},
|
||||||
@@ -110,7 +132,7 @@
|
|||||||
"manifestPath": "Cargo.toml",
|
"manifestPath": "Cargo.toml",
|
||||||
"tier": "experimental",
|
"tier": "experimental",
|
||||||
"compatibility": "reviewed-snapshot",
|
"compatibility": "reviewed-snapshot",
|
||||||
"snapshot": "api-baseline/rns-ratkey.txt",
|
"snapshot": "api/snapshots/rns-ratkey.txt",
|
||||||
"itemCount": 618,
|
"itemCount": 618,
|
||||||
"sha256": "f2ab796d37f18d7d5d7a515e4b6c28900f6f1c214aec4142fed069275793fdfd"
|
"sha256": "f2ab796d37f18d7d5d7a515e4b6c28900f6f1c214aec4142fed069275793fdfd"
|
||||||
}
|
}
|
||||||
+35
-38
@@ -16,7 +16,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
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}$")
|
SHA_PATTERN = re.compile(r"^[0-9a-f]{40}$")
|
||||||
HASH_PATTERN = re.compile(r"^[0-9a-f]{64}$")
|
HASH_PATTERN = re.compile(r"^[0-9a-f]{64}$")
|
||||||
TIERS = {
|
TIERS = {
|
||||||
@@ -60,38 +60,41 @@ def load_config() -> dict[str, object]:
|
|||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def validate_change_record(path: str, snapshot_commit: str) -> None:
|
def validate_snapshot_review(record: object) -> None:
|
||||||
record_path = ROOT / path
|
if not isinstance(record, dict):
|
||||||
try:
|
fail("snapshot review is missing")
|
||||||
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}")
|
|
||||||
required = {
|
required = {
|
||||||
"schemaVersion",
|
"areas",
|
||||||
"snapshotSourceCommit",
|
"canonicalPath",
|
||||||
"capabilities",
|
|
||||||
"classification",
|
"classification",
|
||||||
"publicApiDiff",
|
"publicApiDiff",
|
||||||
"semver",
|
"semver",
|
||||||
"deprecations",
|
"deprecations",
|
||||||
|
"wirePersistenceRuntimeImpact",
|
||||||
"platformEvidence",
|
"platformEvidence",
|
||||||
}
|
}
|
||||||
if not required.issubset(record) or record.get("schemaVersion") != 1:
|
if not required.issubset(record):
|
||||||
fail("snapshot change record is incomplete")
|
fail("snapshot review is incomplete")
|
||||||
if record.get("snapshotSourceCommit") != snapshot_commit:
|
if not isinstance(record.get("areas"), list) or not record["areas"]:
|
||||||
fail("snapshot change record does not match the snapshot source commit")
|
fail("snapshot review must name the affected API areas")
|
||||||
if not isinstance(record.get("capabilities"), list) or not record["capabilities"]:
|
if not all(isinstance(area, str) and area for area in record["areas"]):
|
||||||
fail("snapshot change record must name capability IDs")
|
fail("snapshot review API areas must be non-empty strings")
|
||||||
diff = record.get("publicApiDiff")
|
diff = record.get("publicApiDiff")
|
||||||
if not isinstance(diff, dict) or set(diff) != {"added", "removed"}:
|
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):
|
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"]:
|
if not isinstance(record.get("platformEvidence"), list) or not record["platformEvidence"]:
|
||||||
fail("snapshot change record must name platform evidence")
|
fail("snapshot review must name platform evidence")
|
||||||
for key in ("classification", "semver", "deprecations"):
|
for key in (
|
||||||
|
"canonicalPath",
|
||||||
|
"classification",
|
||||||
|
"semver",
|
||||||
|
"deprecations",
|
||||||
|
"wirePersistenceRuntimeImpact",
|
||||||
|
):
|
||||||
if not isinstance(record.get(key), str) or not record[key]:
|
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]:
|
def public_packages(manifest_path: str) -> set[str]:
|
||||||
@@ -189,10 +192,7 @@ def validate_metadata(
|
|||||||
)
|
)
|
||||||
if snapshot_ancestor.returncode != 0:
|
if snapshot_ancestor.returncode != 0:
|
||||||
fail(f"snapshot source commit {snapshot_commit} is not an ancestor of HEAD")
|
fail(f"snapshot source commit {snapshot_commit} is not an ancestor of HEAD")
|
||||||
change_record = snapshot_source.get("changeRecord")
|
validate_snapshot_review(snapshot_source.get("review"))
|
||||||
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)
|
|
||||||
|
|
||||||
packages = config.get("packages")
|
packages = config.get("packages")
|
||||||
if not isinstance(packages, list) or not packages:
|
if not isinstance(packages, list) or not packages:
|
||||||
@@ -215,7 +215,7 @@ def validate_metadata(
|
|||||||
fail(f"{name} has an unknown stability tier")
|
fail(f"{name} has an unknown stability tier")
|
||||||
if package.get("compatibility") != "reviewed-snapshot":
|
if package.get("compatibility") != "reviewed-snapshot":
|
||||||
fail(f"{name} must use the reviewed-snapshot compatibility policy")
|
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")
|
fail(f"{name} has an invalid snapshot path")
|
||||||
snapshot_path = ROOT / snapshot
|
snapshot_path = ROOT / snapshot
|
||||||
if not snapshot_path.is_file() and not updating:
|
if not snapshot_path.is_file() and not updating:
|
||||||
@@ -298,29 +298,26 @@ def main() -> None:
|
|||||||
parser.add_argument("--metadata-only", action="store_true")
|
parser.add_argument("--metadata-only", action="store_true")
|
||||||
parser.add_argument("--update", action="store_true")
|
parser.add_argument("--update", action="store_true")
|
||||||
parser.add_argument("--snapshot-source-commit")
|
parser.add_argument("--snapshot-source-commit")
|
||||||
parser.add_argument("--change-record")
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.metadata_only and args.update:
|
if args.metadata_only and args.update:
|
||||||
fail("--metadata-only and --update are mutually exclusive")
|
fail("--metadata-only and --update are mutually exclusive")
|
||||||
|
|
||||||
config = load_config()
|
config = load_config()
|
||||||
if args.update:
|
if args.update:
|
||||||
if not args.snapshot_source_commit or not args.change_record:
|
if not args.snapshot_source_commit:
|
||||||
fail("--update requires --snapshot-source-commit and --change-record")
|
fail("--update requires --snapshot-source-commit")
|
||||||
head = run(["git", "rev-parse", "HEAD"]).strip()
|
head = run(["git", "rev-parse", "HEAD"]).strip()
|
||||||
if args.snapshot_source_commit != head:
|
if args.snapshot_source_commit != head:
|
||||||
fail("snapshot source must be the clean source commit at 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"])
|
status = run(["git", "status", "--porcelain=v1", "--untracked-files=all"])
|
||||||
dirty_paths = {line[3:] for line in status.splitlines() if len(line) > 3}
|
dirty_paths = {line[3:] for line in status.splitlines() if len(line) > 3}
|
||||||
if dirty_paths - {args.change_record}:
|
if dirty_paths - {"api/stability.json"}:
|
||||||
fail("snapshot source has uncommitted changes outside the review record")
|
fail("snapshot source has uncommitted changes outside api/stability.json")
|
||||||
config["snapshotSource"] = {
|
snapshot_source = config.get("snapshotSource")
|
||||||
"commit": args.snapshot_source_commit,
|
if not isinstance(snapshot_source, dict):
|
||||||
"capturedOn": date.today().isoformat(),
|
fail("snapshot source identity is missing")
|
||||||
"changeRecord": args.change_record,
|
snapshot_source["commit"] = args.snapshot_source_commit
|
||||||
}
|
snapshot_source["capturedOn"] = date.today().isoformat()
|
||||||
packages = validate_metadata(config, updating=args.update)
|
packages = validate_metadata(config, updating=args.update)
|
||||||
if args.metadata_only:
|
if args.metadata_only:
|
||||||
print("api baseline metadata: ok")
|
print("api baseline metadata: ok")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
LEDGER_PATH = ROOT / "api-stability.json"
|
LEDGER_PATH = ROOT / "api" / "stability.json"
|
||||||
|
|
||||||
|
|
||||||
def fail(message: str) -> None:
|
def fail(message: str) -> None:
|
||||||
@@ -32,6 +32,19 @@ def git_show(commit: str, path: str) -> str:
|
|||||||
return result.stdout
|
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:
|
def main() -> None:
|
||||||
metadata = subprocess.run(
|
metadata = subprocess.run(
|
||||||
[sys.executable, "tools/check-api-baseline.py", "--metadata-only"], cwd=ROOT
|
[sys.executable, "tools/check-api-baseline.py", "--metadata-only"], cwd=ROOT
|
||||||
@@ -41,12 +54,19 @@ def main() -> None:
|
|||||||
ledger = json.loads(LEDGER_PATH.read_text(encoding="utf-8"))
|
ledger = json.loads(LEDGER_PATH.read_text(encoding="utf-8"))
|
||||||
floor = ledger.get("compatibilityFloor", {}).get("evidenceCommit")
|
floor = ledger.get("compatibilityFloor", {}).get("evidenceCommit")
|
||||||
if not isinstance(floor, str):
|
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_added = 0
|
||||||
total_removed = 0
|
total_removed = 0
|
||||||
for package in ledger["packages"]:
|
for package in ledger["packages"]:
|
||||||
path = package["snapshot"]
|
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())
|
after = set((ROOT / path).read_text(encoding="utf-8").splitlines())
|
||||||
added = sorted(after - before)
|
added = sorted(after - before)
|
||||||
removed = sorted(before - after)
|
removed = sorted(before - after)
|
||||||
@@ -58,17 +78,15 @@ def main() -> None:
|
|||||||
print(f"- {line}", file=sys.stderr)
|
print(f"- {line}", file=sys.stderr)
|
||||||
if total_removed:
|
if total_removed:
|
||||||
fail(
|
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"
|
"the current policy permits additions only"
|
||||||
)
|
)
|
||||||
change_record = json.loads(
|
review = ledger["snapshotSource"]["review"]
|
||||||
(ROOT / ledger["snapshotSource"]["changeRecord"]).read_text(encoding="utf-8")
|
if review["publicApiDiff"] != {
|
||||||
)
|
|
||||||
if change_record["publicApiDiff"] != {
|
|
||||||
"added": total_added,
|
"added": total_added,
|
||||||
"removed": total_removed,
|
"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)")
|
print(f"api compatibility: additive-only (+{total_added}, -0)")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
LEDGER_PATH = ROOT / "api-stability.json"
|
LEDGER_PATH = ROOT / "api" / "stability.json"
|
||||||
CONTRACT_PATH = ROOT / "api-baseline" / "manifest-contract.json"
|
CONTRACT_PATH = ROOT / "api" / "snapshots" / "manifest-contract.json"
|
||||||
|
|
||||||
|
|
||||||
def fail(message: str) -> None:
|
def fail(message: str) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user