Which end of a Matrix call offers now has a test where the rule lives, and nobilis carries the test review: every test read, the ones that could not fail made to, and the faults they were hiding fixed

The offering rule was only ever tested through a copy of it compiled for the daemon's tests; the window's own is checked here, including that two devices of one person tell each other apart and that nobody offers to themselves.

nobilis: ddd4503

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-10-11 16:14:00 -04:00
co-authored by Claude Sonnet 5.5
parent 47653c5f7f
commit 09c060df51
2 changed files with 22 additions and 1 deletions
+1 -1
Submodule nobilis updated: b522fe63eb...b3e92b5db6
+21
View File
@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest'
import { shouldOffer } from './matrixcall'
describe('which end of a Matrix call offers', () => {
it('is exactly one end of every pair, whichever way round they ask', () => {
// Both ends compute this about each other and must not agree, or the call
// collides with itself.
expect(shouldOffer('@a:example.org|AAA', '@b:example.org|BBB')).toBe(true)
expect(shouldOffer('@b:example.org|BBB', '@a:example.org|AAA')).toBe(false)
})
it('tells two devices of the same person apart', () => {
// The case that makes a user-id comparison alone wrong.
expect(shouldOffer('@a:example.org|AAA', '@a:example.org|ZZZ')).toBe(true)
expect(shouldOffer('@a:example.org|ZZZ', '@a:example.org|AAA')).toBe(false)
})
it('never has an end offer to itself', () => {
expect(shouldOffer('@a:example.org|AAA', '@a:example.org|AAA')).toBe(false)
})
})