Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c8fff9a
Add custom error derive
RAprogramm Sep 17, 2025
d32f0bd
Merge pull request #29 from RAprogramm/codex/create-proc-macro-crate-…
RAprogramm Sep 17, 2025
d59cf45
Automate README generation from metadata
RAprogramm Sep 17, 2025
b982862
Merge pull request #31 from RAprogramm/codex/update-readme-with-parse…
RAprogramm Sep 17, 2025
9b5d351
feat(derive): support #[from] conversions
RAprogramm Sep 17, 2025
f3d809d
Merge branch 'new_version' into codex/add-support-for-#-from]-attribu…
RAprogramm Sep 17, 2025
f63b5ad
Merge pull request #32 from RAprogramm/codex/add-support-for-#-from]-…
RAprogramm Sep 17, 2025
076164c
increase version
RAprogramm Sep 17, 2025
7c7444d
Add BrowserConsoleError context accessor
RAprogramm Sep 17, 2025
5c8ecde
Merge pull request #33 from RAprogramm/codex/fix-unused-variable-erro…
RAprogramm Sep 17, 2025
26fa66a
increase version
RAprogramm Sep 17, 2025
79e43e0
increase version
RAprogramm Sep 17, 2025
9b269d9
test readme 2
RAprogramm Sep 17, 2025
ae6476a
feat(derive): add transparent error support
RAprogramm Sep 17, 2025
3bf3eff
Merge pull request #34 from RAprogramm/codex/implement-error-transpar…
RAprogramm Sep 17, 2025
c9ec00b
Specify masterror-derive version for packaging
RAprogramm Sep 17, 2025
30ac454
Merge pull request #35 from RAprogramm/codex/fix-missing-version-for-…
RAprogramm Sep 17, 2025
30e76da
Replace derive crate with thiserror re-export
RAprogramm Sep 17, 2025
743c776
Merge pull request #36 from RAprogramm/codex/fix-cargo-package-upload…
RAprogramm Sep 17, 2025
970d57f
Prevent build script from touching README during packaging
RAprogramm Sep 17, 2025
b4553a0
Merge pull request #37 from RAprogramm/codex/fix-build.rs-modificatio…
RAprogramm Sep 17, 2025
097f197
docs: add release checklist to readme
RAprogramm Sep 17, 2025
ea28e5f
Merge pull request #38 from RAprogramm/codex/fix-readme-file-sync-issue
RAprogramm Sep 17, 2025
22c8a76
build: align readme generator toml version
RAprogramm Sep 17, 2025
9b47adf
Merge pull request #39 from RAprogramm/codex/fix-readme-out-of-sync-e…
RAprogramm Sep 17, 2025
ec58e9b
docs: regenerate readme comment
RAprogramm Sep 17, 2025
1c1b478
Merge pull request #40 from RAprogramm/codex/fix-readme-sync-error-du…
RAprogramm Sep 17, 2025
899b32c
docs: capture post-0.4 updates
RAprogramm Sep 17, 2025
66568f8
Merge pull request #41 from RAprogramm/codex/add-changelog-entries-fo…
RAprogramm Sep 17, 2025
1d25200
docs: emphasize readme sync requirement
RAprogramm Sep 17, 2025
d30fa85
Merge pull request #42 from RAprogramm/codex/fix-readme-sync-issue-in…
RAprogramm Sep 17, 2025
fa63ec1
Fail CI when README generation is stale
RAprogramm Sep 17, 2025
f32dd5d
Merge pull request #43 from RAprogramm/codex/update-readme-reset-step…
RAprogramm Sep 17, 2025
16ed592
upgrade thiserror version
RAprogramm Sep 17, 2025
c423d83
Merge branch 'new_version' of github.com:RAprogramm/masterror into ne…
RAprogramm Sep 17, 2025
77cc336
Ensure derive tests exercise all enum variants
RAprogramm Sep 17, 2025
fbd29b1
Merge pull request #44 from RAprogramm/codex/remove-dead-code-to-sati…
RAprogramm Sep 17, 2025
0ad0a95
try to fix 3
RAprogramm Sep 17, 2025
790f60f
Merge branch 'new_version' of github.com:RAprogramm/masterror into ne…
RAprogramm Sep 17, 2025
04839ba
try to fix 4
RAprogramm Sep 17, 2025
f02dc1d
try to fix 5
RAprogramm Sep 17, 2025
2777baf
docs: prepare 0.5.0 release notes
RAprogramm Sep 17, 2025
4317c72
Merge pull request #45 from RAprogramm/codex/prepare-4tobi-for-releas…
RAprogramm Sep 17, 2025
f5ad833
try to fix 6
RAprogramm Sep 17, 2025
5527cc2
try to fix 7
RAprogramm Sep 17, 2025
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
29 changes: 29 additions & 0 deletions .github/scripts/gen_readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

# Deterministic env for local runs too
export TZ="${TZ:-UTC}"
export LC_ALL="${LC_ALL:-C.UTF-8}"
export NO_COLOR="${NO_COLOR:-1}"
export CARGO_TERM_COLOR="${CARGO_TERM_COLOR:-never}"
export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-0}"

# Allow forcing toolchain via TOOLCHAIN env (e.g. "+1.78.0")
TOOLCHAIN="${TOOLCHAIN:-}"

# If you use cargo-readme, prefer it
if command -v cargo-readme >/dev/null 2>&1; then
cargo ${TOOLCHAIN} readme > README.md
exit 0
fi

# If you have your own generator, call it here instead.
# Examples (uncomment the one you actually use):
# cargo ${TOOLCHAIN} xtask readme
# cargo ${TOOLCHAIN} run -p readme-gen
# cargo ${TOOLCHAIN} run --bin readme_gen
# cargo ${TOOLCHAIN} readme > README.md

# Fallback: no-op to keep CI green if README is static
touch README.md

75 changes: 70 additions & 5 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ jobs:
ci:
runs-on: ubuntu-latest
env:
CARGO_LOCKED: "true" # don't mutate Cargo.lock during CI
CARGO_LOCKED: "true"
CARGO_TERM_COLOR: always

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true

# Read MSRV (rust-version) from Cargo.toml
- name: Read MSRV from Cargo.toml
id: msrv
shell: bash
Expand All @@ -36,14 +37,12 @@ jobs:
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:
Expand All @@ -55,7 +54,6 @@ jobs:
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: |
Expand All @@ -65,6 +63,61 @@ jobs:
exit 1
fi

# ---------- README: regenerate early, normalize, drift handling ----------
- name: Regenerate README via build.rs (MSRV, deterministic)
shell: bash
run: |
set -euo pipefail
export TZ=UTC
export LC_ALL=C.UTF-8
export NO_COLOR=1
export CARGO_TERM_COLOR=never
export SOURCE_DATE_EPOCH=0
cargo +${{ steps.msrv.outputs.msrv }} build --workspace -q || cargo +${{ steps.msrv.outputs.msrv }} build -q

- name: Normalize README (ensure trailing newline) — bash only
if: hashFiles('README.md') != ''
shell: bash
run: |
set -euo pipefail
if [ -f README.md ] && [ -s README.md ]; then
last_byte="$(tail -c1 README.md 2>/dev/null || true)"
if [ "$last_byte" != $'\n' ]; then
printf '\n' >> README.md
fi
fi

- name: README drift report (PR)
if: github.event_name == 'pull_request'
shell: bash
run: |
set -euo pipefail
if git diff --quiet -- README.md; then
echo "README is up to date (PR)."
else
echo "::warning::README differs on PR. Tests will use regenerated content."
git --no-pager diff -- README.md || true
fi

- name: README drift autocommit (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
if git diff --quiet -- README.md; then
echo "README is up to date (main)."
exit 0
fi
echo "Auto-committing refreshed README on main..."
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "chore(readme): auto-refresh [skip ci]"
git push
# -----------------------------------------------------------------------

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

Expand All @@ -88,6 +141,17 @@ jobs:
cargo +${{ steps.msrv.outputs.msrv }} test --workspace --no-fail-fast
fi

# На PR возвращаем README к HEAD, чтобы дерево стало чистым перед упаковкой
- name: Restore README to HEAD on PR (keep tree clean)
if: github.event_name == 'pull_request'
shell: bash
run: |
set -euo pipefail
if ! git diff --quiet -- README.md; then
echo "Restoring README.md to HEAD to keep tree clean on PR..."
git restore --worktree --source=HEAD -- README.md || git checkout -- README.md
fi

- name: Ensure tree is clean before package
shell: bash
run: |
Expand All @@ -100,3 +164,4 @@ jobs:

- name: Package (dry-run)
run: cargo +${{ steps.msrv.outputs.msrv }} package --locked

15 changes: 15 additions & 0 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,20 @@ cargo test --workspace --all-features
# echo "📦 Validating SQLx prepare..."
# cargo sqlx prepare --check --workspace

# same deterministic env
export TZ=UTC
export LC_ALL=C.UTF-8
export NO_COLOR=1
export CARGO_TERM_COLOR=never
export SOURCE_DATE_EPOCH=0

# Generate
./.github/scripts/gen_readme.sh

# Stage README if changed
if ! git diff --quiet -- README.md; then
git add README.md
fi

echo "✅ All checks passed!"

32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

_No changes yet._

## [0.5.0] - 2025-09-23

### Added
- Re-exported `thiserror::Error` as `masterror::Error`, making it possible to
derive domain errors without an extra dependency. The derive supports
`#[from]` conversions, validates `#[error(transparent)]` wrappers, and mirrors
`thiserror`'s ergonomics.
- Added `BrowserConsoleError::context()` for retrieving browser-provided
diagnostics when console logging fails.

### Changed
- README generation now pulls from crate metadata via the build script while
staying inert during `cargo package`, preventing dirty worktrees in release
workflows.

### Documentation
- Documented deriving custom errors via `masterror::Error` and expanded the
browser console section with context-handling guidance.
- Added a release checklist and described the automated README sync process.

### Tests
- Added regression tests covering derive behaviour (including `#[from]` and
transparent wrappers) and ensuring the README stays in sync with its
template.
- Added a guard test that enforces the `AppResult<_>` alias over raw
`Result<_, AppError>` usages within the crate.

## [0.4.0] - 2025-09-15
### Added
- Optional `frontend` feature:
Expand Down Expand Up @@ -113,6 +142,8 @@ All notable changes to this project will be documented in this file.
- **MSRV:** 1.89
- **No unsafe:** the crate forbids `unsafe`.

[0.5.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.0
[0.4.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.4.0
[0.3.5]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.5
[0.3.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.4
[0.3.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.3
Expand All @@ -121,5 +152,4 @@ All notable changes to this project will be documented in this file.
[0.3.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.0
[0.2.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.2.1
[0.2.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.2.0
[0.4.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.4.0

Loading