OverviewFilesCommitsIssuesDocsReleasesPeers

favela-android commits / c73eab7

say why the roster repair declined
It logged on success and on throw, and did neither — so a skip was indistinguishable from never having run, and localising it meant guessing at which term of the condition was false. That is the same silent-refusal shape as the write path that 500'd with the reason in a body nobody read; it should not have been reproduced an hour later in code written to fix it. Now it reports the inputs to the decision: whether the entry exists, how many members the local config already names, and whether the room is readable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
c73eab707278226b00e206d83f981405055e7336
by plankatron <fleeky@gmail.com> · 2026-08-12T00:39:40.000Z

Changed files (1) +9 -2

lib/node.js +9 -2
……@@ -116,12 +116,19 @@ async function boot () {
116116 // populated comma-string roster as empty is how you overwrite a real one. And back the file up
117117 // first: this rewrites the file that names the identity.
118118 try {
119 const { rosterIsEmpty } = await import('./roster.js')
119 const { rosterIsEmpty, rosterKeys } = await import('./roster.js')
120120 const entry0 = (cfg.dids || [])[0]
121121 const node0 = state.hpp && state.hpp.nodes && state.hpp.nodes[0]
122 if (entry0 && rosterIsEmpty(entry0) && node0 && node0.device && typeof node0.device.membersDiag === 'function') {
122 // SAY WHY IT DECLINED. The first cut logged only on success and only on throw, so when it did
123 // neither it was indistinguishable from not having run — the exact failure mode (a branch that
124 // refuses silently) that made the write-path 500 take an evening to localise. A repair that
125 // skips must report which condition stopped it.
126 const can = !!(node0 && node0.device && typeof node0.device.membersDiag === 'function')
127 log('local roster check', { entryPresent: !!entry0, localMembers: rosterKeys(entry0).length, canReadRoom: can })
128 if (entry0 && rosterIsEmpty(entry0) && can) {
123129 const md = await node0.device.membersDiag()
124130 const inView = Object.keys((md && md.membersInView) || {})
131 log('room reports members', { inView: inView.length })
125132 if (inView.length) {
126133 fs.copyFileSync(cfgPath, cfgPath + '.bak.' + Date.now())
127134 entry0.members = inView