3.1 KiB
PR#92: MatrixSource at a Mutation-CRAP of at Most 15
Version: patch
WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
Related Links
- werkregie PR#91,
matrix react, which stops the relay for each reaction.
Problem
matrix react needs sync.lock, which the running relay holds; an agent stops the relay for about 50 s per reaction.
The relay is to send the reaction itself, which changes sources/MatrixSource.kt.
A branch fails on each method above a Mutation-CRAP of 15 in a class it changes;
9 of its methods are above, MatrixSource.message at 812 on main, the highest of the nightly ratchet:
a complexity of 28 without a killed mutant, since only a homeserver could drive it.
Non-Goals
- No change of behaviour.
- No reaction through the relay yet; that is the follow-up PR.
Specification
None; the behaviour stays the same.
Solution
The decisions move out of MatrixSource into functions that tests reach without a client;
what stays in MatrixSource is the glue to Trixnity, at a complexity of at most 3,
so that it stays at most 12 without a killed mutant (3² + 3).
MatrixEvents, new: whatMatrixSourcetakes from Trixnity, tested with Trixnity's own data classes:incomingdecides which event is a message of someone else,messagebuilds theMatrixMessagefrom event, room and members,receiptTimetakes the newest read receipt,baseUrlandisUrlthe homeserver,crossSignedthe trust level of the device.MatrixMessages, free of the client library:unread,roomOf,readIn,encryptedanddecrypted.MatrixSource:decryptAgainhands each row todecrypted;loginandverifytake the lock bylocked, which the follow-up PR also uses;verifyWithtakes its checks fromcheckVerified,verifyBy,byRecoveryKeyandbyPassphrase;syncErrornames the cause of an ended sync.- New tests in MatrixEventsTest, MatrixMessagesTest and MatrixSourceTest.
pitestPartial mutationCrapCheckagainst main: the highest Mutation-CRAP ofMatrixSourceis 12, ofMatrixEvents11 (incoming, all mutants killed).
The ratchet of the nightly run falls from 812 to 272, now CodexSource.fetch;
the change of dashboard/build.gradle.kts makes the check stricter, not weaker.
Open Questions
None.
Follow-up PRs
- werkregie PR#93:
matrix reactno longer needs a stop of the relay. The relay, which holdssync.lock, sends the reaction with its own Matrix client, on request through a local socket. That PR changesMatrixSource, so it needs the limit of 15 that this PR reaches.