Commit graph

1255 commits

Author SHA1 Message Date
Jacob Taylor
879c8e527b revert get extremity locking 2025-09-06 10:36:19 -07:00
Jacob Taylor
098eb8abca Merge remote-tracking branch 'origin/main' into illegal-car-mods 2025-09-06 10:19:59 -07:00
Jade Ellis
1d7dda6cf5
chore: Upgrade ctor, cbor 2025-09-06 16:19:56 +01:00
Tom Foster
b5a2e49ae4 fix: Resolve Clippy CI failures from elided lifetime warnings
The latest Rust nightly compiler (2025-08-27) introduced the
elided-named-lifetimes lint which causes Clippy CI checks to fail
when an elided lifetime ('_) resolves to a named lifetime that's
already in scope.

This commit fixes the Clippy warnings by:
- Making lifetime relationships explicit where 'a is already in scope
- Keeping elided lifetimes ('_) in functions without explicit
  lifetime parameters
- Ensuring proper lifetime handling in the database pool module

Affected files (17 total):
- Database map modules: Handle, Key, and KeyVal references in get,
  qry, keys, and stream operations
- Database pool module: into_recv_seek function

This change resolves the CI build failures without changing any
functionality, ensuring the codebase remains compatible with the
latest nightly Clippy checks.
2025-08-28 21:13:19 +01:00
Jacob Taylor
60b8c9f5f2 turns out we need debug_warn 2025-08-26 18:42:40 -07:00
Jacob Taylor
c83f1ddb71 add event_id to log entry 2025-08-26 18:39:37 -07:00
Jacob Taylor
a75eacd544 reduce log volume (keeps 2 infos)
adjust log volume

demote a bunch of logs
2025-08-26 18:39:37 -07:00
Jacob Taylor
e15d71d230 log which room is being backfilled
move more backfill log to info, clean up imports
2025-08-26 18:38:49 -07:00
Jacob Taylor
a7929c1931 fix warn by removing unused debug imports
delete more imports to quiet cargo
2025-08-26 18:36:39 -07:00
Jacob Taylor
7d9b514696 fix warn by removing unused debug imports 2025-08-26 18:10:08 -07:00
Jacob Taylor
4baf48e214 exponential backoff is now just bees. did you want bees? no? well you have them now. congrats 2025-08-26 18:10:08 -07:00
Jacob Taylor
6483e984ce fix too many infos 2025-08-26 18:10:08 -07:00
Jacob Taylor
3e9cf3f494 vehicle loan documentation now available at window 7 2025-08-26 18:10:08 -07:00
Jacob Taylor
1e4cf59ab8 lock the getter instead ??? c/o M 2025-08-26 18:10:08 -07:00
nexy7574
43574118aa Fix room ID check 2025-08-26 18:10:07 -07:00
Jacob Taylor
a57df9af37 upgrade some settings to enable 5g in continuwuity
enable converged 6g at the edge in continuwuity

better stateinfo_cache_capacity default

better roomid_spacehierarchy_cache_capacity

make sender workers default better and clamp value to core count

update sender workers documentation

add more parallelism_scaled and make them public

update 1 document
2025-08-26 18:10:07 -07:00
nexy7574
3183210459
fix: Post-merge compile issues 2025-08-23 21:28:31 +01:00
Jade Ellis
0ed691edef fix: Make builds without LDAP work correctly 2025-08-23 19:59:36 +00:00
RatCornu
c7adbae03f feat: ldap login 2025-08-23 19:59:36 +00:00
nexy7574
4085a90c1f
feat(fed): Something about nicer fed errors 2025-08-20 00:56:55 +01:00
nexy7574
255aa44ecc
fix(fed): Alter log levels to be less noisy 2025-08-15 04:20:03 +01:00
nexy7574
04130dcdd8
fix(fed): Improve transaction flushing 2025-08-15 04:11:54 +01:00
Tom Foster
583cb924f1 refactor: address code review feedback for auth and pagination improvements
- Extract duplicated thread/message pagination functions to shared utils module
- Refactor pagination token parsing to use Option combinators instead of defaults
- Split access token generation from assignment for clearer error handling
- Add appservice token collision detection at startup and registration
- Allow appservice re-registration with same token (for config updates)
- Simplify thread relation chunk building using iterator chaining
- Fix saturating_inc edge case in relation queries with explicit filtering
- Add concise comments explaining non-obvious behaviour choices
2025-08-12 05:29:41 +01:00
Tom Foster
9286838d23 fix(relations): improve thread pagination and include root event
Replace unreliable PduCount pagination tokens with ShortEventId throughout
the relations and messages endpoints. ShortEventId provides stable, unique
identifiers that persist across server restarts and database operations.

Key improvements:
- Add token parsing helpers that try ShortEventId first, fall back to
  PduCount for backwards compatibility
- Include thread root event when paginating backwards to thread start
- Fix off-by-one error in get_relations that was returning the starting
  event in results
- Only return next_batch/prev_batch tokens when more events are available,
  preventing clients from making unnecessary requests at thread boundaries
- Ensure consistent token format between /relations, /messages, and /sync
  endpoints for interoperability

This fixes duplicate events when scrolling at thread boundaries and ensures
the thread root message is visible when viewing a thread, matching expected
client behaviour.
2025-08-10 19:12:56 +01:00
Tom Foster
d1ebcfaf0b fix(auth): prevent token collisions and optimise lookups
Ensures access tokens are unique across both user and appservice tables to
prevent authentication ambiguity and potential security issues.

Changes:
- On startup, automatically logout any user devices using tokens that
  conflict with appservice tokens (resolves in favour of appservices)
  and log a warning with affected user/device details
- When creating new user tokens, check for conflicts with appservice tokens
  and generate a new token if a collision would occur
- When registering new appservices, reject registration if the token is
  already in use by a user device
- Use futures::select_ok to race token lookups concurrently for better
  performance (adapted from tuwunel commit 066097a8)

This fix-forward approach resolves existing token collisions on startup
whilst preventing new ones from being created, without breaking existing
valid authentications.

The find_token optimisation is adapted from tuwunel (matrix-construct/tuwunel)
commit 066097a8: "Optimize user and appservice token queries" by Jason Volk.
2025-08-10 17:10:06 +01:00
Tom Foster
e820551f62 fix(appservice): create sender_localpart user during appservice startup
Fixes #813: Application services were unable to work because their sender_localpart
user was never created in the database, preventing authentication.

This fix ensures the appservice user account is created when:
- The server starts up and loads existing appservices from the database
- A new appservice is registered via the admin command

Additionally, if an appservice user has been accidentally deactivated, it will be
automatically reactivated when the appservice starts.

The solution centralises all appservice startup logic into a single `start_appservice`
helper method, eliminating code duplication between the registration and startup paths.
2025-08-10 17:10:06 +01:00
nexy7574
e4a43b1a5b
fix(policy-server): Call the PS later in the PDU creation process
This avoids accidentally sending partially built PDUs to the policy server,
which may cause issues with some implementations
2025-08-02 00:19:33 +01:00
nexy7574
f32f60d056
fix(policy-server): Return the correct result when an event is marked as spam
Some checks failed
Documentation / Build and Deploy Documentation (push) Has been skipped
Checks / Prefligit / prefligit (push) Failing after 1s
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 3s
Checks / Rust / Clippy (push) Failing after 28s
Checks / Rust / Cargo Test (push) Failing after 27s
2025-07-23 18:01:46 +01:00
nexy7574
fe06d78c8e
fix(policy-server): Update ask_policy_server docstring 2025-07-23 17:58:33 +01:00
nexy7574
f335f45017
feat(policy-server): Add configurable timeout 2025-07-23 17:49:08 +01:00
nexy7574
1726633c0f
fix(policy-server): Fixup refactor 2025-07-23 17:49:08 +01:00
nexy7574
dfda27fadc
feat(policy-server): Don't fail-closed & refactor references 2025-07-23 17:49:08 +01:00
Jade Ellis
9465c5df1f
style: Improve logging and comments 2025-07-23 17:49:07 +01:00
nexy7574
2d475b1220
style(policy-server): Run clippy 2025-07-23 17:49:07 +01:00
nexy7574
d7fa624fd2
feat(policy-server): Optimise policy server lookups 2025-07-23 17:49:07 +01:00
nexy7574
cc9202b0c4
feat(policy-server): Limit policy server request timeout to 10 seconds 2025-07-23 17:49:07 +01:00
nexy7574
a3d62ed0d9
feat(policy-server): Prevent local events that fail the policy check 2025-07-23 17:49:07 +01:00
nexy7574
78b7175677
feat(policy-server): Soft-fail redactions for failed events 2025-07-23 17:49:07 +01:00
nexy7574
74d60f256b
style(policy-server): Restructure logging 2025-07-23 17:49:07 +01:00
nexy7574
732c69f5ca
fix(policy-server): Avoid unnecessary database lookup 2025-07-23 17:49:07 +01:00
nexy7574
8e7801f323
chore: Update ruwuma & fix lints 2025-07-23 17:49:06 +01:00
nexy7574
9017efe45b
feat(policy-server): Policy server following 2025-07-23 17:49:06 +01:00
Jade Ellis
6d29098d1a
refactor: Replace remaining std RwLocks 2025-07-20 16:33:36 +01:00
Jade Ellis
374fb2745c
refactor: Replace remaining std Mutexes 2025-07-20 16:32:48 +01:00
Jade Ellis
a1d616e3e3
refactor: Replace std RwLock with parking_lot 2025-07-20 16:31:55 +01:00
rooot
9051ce63f7
feat(config): introduce federation connection timeout setting
fixes #906

Signed-off-by: rooot <hey@rooot.gay>
2025-07-20 16:24:26 +01:00
nexy7574
c639228f4d
style(space-upgrades): Remove unused import left over from 6691b7672b
Some checks failed
Documentation / Build and Deploy Documentation (push) Has been skipped
Checks / Prefligit / prefligit (push) Failing after 4s
Release Docker Image / define-variables (push) Failing after 2s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 1s
Checks / Rust / Clippy (push) Failing after 22s
Checks / Rust / Cargo Test (push) Failing after 21s
2025-07-19 18:37:45 +01:00
nexy7574
b2b18002ea
fix(space-upgrades): Remove unused helper function 2025-07-19 18:37:45 +01:00
nexy7574
b2883c3d6e
feat(space-upgrades): Update parent spaces in upgrade
This relies on the room being upgraded referencing
the space itself, but there isn't an easy way to
do it otherwise.
2025-07-19 18:35:58 +01:00
nexy7574
ce84c46459
style(902): Fix clippy complaining about cast
Some checks failed
Documentation / Build and Deploy Documentation (push) Has been skipped
Checks / Prefligit / prefligit (push) Failing after 1s
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 3s
Checks / Rust / Clippy (push) Failing after 8s
Checks / Rust / Cargo Test (push) Failing after 11s
2025-07-09 15:28:31 +01:00