Compare commits

..
Author SHA1 Message Date
Jade Ellis b5927380f9 ci: Use dataaxiom/ghcr-cleanup-action 2025-11-08 23:53:00 +00:00
35 changed files with 785 additions and 655 deletions

No files matched your search

+70 -78
View File
@@ -17,9 +17,9 @@ inputs:
required: false required: false
default: '' default: ''
rust-version: rust-version:
description: 'Rust version to install (e.g. nightly). Defaults to the version specified in rust-toolchain.toml' description: 'Rust version to install (e.g. nightly). Defaults to 1.87.0'
required: false required: false
default: '' default: '1.87.0'
sccache-cache-limit: sccache-cache-limit:
description: 'Maximum size limit for sccache local cache (e.g. 2G, 500M)' description: 'Maximum size limit for sccache local cache (e.g. 2G, 500M)'
required: false required: false
@@ -59,20 +59,9 @@ runs:
mkdir -p "${{ github.workspace }}/target" mkdir -p "${{ github.workspace }}/target"
mkdir -p "${{ github.workspace }}/.rustup" mkdir -p "${{ github.workspace }}/.rustup"
- name: Start registry/toolchain restore group - name: Start cache restore group
shell: bash shell: bash
run: echo "::group::📦 Restoring registry and toolchain caches" run: echo "::group::📦 Restoring caches (registry, toolchain, build artifacts)"
- name: Cache toolchain binaries
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
.cargo/bin
.rustup/toolchains
.rustup/update-hashes
# Shared toolchain cache across all Rust versions
key: continuwuity-toolchain-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}
- name: Cache Cargo registry and git - name: Cache Cargo registry and git
id: registry-cache id: registry-cache
@@ -88,13 +77,58 @@ runs:
restore-keys: | restore-keys: |
continuwuity-cargo-registry-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}- continuwuity-cargo-registry-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-
- name: End registry/toolchain restore group - name: Cache toolchain binaries
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
.cargo/bin
.rustup/toolchains
.rustup/update-hashes
# Shared toolchain cache across all Rust versions
key: continuwuity-toolchain-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}
- name: Setup sccache
uses: https://git.tomfos.tr/tom/sccache-action@v1
- name: Cache dependencies
id: deps-cache
uses: actions/cache@v4
with:
path: |
target/**/.fingerprint
target/**/deps
target/**/*.d
target/**/.cargo-lock
target/**/CACHEDIR.TAG
target/**/.rustc_info.json
/timelord/
# Dependencies cache - based on Cargo.lock, survives source code changes
key: >-
continuwuity-deps-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ inputs.rust-version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
restore-keys: |
continuwuity-deps-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ inputs.rust-version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-
- name: Cache incremental compilation
id: incremental-cache
uses: actions/cache@v4
with:
path: |
target/**/incremental
# Incremental cache - based on source code changes
key: >-
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ inputs.rust-version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}-${{ hashFiles('**/*.rs', '**/Cargo.toml') }}
restore-keys: |
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ inputs.rust-version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}-
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ inputs.rust-version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-
- name: End cache restore group
shell: bash shell: bash
run: echo "::endgroup::" run: echo "::endgroup::"
- name: Setup Rust toolchain - name: Setup Rust toolchain
shell: bash shell: bash
id: rust-setup
run: | run: |
# Install rustup if not already cached # Install rustup if not already cached
if ! command -v rustup &> /dev/null; then if ! command -v rustup &> /dev/null; then
@@ -122,68 +156,8 @@ runs:
echo "::group::📦 Setting up Rust from rust-toolchain.toml" echo "::group::📦 Setting up Rust from rust-toolchain.toml"
rustup show rustup show
fi fi
RUST_VERSION=$(rustc --version | cut -d' ' -f2)
echo "version=$RUST_VERSION" >> $GITHUB_OUTPUT
echo "::endgroup::" echo "::endgroup::"
- name: Install Rust components
if: inputs.rust-components != ''
shell: bash
run: |
echo "📦 Installing components: ${{ inputs.rust-components }}"
rustup component add ${{ inputs.rust-components }}
- name: Install Rust target
if: inputs.rust-target != ''
shell: bash
run: |
echo "📦 Installing target: ${{ inputs.rust-target }}"
rustup target add ${{ inputs.rust-target }}
- name: Start build cache restore group
shell: bash
run: echo "::group::📦 Restoring build cache"
- name: Setup sccache
uses: https://git.tomfos.tr/tom/sccache-action@v1
- name: Cache dependencies
id: deps-cache
uses: actions/cache@v4
with:
path: |
target/**/.fingerprint
target/**/deps
target/**/*.d
target/**/.cargo-lock
target/**/CACHEDIR.TAG
target/**/.rustc_info.json
/timelord/
# Dependencies cache - based on Cargo.lock, survives source code changes
key: >-
continuwuity-deps-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ steps.rust-setup.outputs.version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
restore-keys: |
continuwuity-deps-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ steps.rust-setup.outputs.version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-
- name: Cache incremental compilation
id: incremental-cache
uses: actions/cache@v4
with:
path: |
target/**/incremental
# Incremental cache - based on source code changes
key: >-
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ steps.rust-setup.outputs.version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}-${{ hashFiles('**/*.rs', '**/Cargo.toml') }}
restore-keys: |
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ steps.rust-setup.outputs.version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}-
continuwuity-incremental-${{ steps.runner-os.outputs.slug }}-${{ steps.runner-os.outputs.arch }}-${{ steps.rust-setup.outputs.version }}${{ inputs.cache-key-suffix && format('-{0}', inputs.cache-key-suffix) || '' }}-
- name: End build cache restore group
shell: bash
run: echo "::endgroup::"
- name: Configure PATH and install tools - name: Configure PATH and install tools
shell: bash shell: bash
env: env:
@@ -237,9 +211,27 @@ runs:
echo "CARGO_INCREMENTAL_GC_THRESHOLD=5" >> $GITHUB_ENV echo "CARGO_INCREMENTAL_GC_THRESHOLD=5" >> $GITHUB_ENV
fi fi
- name: Output version and summary - name: Install Rust components
if: inputs.rust-components != ''
shell: bash shell: bash
run: | run: |
echo "📦 Installing components: ${{ inputs.rust-components }}"
rustup component add ${{ inputs.rust-components }}
- name: Install Rust target
if: inputs.rust-target != ''
shell: bash
run: |
echo "📦 Installing target: ${{ inputs.rust-target }}"
rustup target add ${{ inputs.rust-target }}
- name: Output version and summary
id: rust-setup
shell: bash
run: |
RUST_VERSION=$(rustc --version | cut -d' ' -f2)
echo "version=$RUST_VERSION" >> $GITHUB_OUTPUT
echo "📋 Setup complete:" echo "📋 Setup complete:"
echo " Rust: $(rustc --version)" echo " Rust: $(rustc --version)"
echo " Cargo: $(cargo --version)" echo " Cargo: $(cargo --version)"
-7
View File
@@ -46,9 +46,6 @@ creds:
- registry: ghcr.io - registry: ghcr.io
user: "{{env \"GH_PACKAGES_USER\"}}" user: "{{env \"GH_PACKAGES_USER\"}}"
pass: "{{env \"GH_PACKAGES_TOKEN\"}}" pass: "{{env \"GH_PACKAGES_TOKEN\"}}"
- registry: docker.io
user: "{{env \"DOCKER_MIRROR_USER\"}}"
pass: "{{env \"DOCKER_MIRROR_TOKEN\"}}"
# Global defaults # Global defaults
defaults: defaults:
@@ -70,7 +67,3 @@ sync:
target: ghcr.io/continuwuity/continuwuity target: ghcr.io/continuwuity/continuwuity
type: repository type: repository
<<: *tags-main <<: *tags-main
- source: *source
target: docker.io/jadedblueeyes/continuwuity
type: repository
<<: *tags-main
+110
View File
@@ -0,0 +1,110 @@
name: Cleanup Registry Images
on:
schedule:
# Run daily at 01:30 UTC
- cron: '30 1 * * *'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (check only, no actual deletion)'
required: false
default: false
type: boolean
pull_request:
types: [closed]
delete:
# Triggered when branches are deleted
concurrency:
group: "cleanup-registry"
cancel-in-progress: false
env:
BUILTIN_REGISTRY: forgejo.ellis.link
IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity
jobs:
cleanup-pr-images:
name: Cleanup PR Images
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed'
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Delete PR image
uses: https://github.com/dataaxiom/ghcr-cleanup-action@v1
with:
token: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
owner: continuwuation
repository: continuwuity
package: continuwuity
registry-url: https://${{ env.BUILTIN_REGISTRY }}
delete-tags: pr-${{ github.event.pull_request.number }}
dry-run: false
cleanup-old-commits:
name: Cleanup Old Commit Images
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set dry-run mode
id: params
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_OUTPUT
else
# Scheduled runs perform actual cleanup
echo "dry_run=false" >> $GITHUB_OUTPUT
fi
- name: Cleanup old SHA commit images
uses: https://github.com/dataaxiom/ghcr-cleanup-action@v1
with:
token: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
owner: continuwuation
repository: continuwuity
package: continuwuity
registry-url: https://${{ env.BUILTIN_REGISTRY }}
delete-tags: sha-*
exclude-tags: latest,main,v*.*.*,*.*.*,*-maxperf
older-than: 30 days
dry-run: ${{ steps.params.outputs.dry_run }}
delete-ghost-images: true
delete-partial-images: true
delete-orphaned-images: true
cleanup-branch-images:
name: Cleanup Deleted Branch Images
runs-on: ubuntu-latest
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Delete branch image
uses: https://github.com/dataaxiom/ghcr-cleanup-action@v1
with:
token: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
owner: continuwuation
repository: continuwuity
package: continuwuity
registry-url: https://${{ env.BUILTIN_REGISTRY }}
delete-tags: branch-${{ github.event.ref }}
dry-run: false
-2
View File
@@ -34,8 +34,6 @@ jobs:
N7574_GIT_TOKEN: ${{ secrets.N7574_GIT_TOKEN }} N7574_GIT_TOKEN: ${{ secrets.N7574_GIT_TOKEN }}
GH_PACKAGES_USER: ${{ vars.GH_PACKAGES_USER }} GH_PACKAGES_USER: ${{ vars.GH_PACKAGES_USER }}
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
DOCKER_MIRROR_USER: ${{ vars.DOCKER_MIRROR_USER }}
DOCKER_MIRROR_TOKEN: ${{ secrets.DOCKER_MIRROR_TOKEN }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v5
+9
View File
@@ -3,6 +3,15 @@ concurrency:
group: "release-image-${{ github.ref }}" group: "release-image-${{ github.ref }}"
on: on:
pull_request:
paths-ignore:
- "*.md"
- "**/*.md"
- ".gitlab-ci.yml"
- ".gitignore"
- "renovate.json"
- "pkg/**"
- "docs/**"
push: push:
branches: branches:
- main - main
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
name: Renovate name: Renovate
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/renovatebot/renovate:42.11.0@sha256:656c1e5b808279eac16c37b89562fb4c699e02fc7e219244f4a1fc2f0a7ce367 image: ghcr.io/renovatebot/renovate:41.146.4@sha256:bb70194b7405faf10a6f279b60caa10403a440ba37d158c5a4ef0ae7b67a0f92
options: --tmpfs /tmp:exec options: --tmpfs /tmp:exec
steps: steps:
- name: Checkout - name: Checkout
+1 -2
View File
@@ -20,8 +20,7 @@ jobs:
fetch-tags: false fetch-tags: false
fetch-single-branch: true fetch-single-branch: true
submodules: false submodules: false
persist-credentials: true persist-credentials: false
token: ${{ secrets.FORGEJO_TOKEN }}
- uses: https://github.com/cachix/install-nix-action@7ab6e7fd29da88e74b1e314a4ae9ac6b5cda3801 # v31.8.0 - uses: https://github.com/cachix/install-nix-action@7ab6e7fd29da88e74b1e314a4ae9ac6b5cda3801 # v31.8.0
with: with:
+1 -1
View File
@@ -23,7 +23,7 @@ repos:
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/crate-ci/typos - repo: https://github.com/crate-ci/typos
rev: v1.39.2 rev: v1.39.0
hooks: hooks:
- id: typos - id: typos
- id: typos - id: typos
Generated
+470 -450
View File
File diff suppressed because it is too large. Load diff
+32 -19
View File
@@ -21,7 +21,7 @@ license = "Apache-2.0"
readme = "README.md" readme = "README.md"
repository = "https://forgejo.ellis.link/continuwuation/continuwuity" repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
rust-version = "1.86.0" rust-version = "1.86.0"
version = "0.5.0-rc.8.1" version = "0.5.0-rc.8"
[workspace.metadata.crane] [workspace.metadata.crane]
name = "conduwuit" name = "conduwuit"
@@ -48,7 +48,7 @@ features = ["ffi", "std", "union"]
version = "0.7.0" version = "0.7.0"
[workspace.dependencies.ctor] [workspace.dependencies.ctor]
version = "0.6.0" version = "0.5.0"
[workspace.dependencies.cargo_toml] [workspace.dependencies.cargo_toml]
version = "0.22" version = "0.22"
@@ -166,8 +166,8 @@ default-features = false
features = ["raw_value"] features = ["raw_value"]
# Used for appservice registration files # Used for appservice registration files
[workspace.dependencies.serde-saphyr] [workspace.dependencies.serde_yml]
version = "0.0.8" version = "0.0.12"
# Used to load forbidden room/user regex from config # Used to load forbidden room/user regex from config
[workspace.dependencies.serde_regex] [workspace.dependencies.serde_regex]
@@ -210,13 +210,13 @@ default-features = false
version = "0.1.41" version = "0.1.41"
default-features = false default-features = false
[workspace.dependencies.tracing-subscriber] [workspace.dependencies.tracing-subscriber]
version = "0.3.20" version = "0.3.19"
default-features = false default-features = false
features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"] features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"]
[workspace.dependencies.tracing-journald] [workspace.dependencies.tracing-journald]
version = "0.3.1" version = "0.3.1"
[workspace.dependencies.tracing-core] [workspace.dependencies.tracing-core]
version = "0.1.34" version = "0.1.33"
default-features = false default-features = false
# for URL previews # for URL previews
@@ -286,7 +286,7 @@ features = [
] ]
[workspace.dependencies.hyper-util] [workspace.dependencies.hyper-util]
version = "=0.1.17" version = "0.1.11"
default-features = false default-features = false
features = [ features = [
"server-auto", "server-auto",
@@ -412,27 +412,28 @@ default-features = false
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring # optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
[workspace.dependencies.opentelemetry] [workspace.dependencies.opentelemetry]
version = "0.31.0" version = "0.30.0"
[workspace.dependencies.tracing-flame] [workspace.dependencies.tracing-flame]
version = "0.2.0" version = "0.2.0"
[workspace.dependencies.tracing-opentelemetry] [workspace.dependencies.tracing-opentelemetry]
version = "0.32.0" version = "0.31.0"
[workspace.dependencies.opentelemetry_sdk] [workspace.dependencies.opentelemetry_sdk]
version = "0.31.0" version = "0.30.0"
features = ["rt-tokio"] features = ["rt-tokio"]
[workspace.dependencies.opentelemetry-otlp] [workspace.dependencies.opentelemetry-otlp]
version = "0.31.0" version = "0.30.0"
features = ["http", "trace", "logs", "metrics"] features = ["http", "trace", "logs", "metrics"]
[workspace.dependencies.opentelemetry-jaeger-propagator]
version = "0.30.0"
# optional sentry metrics for crash/panic reporting # optional sentry metrics for crash/panic reporting
[workspace.dependencies.sentry] [workspace.dependencies.sentry]
version = "0.45.0" version = "0.42.0"
default-features = false default-features = false
features = [ features = [
"backtrace", "backtrace",
@@ -448,9 +449,9 @@ features = [
] ]
[workspace.dependencies.sentry-tracing] [workspace.dependencies.sentry-tracing]
version = "0.45.0" version = "0.42.0"
[workspace.dependencies.sentry-tower] [workspace.dependencies.sentry-tower]
version = "0.45.0" version = "0.42.0"
# jemalloc usage # jemalloc usage
[workspace.dependencies.tikv-jemalloc-sys] [workspace.dependencies.tikv-jemalloc-sys]
@@ -476,7 +477,7 @@ default-features = false
features = ["use_std"] features = ["use_std"]
[workspace.dependencies.console-subscriber] [workspace.dependencies.console-subscriber]
version = "0.5" version = "0.4"
[workspace.dependencies.nix] [workspace.dependencies.nix]
version = "0.30.1" version = "0.30.1"
@@ -563,7 +564,19 @@ version = "0.7.5"
# backport of [https://github.com/tokio-rs/tracing/pull/2956] to the 0.1.x branch of tracing. # backport of [https://github.com/tokio-rs/tracing/pull/2956] to the 0.1.x branch of tracing.
# we can switch back to upstream if #2956 is merged and backported in the upstream repo. # we can switch back to upstream if #2956 is merged and backported in the upstream repo.
# https://forgejo.ellis.link/continuwuation/tracing/commit/b348dca742af641c47bc390261f60711c2af573c
[patch.crates-io.tracing-subscriber]
git = "https://forgejo.ellis.link/continuwuation/tracing"
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
[patch.crates-io.tracing]
git = "https://forgejo.ellis.link/continuwuation/tracing"
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
[patch.crates-io.tracing-core]
git = "https://forgejo.ellis.link/continuwuation/tracing"
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
[patch.crates-io.tracing-log]
git = "https://forgejo.ellis.link/continuwuation/tracing"
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
# adds a tab completion callback: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0002-add-tab-completion-callback.patch # adds a tab completion callback: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0002-add-tab-completion-callback.patch
# adds event for CTRL+\: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0001-add-event-for-ctrl.patch # adds event for CTRL+\: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0001-add-event-for-ctrl.patch
@@ -587,7 +600,7 @@ rev = "9c8e51510c35077df888ee72a36b4b05637147da"
# reverts hyperium#148 conflicting with our delicate federation resolver hooks # reverts hyperium#148 conflicting with our delicate federation resolver hooks
[patch.crates-io.hyper-util] [patch.crates-io.hyper-util]
git = "https://forgejo.ellis.link/continuwuation/hyper-util" git = "https://forgejo.ellis.link/continuwuation/hyper-util"
rev = "5886d5292bf704c246206ad72d010d674a7b77d0" rev = "e4ae7628fe4fcdacef9788c4c8415317a4489941"
# #
# Our crates # Our crates
@@ -947,7 +960,7 @@ semicolon_outside_block = "warn"
str_to_string = "warn" str_to_string = "warn"
string_lit_chars_any = "warn" string_lit_chars_any = "warn"
string_slice = "warn" string_slice = "warn"
string_to_string = "warn"
suspicious_xor_used_as_pow = "warn" suspicious_xor_used_as_pow = "warn"
tests_outside_test_module = "warn" tests_outside_test_module = "warn"
try_err = "warn" try_err = "warn"
+1 -1
View File
@@ -11,7 +11,7 @@
<!-- ANCHOR_END: catchphrase --> <!-- ANCHOR_END: catchphrase -->
[continuwuity] is a Matrix homeserver written in Rust. [continuwuity] is a Matrix homeserver written in Rust.
It's the official community continuation of the [conduwuit](https://github.com/girlbossceo/conduwuit) homeserver. It's a community continuation of the [conduwuit](https://github.com/girlbossceo/conduwuit) homeserver.
<!-- ANCHOR: body --> <!-- ANCHOR: body -->
+2 -1
View File
@@ -4,6 +4,7 @@ description = "continuwuity is a community continuation of the conduwuit Matrix
language = "en" language = "en"
authors = ["The continuwuity Community"] authors = ["The continuwuity Community"]
text-direction = "ltr" text-direction = "ltr"
multilingual = false
src = "docs" src = "docs"
[build] [build]
@@ -17,7 +18,7 @@ edition = "2024"
[output.html] [output.html]
edit-url-template = "https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/{path}" edit-url-template = "https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/{path}"
git-repository-url = "https://forgejo.ellis.link/continuwuation/continuwuity" git-repository-url = "https://forgejo.ellis.link/continuwuation/continuwuity"
git-repository-icon = "fab-git-alt" git-repository-icon = "fa-git-alt"
[output.html.search] [output.html.search]
limit-results = 15 limit-results = 15
+1 -1
View File
@@ -48,7 +48,7 @@ EOF
# Developer tool versions # Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall # renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.15.11 ENV BINSTALL_VERSION=1.15.7
# renovate: datasource=github-releases depName=psastras/sbom-rs # renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1 ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree # renovate: datasource=crate depName=lddtree
+1 -1
View File
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
# Developer tool versions # Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall # renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.15.11 ENV BINSTALL_VERSION=1.15.7
# renovate: datasource=github-releases depName=psastras/sbom-rs # renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1 ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree # renovate: datasource=crate depName=lddtree
-2
View File
@@ -17,5 +17,3 @@
``` ```
{{#include ../../pkg/conduwuit.service}} {{#include ../../pkg/conduwuit.service}}
``` ```
</details>
-4
View File
@@ -8,10 +8,6 @@
{ {
"id": 3, "id": 3,
"message": "_taps microphone_ The Continuwuity 0.5.0-rc.7 release is now available, and it's better than ever! **177 commits**, **35 pull requests**, **11 contributors,** and a lot of new stuff!\n\nFor highlights, we've got:\n\n* 🕵️ Full Policy Server support to fight spam!\n* 🚀 Smarter room & space upgrades.\n* 🚫 User suspension tools for better moderation.\n* 🤖 reCaptcha support for safer open registration.\n* 🔍 Ability to disable read receipts & typing indicators.\n* ⚡ Sweeping performance improvements!\n\nGet the [full changelog and downloads on our Forgejo](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v0.5.0-rc.7) - and make sure you're in the [Announcements room](https://matrix.to/#/!releases:continuwuity.org/$hN9z6L2_dTAlPxFLAoXVfo_g8DyYXu4cpvWsSrWhmB0) to get stuff like this sooner." "message": "_taps microphone_ The Continuwuity 0.5.0-rc.7 release is now available, and it's better than ever! **177 commits**, **35 pull requests**, **11 contributors,** and a lot of new stuff!\n\nFor highlights, we've got:\n\n* 🕵️ Full Policy Server support to fight spam!\n* 🚀 Smarter room & space upgrades.\n* 🚫 User suspension tools for better moderation.\n* 🤖 reCaptcha support for safer open registration.\n* 🔍 Ability to disable read receipts & typing indicators.\n* ⚡ Sweeping performance improvements!\n\nGet the [full changelog and downloads on our Forgejo](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v0.5.0-rc.7) - and make sure you're in the [Announcements room](https://matrix.to/#/!releases:continuwuity.org/$hN9z6L2_dTAlPxFLAoXVfo_g8DyYXu4cpvWsSrWhmB0) to get stuff like this sooner."
},
{
"id": 5,
"message": "It's a bird! It's a plane! No, it's 0.5.0-rc.8.1!\n\nThis is a minor bugfix update to the rc8 which backports some important fixes from the latest main branch. If you still haven't updated to rc8, you should skip to main. Otherwise, you should upgrade to this bugfix release as soon as possible.\n\nBugfixes backported to this version:\n\n- Resolved several issues with state resolution v2.1 (room version 12)\n- Fixed issues with the `restricted` and `knock_restricted` join rules that would sometimes incorrectly disallow a valid join\n- Fixed the automatic support contact listing being a no-op\n- Fixed upgrading pre-v12 rooms to v12 rooms\n- Fixed policy servers sending the incorrect JSON objects (resulted in false positives)\n- Fixed debug build panic during MSC4133 migration\n\nIt is recommended, if you can and are comfortable with doing so, following updates to the main branch - we're in the run up to the full 0.5.0 release, and more and more bugfixes and new features are being pushed constantly. Please don't forget to join [#announcements:continuwuity.org](https://matrix.to/#/#announcements:continuwuity.org) to receive this news faster and be alerted to other important updates!"
} }
] ]
} }
+1 -1
View File
@@ -15,7 +15,7 @@
file = inputs.self + "/rust-toolchain.toml"; file = inputs.self + "/rust-toolchain.toml";
# See also `rust-toolchain.toml` # See also `rust-toolchain.toml`
sha256 = "sha256-SJwZ8g0zF2WrKDVmHrVG3pD2RGoQeo24MEXnNx5FyuI="; sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
}; };
in in
{ {
+8
View File
@@ -18,6 +18,14 @@
"tikv-jemallocator", "tikv-jemallocator",
"tikv-jemalloc-sys", "tikv-jemalloc-sys",
"tikv-jemalloc-ctl", "tikv-jemalloc-ctl",
"opentelemetry",
"opentelemetry_sdk",
"opentelemetry-jaeger",
"tracing-opentelemetry",
"tracing-subscriber",
"tracing",
"tracing-core",
"tracing-log",
"rustyline-async", "rustyline-async",
"event-listener", "event-listener",
"async-channel", "async-channel",
+1 -1
View File
@@ -10,7 +10,7 @@
[toolchain] [toolchain]
profile = "minimal" profile = "minimal"
channel = "1.90.0" channel = "1.89.0"
components = [ components = [
# For rust-analyzer # For rust-analyzer
"rust-src", "rust-src",
+1 -1
View File
@@ -85,7 +85,7 @@ futures.workspace = true
log.workspace = true log.workspace = true
ruma.workspace = true ruma.workspace = true
serde_json.workspace = true serde_json.workspace = true
serde-saphyr.workspace = true serde_yml.workspace = true
tokio.workspace = true tokio.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
tracing.workspace = true tracing.workspace = true
+2 -2
View File
@@ -16,7 +16,7 @@ pub(super) async fn register(&self) -> Result {
let range = 1..checked!(body_len - 1)?; let range = 1..checked!(body_len - 1)?;
let appservice_config_body = body[range].join("\n"); let appservice_config_body = body[range].join("\n");
let parsed_config = serde_saphyr::from_str(&appservice_config_body); let parsed_config = serde_yml::from_str(&appservice_config_body);
match parsed_config { match parsed_config {
| Err(e) => return Err!("Could not parse appservice config as YAML: {e}"), | Err(e) => return Err!("Could not parse appservice config as YAML: {e}"),
| Ok(registration) => match self | Ok(registration) => match self
@@ -57,7 +57,7 @@ pub(super) async fn show_appservice_config(&self, appservice_identifier: String)
{ {
| None => return Err!("Appservice does not exist."), | None => return Err!("Appservice does not exist."),
| Some(config) => { | Some(config) => {
let config_str = serde_saphyr::to_string(&config)?; let config_str = serde_yml::to_string(&config)?;
write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```") write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```")
}, },
} }
+1 -1
View File
@@ -78,7 +78,7 @@ pub(crate) async fn well_known_support(
while let Some(user_id) = stream.next().await { while let Some(user_id) = stream.next().await {
// Skip server user // Skip server user
if *user_id == services.globals.server_user { if *user_id == services.globals.server_user {
continue; break;
} }
contacts.push(Contact { contacts.push(Contact {
role: role_value.clone(), role: role_value.clone(),
+1 -1
View File
@@ -92,7 +92,7 @@ ruma.workspace = true
sanitize-filename.workspace = true sanitize-filename.workspace = true
serde_json.workspace = true serde_json.workspace = true
serde_regex.workspace = true serde_regex.workspace = true
serde-saphyr.workspace = true serde_yml.workspace = true
serde.workspace = true serde.workspace = true
smallvec.workspace = true smallvec.workspace = true
smallstr.workspace = true smallstr.workspace = true
+1 -3
View File
@@ -83,9 +83,7 @@ pub enum Error {
#[error(transparent)] #[error(transparent)]
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection), TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
#[error(transparent)] #[error(transparent)]
YamlDe(#[from] serde_saphyr::Error), Yaml(#[from] serde_yml::Error),
#[error(transparent)]
YamlSer(#[from] serde_saphyr::ser_error::Error),
// ruma/conduwuit // ruma/conduwuit
#[error("Arithmetic operation failed: {0}")] #[error("Arithmetic operation failed: {0}")]
+30 -32
View File
@@ -101,40 +101,40 @@ where
debug!(version = ?stateres_version, "State resolution starting"); debug!(version = ?stateres_version, "State resolution starting");
// Split non-conflicting and conflicting state // Split non-conflicting and conflicting state
let (unconflicted, conflicting) = separate(state_sets.into_iter()); let (clean, conflicting) = separate(state_sets.into_iter());
debug!(count = unconflicted.len(), "non-conflicting events"); debug!(count = clean.len(), "non-conflicting events");
trace!(map = ?unconflicted, "non-conflicting events"); trace!(map = ?clean, "non-conflicting events");
if conflicting.is_empty() { if conflicting.is_empty() {
debug!("no conflicting state found"); debug!("no conflicting state found");
return Ok(unconflicted); return Ok(clean);
} }
debug!(count = conflicting.len(), "conflicting events"); debug!(count = conflicting.len(), "conflicting events");
trace!(map = ?conflicting, "conflicting events"); trace!(map = ?conflicting, "conflicting events");
let (conflicted_state_subgraph, initial_state) = let conflicted_state_subgraph: HashSet<_> = match stateres_version {
if stateres_version == StateResolutionVersion::V2_1 { | StateResolutionVersion::V2_1 =>
let csg = calculate_conflicted_subgraph(&conflicting, event_fetch) calculate_conflicted_subgraph(&conflicting, event_fetch)
.await .await
.ok_or_else(|| { .ok_or_else(|| {
Error::InvalidPdu("Failed to calculate conflicted subgraph".to_owned()) Error::InvalidPdu("Failed to calculate conflicted subgraph".to_owned())
})?; })?,
debug!(count = csg.len(), "conflicted subgraph"); | _ => HashSet::new(),
trace!(set = ?csg, "conflicted subgraph"); };
(csg, HashMap::new()) debug!(count = conflicted_state_subgraph.len(), "conflicted subgraph");
} else { trace!(set = ?conflicted_state_subgraph, "conflicted subgraph");
(HashSet::new(), unconflicted.clone())
}; let conflicting_values = conflicting.into_values().flatten().stream();
// `all_conflicted` contains unique items // `all_conflicted` contains unique items
// synapse says `full_set = {eid for eid in full_conflicted_set if eid in // synapse says `full_set = {eid for eid in full_conflicted_set if eid in
// event_map}` // event_map}`
// Hydra: Also consider the conflicted state subgraph // Hydra: Also consider the conflicted state subgraph
let all_conflicted: HashSet<_> = get_auth_chain_diff(auth_chain_sets) let all_conflicted: HashSet<_> = get_auth_chain_diff(auth_chain_sets)
.chain(conflicting.into_values().flatten().stream()) .chain(conflicting_values)
.broad_filter_map(async |id| event_exists(id.clone()).await.then_some(id))
.chain(conflicted_state_subgraph.into_iter().stream()) .chain(conflicted_state_subgraph.into_iter().stream())
.broad_filter_map(async |id| event_exists(id.clone()).await.then_some(id))
.collect() .collect()
.await; .await;
@@ -169,8 +169,9 @@ where
// Sequentially auth check each control event. // Sequentially auth check each control event.
let resolved_control = iterative_auth_check( let resolved_control = iterative_auth_check(
&room_version, &room_version,
&stateres_version,
sorted_control_levels.iter().stream().map(AsRef::as_ref), sorted_control_levels.iter().stream().map(AsRef::as_ref),
initial_state, clean.clone(),
&event_fetch, &event_fetch,
) )
.await?; .await?;
@@ -200,7 +201,7 @@ where
let power_levels_ty_sk = (StateEventType::RoomPowerLevels, StateKey::new()); let power_levels_ty_sk = (StateEventType::RoomPowerLevels, StateKey::new());
let power_event = resolved_control.get(&power_levels_ty_sk); let power_event = resolved_control.get(&power_levels_ty_sk);
trace!(event_id = ?power_event, "power event"); debug!(event_id = ?power_event, "power event");
let sorted_left_events = let sorted_left_events =
mainline_sort(&events_to_resolve, power_event.cloned(), &event_fetch).await?; mainline_sort(&events_to_resolve, power_event.cloned(), &event_fetch).await?;
@@ -209,14 +210,15 @@ where
let mut resolved_state = iterative_auth_check( let mut resolved_state = iterative_auth_check(
&room_version, &room_version,
&stateres_version,
sorted_left_events.iter().stream().map(AsRef::as_ref), sorted_left_events.iter().stream().map(AsRef::as_ref),
resolved_control, // The control events are added to the final resolved state resolved_control.clone(), // The control events are added to the final resolved state
&event_fetch, &event_fetch,
) )
.await?; .await?;
// Ensure unconflicting state is in the final state // Ensure unconflicting state is in the final state
resolved_state.extend(unconflicted); resolved_state.extend(clean);
debug!("state resolution finished"); debug!("state resolution finished");
trace!( map = ?resolved_state, "final resolved state" ); trace!( map = ?resolved_state, "final resolved state" );
@@ -419,8 +421,8 @@ where
/// `key_fn` is used as to obtain the power level and age of an event for /// `key_fn` is used as to obtain the power level and age of an event for
/// breaking ties (together with the event ID). /// breaking ties (together with the event ID).
#[tracing::instrument(level = "debug", skip_all)] #[tracing::instrument(level = "debug", skip_all)]
pub async fn lexicographical_topological_sort<Id, F, Fut, Hasher, S>( pub async fn lexicographical_topological_sort<Id, F, Fut, Hasher>(
graph: &HashMap<Id, HashSet<Id, Hasher>, S>, graph: &HashMap<Id, HashSet<Id, Hasher>>,
key_fn: &F, key_fn: &F,
) -> Result<Vec<Id>> ) -> Result<Vec<Id>>
where where
@@ -428,7 +430,6 @@ where
Fut: Future<Output = Result<(Int, MilliSecondsSinceUnixEpoch)>> + Send, Fut: Future<Output = Result<(Int, MilliSecondsSinceUnixEpoch)>> + Send,
Id: Borrow<EventId> + Clone + Eq + Hash + Ord + Send + Sync, Id: Borrow<EventId> + Clone + Eq + Hash + Ord + Send + Sync,
Hasher: BuildHasher + Default + Clone + Send + Sync, Hasher: BuildHasher + Default + Clone + Send + Sync,
S: BuildHasher + Clone + Send + Sync,
{ {
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
struct TieBreaker<'a, Id> { struct TieBreaker<'a, Id> {
@@ -596,6 +597,7 @@ where
#[tracing::instrument(level = "trace", skip_all)] #[tracing::instrument(level = "trace", skip_all)]
async fn iterative_auth_check<'a, E, F, Fut, S>( async fn iterative_auth_check<'a, E, F, Fut, S>(
room_version: &RoomVersion, room_version: &RoomVersion,
stateres_version: &StateResolutionVersion,
events_to_check: S, events_to_check: S,
unconflicted_state: StateMap<OwnedEventId>, unconflicted_state: StateMap<OwnedEventId>,
fetch_event: &F, fetch_event: &F,
@@ -620,10 +622,6 @@ where
.boxed() .boxed()
.await?; .await?;
trace!(list = ?events_to_check, "events to check"); trace!(list = ?events_to_check, "events to check");
if events_to_check.is_empty() {
debug!("no events to check, returning unconflicted state");
return Ok(unconflicted_state);
}
let auth_event_ids: HashSet<OwnedEventId> = events_to_check let auth_event_ids: HashSet<OwnedEventId> = events_to_check
.iter() .iter()
@@ -644,11 +642,10 @@ where
trace!(map = ?auth_events.keys().collect::<Vec<_>>(), "fetched auth events"); trace!(map = ?auth_events.keys().collect::<Vec<_>>(), "fetched auth events");
let auth_events = &auth_events; let auth_events = &auth_events;
// NOTE: in state resolution v2.1, auth checks should start with an empty state let mut resolved_state = match stateres_version {
// map. It is the caller's job to do this. Previously, this function would | StateResolutionVersion::V2_1 => StateMap::new(),
// force an empty state map in this case, and this resulted in power events | _ => unconflicted_state,
// going missing from the resolved state as they'd be discarded here. };
let mut resolved_state = unconflicted_state;
for event in events_to_check { for event in events_to_check {
trace!(event_id = event.event_id().as_str(), "checking event"); trace!(event_id = event.event_id().as_str(), "checking event");
let state_key = event let state_key = event
@@ -1036,6 +1033,7 @@ mod tests {
let resolved_power = super::iterative_auth_check( let resolved_power = super::iterative_auth_check(
&RoomVersion::V6, &RoomVersion::V6,
&StateResolutionVersion::V2,
sorted_power_events.iter().map(AsRef::as_ref).stream(), sorted_power_events.iter().map(AsRef::as_ref).stream(),
HashMap::new(), // unconflicted events HashMap::new(), // unconflicted events
&fetcher, &fetcher,
+1 -1
View File
@@ -28,7 +28,7 @@ impl<T: fmt::Debug> fmt::Debug for TruncatedSlice<'_, T> {
/// use conduwuit_core::utils::debug::slice_truncated; /// use conduwuit_core::utils::debug::slice_truncated;
/// ///
/// #[tracing::instrument(fields(foos = slice_truncated(foos, 42)))] /// #[tracing::instrument(fields(foos = slice_truncated(foos, 42)))]
/// fn bar(foos: &[&str]) {}; /// fn bar(foos: &[&str]);
/// ``` /// ```
pub fn slice_truncated<T: fmt::Debug>( pub fn slice_truncated<T: fmt::Debug>(
slice: &[T], slice: &[T],
+15 -1
View File
@@ -10,7 +10,7 @@ use conduwuit::{
use futures::{Stream, StreamExt, TryStreamExt}; use futures::{Stream, StreamExt, TryStreamExt};
use rocksdb::{DBPinnableSlice, ReadOptions}; use rocksdb::{DBPinnableSlice, ReadOptions};
use super::get::handle_from; use super::get::{cached_handle_from, handle_from};
use crate::Handle; use crate::Handle;
pub trait Get<'a, K, S> pub trait Get<'a, K, S>
@@ -58,6 +58,20 @@ where
.try_flatten() .try_flatten()
} }
#[implement(super::Map)]
#[tracing::instrument(name = "batch_cached", level = "trace", skip_all)]
pub(crate) fn get_batch_cached<'a, I, K>(
&self,
keys: I,
) -> impl Iterator<Item = Result<Option<Handle<'_>>>> + Send + use<'_, I, K>
where
I: Iterator<Item = &'a K> + ExactSizeIterator + Send,
K: AsRef<[u8]> + Send + ?Sized + Sync + 'a,
{
self.get_batch_blocking_opts(keys, &self.cache_read_options)
.map(cached_handle_from)
}
#[implement(super::Map)] #[implement(super::Map)]
#[tracing::instrument(name = "batch_blocking", level = "trace", skip_all)] #[tracing::instrument(name = "batch_blocking", level = "trace", skip_all)]
pub(crate) fn get_batch_blocking<'a, I, K>( pub(crate) fn get_batch_blocking<'a, I, K>(
+11 -11
View File
@@ -184,7 +184,7 @@ fn spawn_one(
let handle = thread::Builder::new() let handle = thread::Builder::new()
.name(WORKER_NAME.into()) .name(WORKER_NAME.into())
.stack_size(WORKER_STACK_SIZE) .stack_size(WORKER_STACK_SIZE)
.spawn(move || self.worker(id, &recv))?; .spawn(move || self.worker(id, recv))?;
workers.push(handle); workers.push(handle);
@@ -260,9 +260,9 @@ async fn execute(&self, queue: &Sender<Cmd>, cmd: Cmd) -> Result {
tid = ?thread::current().id(), tid = ?thread::current().id(),
), ),
)] )]
fn worker(self: Arc<Self>, id: usize, recv: &Receiver<Cmd>) { fn worker(self: Arc<Self>, id: usize, recv: Receiver<Cmd>) {
self.worker_init(id); self.worker_init(id);
self.worker_loop(recv); self.worker_loop(&recv);
} }
#[implement(Pool)] #[implement(Pool)]
@@ -309,7 +309,7 @@ fn worker_loop(self: &Arc<Self>, recv: &Receiver<Cmd>) {
self.busy.fetch_add(1, Ordering::Relaxed); self.busy.fetch_add(1, Ordering::Relaxed);
while let Ok(cmd) = self.worker_wait(recv) { while let Ok(cmd) = self.worker_wait(recv) {
Pool::worker_handle(cmd); self.worker_handle(cmd);
} }
} }
@@ -331,11 +331,11 @@ fn worker_wait(self: &Arc<Self>, recv: &Receiver<Cmd>) -> Result<Cmd, RecvError>
} }
#[implement(Pool)] #[implement(Pool)]
fn worker_handle(cmd: Cmd) { fn worker_handle(self: &Arc<Self>, cmd: Cmd) {
match cmd { match cmd {
| Cmd::Get(cmd) if cmd.key.len() == 1 => Pool::handle_get(cmd), | Cmd::Get(cmd) if cmd.key.len() == 1 => self.handle_get(cmd),
| Cmd::Get(cmd) => Pool::handle_batch(cmd), | Cmd::Get(cmd) => self.handle_batch(cmd),
| Cmd::Iter(cmd) => Pool::handle_iter(cmd), | Cmd::Iter(cmd) => self.handle_iter(cmd),
} }
} }
@@ -346,7 +346,7 @@ fn worker_handle(cmd: Cmd) {
skip_all, skip_all,
fields(%cmd.map), fields(%cmd.map),
)] )]
fn handle_iter(mut cmd: Seek) { fn handle_iter(&self, mut cmd: Seek) {
let chan = cmd.res.take().expect("missing result channel"); let chan = cmd.res.take().expect("missing result channel");
if chan.is_canceled() { if chan.is_canceled() {
@@ -375,7 +375,7 @@ fn handle_iter(mut cmd: Seek) {
keys = %cmd.key.len(), keys = %cmd.key.len(),
), ),
)] )]
fn handle_batch(mut cmd: Get) { fn handle_batch(self: &Arc<Self>, mut cmd: Get) {
debug_assert!(cmd.key.len() > 1, "should have more than one key"); debug_assert!(cmd.key.len() > 1, "should have more than one key");
debug_assert!(!cmd.key.iter().any(SmallVec::is_empty), "querying for empty key"); debug_assert!(!cmd.key.iter().any(SmallVec::is_empty), "querying for empty key");
@@ -401,7 +401,7 @@ fn handle_batch(mut cmd: Get) {
skip_all, skip_all,
fields(%cmd.map), fields(%cmd.map),
)] )]
fn handle_get(mut cmd: Get) { fn handle_get(&self, mut cmd: Get) {
debug_assert!(!cmd.key[0].is_empty(), "querying for empty key"); debug_assert!(!cmd.key[0].is_empty(), "querying for empty key");
// Obtain the result channel. // Obtain the result channel.
+2 -2
View File
@@ -25,13 +25,13 @@ pub(super) fn refutable(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream>
}; };
let name = format!("_args_{i}"); let name = format!("_args_{i}");
**pat = Pat::Ident(PatIdent { *pat = Box::new(Pat::Ident(PatIdent {
ident: Ident::new(&name, Span::call_site().into()), ident: Ident::new(&name, Span::call_site().into()),
attrs: Vec::new(), attrs: Vec::new(),
by_ref: None, by_ref: None,
mutability: None, mutability: None,
subpat: None, subpat: None,
}); }));
let field = fields.iter(); let field = fields.iter();
let refute = quote! { let refute = quote! {
+4 -3
View File
@@ -62,8 +62,7 @@ standard = [
"media_thumbnail", "media_thumbnail",
"systemd", "systemd",
"url_preview", "url_preview",
"zstd_compression", "zstd_compression"
"sentry_telemetry"
] ]
full = [ full = [
"standard", "standard",
@@ -130,6 +129,7 @@ perf_measurements = [
"dep:tracing-opentelemetry", "dep:tracing-opentelemetry",
"dep:opentelemetry_sdk", "dep:opentelemetry_sdk",
"dep:opentelemetry-otlp", "dep:opentelemetry-otlp",
"dep:opentelemetry-jaeger-propagator",
"conduwuit-core/perf_measurements", "conduwuit-core/perf_measurements",
"conduwuit-core/sentry_telemetry", "conduwuit-core/sentry_telemetry",
] ]
@@ -201,7 +201,6 @@ conduwuit-core.workspace = true
conduwuit-database.workspace = true conduwuit-database.workspace = true
conduwuit-router.workspace = true conduwuit-router.workspace = true
conduwuit-service.workspace = true conduwuit-service.workspace = true
conduwuit-build-metadata.workspace = true
clap.workspace = true clap.workspace = true
console-subscriber.optional = true console-subscriber.optional = true
@@ -213,6 +212,8 @@ opentelemetry.optional = true
opentelemetry.workspace = true opentelemetry.workspace = true
opentelemetry-otlp.optional = true opentelemetry-otlp.optional = true
opentelemetry-otlp.workspace = true opentelemetry-otlp.workspace = true
opentelemetry-jaeger-propagator.optional = true
opentelemetry-jaeger-propagator.workspace = true
opentelemetry_sdk.optional = true opentelemetry_sdk.optional = true
opentelemetry_sdk.workspace = true opentelemetry_sdk.workspace = true
sentry-tower.optional = true sentry-tower.optional = true
+1 -1
View File
@@ -94,7 +94,7 @@ pub(crate) fn init(
let otlp_layer = config.allow_otlp.then(|| { let otlp_layer = config.allow_otlp.then(|| {
opentelemetry::global::set_text_map_propagator( opentelemetry::global::set_text_map_propagator(
opentelemetry_sdk::propagation::TraceContextPropagator::new(), opentelemetry_jaeger_propagator::Propagator::new(),
); );
let exporter = opentelemetry_otlp::SpanExporter::builder() let exporter = opentelemetry_otlp::SpanExporter::builder()
+1 -21
View File
@@ -1,12 +1,10 @@
#![cfg(feature = "sentry_telemetry")] #![cfg(feature = "sentry_telemetry")]
use std::{ use std::{
borrow::Cow,
str::FromStr, str::FromStr,
sync::{Arc, OnceLock}, sync::{Arc, OnceLock},
}; };
use conduwuit_build_metadata as build;
use conduwuit_core::{config::Config, debug, trace}; use conduwuit_core::{config::Config, debug, trace};
use sentry::{ use sentry::{
Breadcrumb, ClientOptions, Level, Breadcrumb, ClientOptions, Level,
@@ -46,7 +44,7 @@ fn options(config: &Config) -> ClientOptions {
server_name, server_name,
traces_sample_rate: config.sentry_traces_sample_rate, traces_sample_rate: config.sentry_traces_sample_rate,
debug: cfg!(debug_assertions), debug: cfg!(debug_assertions),
release: release_name(), release: sentry::release_name!(),
user_agent: conduwuit_core::version::user_agent().into(), user_agent: conduwuit_core::version::user_agent().into(),
attach_stacktrace: config.sentry_attach_stacktrace, attach_stacktrace: config.sentry_attach_stacktrace,
before_send: Some(Arc::new(before_send)), before_send: Some(Arc::new(before_send)),
@@ -93,21 +91,3 @@ fn before_breadcrumb(crumb: Breadcrumb) -> Option<Breadcrumb> {
trace!("Sentry breadcrumb: {crumb:?}"); trace!("Sentry breadcrumb: {crumb:?}");
Some(crumb) Some(crumb)
} }
fn release_name() -> Option<Cow<'static, str>> {
static RELEASE: OnceLock<Option<String>> = OnceLock::new();
RELEASE
.get_or_init(|| {
let pkg_name = env!("CARGO_PKG_NAME");
let pkg_version = env!("CARGO_PKG_VERSION");
if let Some(commit_short) = build::GIT_COMMIT_HASH_SHORT {
Some(format!("{pkg_name}@{pkg_version}+{commit_short}"))
} else {
Some(format!("{pkg_name}@{pkg_version}"))
}
})
.as_ref()
.map(|s| Cow::Borrowed(s.as_str()))
}
+1 -1
View File
@@ -108,7 +108,7 @@ rustyline-async.workspace = true
rustyline-async.optional = true rustyline-async.optional = true
serde_json.workspace = true serde_json.workspace = true
serde.workspace = true serde.workspace = true
serde-saphyr.workspace = true serde_yml.workspace = true
sha2.workspace = true sha2.workspace = true
termimad.workspace = true termimad.workspace = true
termimad.optional = true termimad.optional = true
+1 -1
View File
@@ -271,7 +271,7 @@ impl Service {
.id_appserviceregistrations .id_appserviceregistrations
.get(id) .get(id)
.await .await
.and_then(|ref bytes| serde_saphyr::from_slice(bytes).map_err(Into::into)) .and_then(|ref bytes| serde_yml::from_slice(bytes).map_err(Into::into))
.map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}"))) .map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}")))
} }
+3 -1
View File
@@ -188,7 +188,9 @@ impl Service {
} }
#[tracing::instrument(skip(self), level = "debug")] #[tracing::instrument(skip(self), level = "debug")]
pub fn all_local_aliases(&self) -> impl Stream<Item = (&RoomId, &str)> + Send + '_ { pub fn all_local_aliases<'a>(
&'a self,
) -> impl Stream<Item = (&'a RoomId, &'a str)> + Send + 'a {
self.db self.db
.alias_roomid .alias_roomid
.stream() .stream()