Dormant company-rotation mode (publicRotationMode=chain, root #2) + multi-root teamRootId alert gating - founders' deal 2026-08-19, flip deferred until team link migration + Marty's right-leg position secured

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-19 12:39:01 -05:00
parent c64a716fcd
commit e31b01e338
2 changed files with 32 additions and 5 deletions
+16 -1
View File
@@ -667,6 +667,21 @@ function getOrgShare(rootId) {
};
}
// Company-rotation pick: breadth-first (matrix order, left→right) first
// position under `rootId` that still needs directs — the "next open team
// position" for the public rotation when publicRotationMode==='chain'.
function nextOpenPosition(rootId) {
if (!state || !state.snapshotAt) return null;
const q = [rootId]; const seen = new Set();
while (q.length) {
const id = q.shift(); if (seen.has(id)) continue; seen.add(id);
const m = state.members[id]; if (!m) continue;
if ((m.directCount || 0) < 2) return { id, directCount: m.directCount || 0, level: levelName(m.level || 1) };
if (m.l) q.push(m.l); if (m.r) q.push(m.r);
}
return null;
}
// Coaching radar: triage every member below `rootId` into actionable tiers.
// - atRisk: money forming in their leg that they can't catch yet (corrected
// rule: catcher must be qualified AND at the level being bought)
@@ -720,4 +735,4 @@ async function getIncome(id) {
};
}
module.exports = { startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, balanceOf, CONTRACT };
module.exports = { startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, nextOpenPosition, balanceOf, CONTRACT };