mediation 0.1.0

Telecom usage mediation domain library โ€” 3GPP CDR local-time-plus-offset arithmetic (quarter-hour offsets, DST-adjusted), integer octet volumes, validated identifiers (IMSI/MSISDN/IMEI/ICCID/SUPI/GPSI/PEI, PLMN, TADIG), natural-key deduplication, RFC 1982 wrap-aware sequence-gap detection, partial-record reassembly, cross-node correlation, signed restatement, a numbered validation catalogue, a conservation law that spans batches, TBCD/BCD wire codecs, a zero-copy BER reader, usage aggregation, roaming-batch reconciliation, longest-prefix number ranges with portability, User Location Information (CGI/SAI/ECGI/NCGI/TAI), conserving tariff-band apportionment, two-question jurisdiction determination and an EU/German regulatory layer. Zero I/O, no async, no clock, exact integer quantities.
Documentation
# mediation โ€” task runner (https://just.systems)
#
# `just` with no arguments lists every recipe.

set shell := ["bash", "-uc"]

# MSRV โ€” keep in sync with `rust-version` in Cargo.toml and rust-toolchain.toml.
msrv := "1.94"

# ๐Ÿ“‹ List all recipes
default:
    @just --list

# โœ… Everything CI runs, in CI order
ci: fmt-check lint purity test doc package
    @echo "โœ… all checks passed"

# ๐ŸงŠ Enforce the "zero I/O, no clock" guarantee over non-comment source lines
purity:
    #!/usr/bin/env bash
    set -uo pipefail
    hits="$(grep -rn --include='*.rs' -E \
        'now_utc|SystemTime::now|Instant::now|std::(fs|env|process)|std::net::(Tcp|Udp|SocketAddr|ToSocketAddrs)|\bunsafe\b' \
        src/ | grep -vE ':[[:space:]]*(///|//!|//)' || true)"
    if [ -n "$hits" ]; then
        echo "โŒ ambient state or unsafe reached the source:" >&2
        echo "$hits" >&2
        echo "" >&2
        echo "This crate promises equal inputs give equal outputs. Take the" >&2
        echo "evaluation instant as a parameter instead." >&2
        exit 1
    fi
    echo "๐ŸงŠ pure: no clock, no I/O, no unsafe"

# ๐Ÿ”ข Enforce that no float type reaches a metered quantity
no-floats:
    #!/usr/bin/env bash
    set -uo pipefail
    hits="$(grep -rn --include='*.rs' -E '\bf(32|64)\b' src/ \
        | grep -vE ':[[:space:]]*(///|//!|//)' || true)"
    if [ -n "$hits" ]; then
        echo "โŒ a float reached the source:" >&2
        echo "$hits" >&2
        echo "" >&2
        echo "Volumes are integer octets and durations integer seconds." >&2
        echo "Floats belong only in ratios and scores โ€” add an allowance here" >&2
        echo "deliberately if one is genuinely needed." >&2
        exit 1
    fi
    echo "๐Ÿ”ข exact: no floats in quantities"

# ๐ŸŽจ Format the workspace
fmt:
    cargo fmt --all

# ๐ŸŽจ Fail if anything is unformatted
fmt-check:
    cargo fmt --all -- --check

# ๐Ÿ“Ž Clippy with warnings denied (default + all features)
lint:
    cargo clippy --all-targets -- -D warnings
    cargo clippy --all-targets --all-features -- -D warnings

# ๐Ÿ”Ž Fast type-check, all features
check:
    cargo check --all-targets --all-features

# ๐Ÿงช Full test suite (all features, incl. doctests)
test:
    cargo test --all-features

# ๐Ÿงช Run tests matching a filter, e.g. `just test-one luhn`
test-one filter:
    cargo test --all-features {{ filter }} -- --nocapture

# ๐ŸŽ›๏ธ Build every feature combination
features:
    cargo build --no-default-features
    cargo build --no-default-features --features serde
    cargo build --all-features

# ๐Ÿฆ€ Compile on the pinned MSRV
msrv:
    RUSTUP_TOOLCHAIN={{ msrv }} cargo check --all-features --all-targets

# ๐Ÿ“š Build the docs with warnings denied
doc:
    RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features

# ๐Ÿ“š Build and open the docs
doc-open:
    RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --open

# ๐Ÿ“ฆ Dry-run the crates.io package (catches bad metadata before tagging)
# `--allow-dirty` is local-only convenience; CI runs this on a clean checkout.
package:
    cargo publish --dry-run --all-features --allow-dirty

# ๐Ÿ›ก๏ธ Audit dependencies for advisories (needs `cargo install cargo-audit`)
audit:
    cargo audit

# โฌ†๏ธ Show outdated dependencies (needs `cargo install cargo-outdated`)
outdated:
    cargo outdated --root-deps-only

# ๐Ÿท๏ธ Tag the current Cargo.toml version โ€” pushing the tag triggers release.yml
tag:
    #!/usr/bin/env bash
    set -euo pipefail
    version="$(cargo metadata --no-deps --format-version 1 \
        | grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)"
    if [ -n "$(git status --porcelain)" ]; then
        echo "โŒ working tree is dirty โ€” commit first" >&2
        exit 1
    fi
    just ci
    git tag -a "v${version}" -m "v${version}"
    echo "๐Ÿท๏ธ  tagged v${version} โ€” push with: git push origin v${version}"

# ๐Ÿงน Remove build artifacts
clean:
    cargo clean