Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.10.4] - 2025-10-24

### Changed
- Vendored `telegram-webapp-sdk` locally and patched it to use the workspace `masterror` implementation,
replacing the outdated crates.io release that depended on `masterror 0.3.5`.
- Marked the SDK's `masterror` dependency optional so disabling the `telegram-webapp-sdk` feature no longer
pulls the crate transitively.

### Build
- Added a `[patch.crates-io]` override for `telegram-webapp-sdk` to ensure the workspace uses the vendored
source and derives against the current `masterror` APIs.

### Documentation
- Described `#[provide]` telemetry providers and `#[app_error]` conversions with
end-to-end examples in the derive guide ([README](README.md#structured-telemetry-providers-and-apperror-mappings),
Expand Down
25 changes: 2 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masterror"
version = "0.10.3"
version = "0.10.4"
rust-version = "1.90"
edition = "2024"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -52,6 +52,10 @@ openapi = ["dep:utoipa"]
masterror-derive = { version = "0.6.0", path = "masterror-derive" }
masterror-template = { version = "0.3.1", path = "masterror-template" }


[patch.crates-io]
telegram-webapp-sdk = { path = "telegram-webapp-sdk" }

[dependencies]
masterror-derive = { workspace = true }
masterror-template = { workspace = true }
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Stable categories, conservative HTTP mapping, no `unsafe`.

~~~toml
[dependencies]
masterror = { version = "0.10.3", default-features = false }
masterror = { version = "0.10.4", default-features = false }
# or with features:
# masterror = { version = "0.10.3", features = [
# masterror = { version = "0.10.4", features = [
# "axum", "actix", "openapi", "serde_json",
# "sqlx", "sqlx-migrate", "reqwest", "redis",
# "validator", "config", "tokio", "multipart",
Expand Down Expand Up @@ -66,10 +66,10 @@ masterror = { version = "0.10.3", default-features = false }
~~~toml
[dependencies]
# lean core
masterror = { version = "0.10.3", default-features = false }
masterror = { version = "0.10.4", default-features = false }

# with Axum/Actix + JSON + integrations
# masterror = { version = "0.10.3", features = [
# masterror = { version = "0.10.4", features = [
# "axum", "actix", "openapi", "serde_json",
# "sqlx", "sqlx-migrate", "reqwest", "redis",
# "validator", "config", "tokio", "multipart",
Expand Down Expand Up @@ -623,13 +623,13 @@ assert_eq!(resp.status, 401);
Minimal core:

~~~toml
masterror = { version = "0.10.3", default-features = false }
masterror = { version = "0.10.4", default-features = false }
~~~

API (Axum + JSON + deps):

~~~toml
masterror = { version = "0.10.3", features = [
masterror = { version = "0.10.4", features = [
"axum", "serde_json", "openapi",
"sqlx", "reqwest", "redis", "validator", "config", "tokio"
] }
Expand All @@ -638,7 +638,7 @@ masterror = { version = "0.10.3", features = [
API (Actix + JSON + deps):

~~~toml
masterror = { version = "0.10.3", features = [
masterror = { version = "0.10.4", features = [
"actix", "serde_json", "openapi",
"sqlx", "reqwest", "redis", "validator", "config", "tokio"
] }
Expand Down
1 change: 1 addition & 0 deletions telegram-webapp-sdk/.cargo-ok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":1}
6 changes: 6 additions & 0 deletions telegram-webapp-sdk/.cargo_vcs_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"git": {
"sha1": "67fc43a229f57bb856aac4b2dfaaa095951107be"
},
"path_in_vcs": ""
}
15 changes: 15 additions & 0 deletions telegram-webapp-sdk/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: raprojects # Replace with a single Open Collective username
ko_fi: rozanov # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: raprogramm # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] # TODO: make an link to usdt wallet
13 changes: 13 additions & 0 deletions telegram-webapp-sdk/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:

jobs:
ci:
uses: ./.github/workflows/reusable-ci.yml
with:
all-features: true

57 changes: 57 additions & 0 deletions telegram-webapp-sdk/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
checks:
uses: ./.github/workflows/reusable-ci.yml
with:
all-features: true

publish:
runs-on: ubuntu-latest
needs: checks
steps:
- uses: actions/checkout@v4

- name: Read MSRV from Cargo.toml
id: msrv
shell: bash
run: |
set -euo pipefail
if ! command -v jq >/dev/null 2>&1; then
sudo apt-get update -y && sudo apt-get install -y jq
fi
RV=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].rust_version // empty')
if [ -z "$RV" ]; then
echo "rust-version is not set in Cargo.toml"
exit 1
fi
if [[ "$RV" =~ ^[0-9]+\.[0-9]+$ ]]; then
RV="${RV}.0"
fi
echo "msrv=${RV}" >> "$GITHUB_OUTPUT"

- name: Ensure tag matches Cargo.toml version
shell: bash
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
FILE_VER=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
if [ "v${FILE_VER}" != "${TAG}" ]; then
echo "Tag ${TAG} != Cargo.toml version v${FILE_VER}"
exit 1
fi

- name: Install Rust (${{ steps.msrv.outputs.msrv }})
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.msrv.outputs.msrv }}

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo +${{ steps.msrv.outputs.msrv }} publish --locked --token "$CARGO_REGISTRY_TOKEN"
102 changes: 102 additions & 0 deletions telegram-webapp-sdk/.github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Reusable CI

on:
workflow_call:
inputs:
all-features:
type: boolean
default: true

jobs:
ci:
runs-on: ubuntu-latest
env:
CARGO_LOCKED: "true" # don't mutate Cargo.lock during CI
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Read MSRV (rust-version) from Cargo.toml
- name: Read MSRV from Cargo.toml
id: msrv
shell: bash
run: |
set -euo pipefail
if ! command -v jq >/dev/null 2>&1; then
sudo apt-get update -y && sudo apt-get install -y jq
fi
RV=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].rust_version // empty')
if [ -z "$RV" ]; then
echo "rust-version is not set in Cargo.toml"
exit 1
fi
[[ "$RV" =~ ^[0-9]+\.[0-9]+$ ]] && RV="${RV}.0"
echo "msrv=${RV}" >> "$GITHUB_OUTPUT"
echo "Using MSRV: $RV"

# Install MSRV for clippy/tests/package
- name: Install Rust (${{ steps.msrv.outputs.msrv }})
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.msrv.outputs.msrv }}
components: clippy

# Pin nightly for rustfmt because unstable_features = true in .rustfmt.toml
- name: Install nightly rustfmt
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly-2025-08-01
components: rustfmt

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

# Ensure Cargo.lock is present when CARGO_LOCKED=1
- name: Verify lockfile is committed
shell: bash
run: |
set -euo pipefail
if [ ! -f Cargo.lock ]; then
echo "CARGO_LOCKED=1 but Cargo.lock is missing. Commit it or drop CARGO_LOCKED."
exit 1
fi

- name: Check formatting (nightly rustfmt)
run: cargo +nightly-2025-08-01 fmt --all -- --check

- name: Clippy (MSRV)
shell: bash
run: |
set -euo pipefail
if [ "${{ inputs.all-features }}" = "true" ]; then
cargo +${{ steps.msrv.outputs.msrv }} clippy --workspace --all-targets --all-features -- -D warnings
else
cargo +${{ steps.msrv.outputs.msrv }} clippy --workspace --all-targets -- -D warnings
fi

- name: Tests (MSRV)
shell: bash
run: |
set -euo pipefail
if [ "${{ inputs.all-features }}" = "true" ]; then
cargo +${{ steps.msrv.outputs.msrv }} test --workspace --all-features --no-fail-fast
else
cargo +${{ steps.msrv.outputs.msrv }} test --workspace --no-fail-fast
fi

- name: Ensure tree is clean before package
shell: bash
run: |
set -euo pipefail
if ! git diff --quiet; then
echo "Working tree is dirty:"
git status --porcelain
exit 1
fi

- name: Package (dry-run)
run: cargo +${{ steps.msrv.outputs.msrv }} package --locked
1 change: 1 addition & 0 deletions telegram-webapp-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
24 changes: 24 additions & 0 deletions telegram-webapp-sdk/.hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail

echo "🔧 Ensuring nightly rustfmt is available..."
if ! rustup toolchain list | grep -q "^nightly"; then
rustup toolchain install nightly >/dev/null
fi
rustup component add rustfmt --toolchain nightly >/dev/null

echo "🧹 Checking formatting with rustfmt..."
cargo +nightly fmt --all -- --check

echo "🔍 Running clippy (all features, all targets)..."
cargo clippy --workspace --all-targets --all-features -- -D warnings

echo "🧪 Running tests (all features)..."
cargo test --workspace --all-features

# Uncomment if you want to validate SQLx offline data
# echo "📦 Validating SQLx prepare..."
# cargo sqlx prepare --check --workspace

echo "✅ All checks passed!"

Loading
Loading