Repository navigation
feat(newtab): one leader row with machine, direct-report attention and linear aggregation - #34101
teamleaderleo wants to merge 9 commits into
Conversation
Reproducible synthetic report-fan-out benchmark (Node 22)This is the isolated Map-bucket aggregation from import { performance } from "node:perf_hooks";
const oldGather = (rows) => {
const reports = new Map();
for (const entry of rows) {
const at = "huge-blue\\0leader";
reports.set(at, [...(reports.get(at) ?? []), entry]);
}
return reports.get("huge-blue\\0leader");
};
const newGather = (rows) => {
const reports = new Map();
for (const entry of rows) {
const at = "huge-blue\\0leader";
const group = reports.get(at);
if (group) group.push(entry);
else reports.set(at, [entry]);
}
return reports.get("huge-blue\\0leader");
};
const median = (fn, rows) => {
const times = [];
for (let i = 0; i < 9; i++) {
const start = performance.now();
const out = fn(rows);
const elapsed = performance.now() - start;
if (out.length !== rows.length) throw new Error("lost reports");
times.push(elapsed);
}
times.sort((a, b) => a - b);
return times[4].toFixed(3);
};
for (const n of [1_000, 3_000, 10_000]) {
const rows = Array.from({ length: n }, (_, i) => ({ sessionId: `lane-${i}` }));
console.log(n, median(oldGather, rows), median(newGather, rows));
}Observed medians on the isolated environment (ms):
All cases assert the output length; the committed |
|
Found 4 test failures on Blacksmith runners: Failures
|
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Probably yours: CI stopped on
Failures:
Matched log linesNot re-run automatically: Written by red: web / Web status; a job it gathers is red on this change (its line here); do not merge until green; see lane-rules |
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Brief 18 — one leader row with machine and attention, even at thousands of sessions
Source-backed follow-up to HQ #6236 brief 18 and the already merged Leads #32103 / duplicate-group cleanup #32107. Original base:
feat-cmux-next@6c3fe3648ba4b44e7bf38c4982a665ec2d5d5712.Problem / why this is a bounded change
The New Tab All view repeated a working leader in both Leads and Active. Leads displayed only a report count, leaving its machine and direct reports awaiting human input invisible. The TypeScript
leaders()builder copied the entire accumulated report array for every new report, O(k²) for one large reporting group. HQ #4878 documents a real census of 3,055 sessions, including 38 streaming, so fan-out costs deserve attention.Change
Needs input (N)for itself plus direct reporters explicitly markedindicator: input. Preserve existing translations for report count and input label.peeron live-chat cards for identity-safe React keys and list deduplication.Validation and evidence tier
Source change + authored tests; app test execution pending. This connector session has GitHub write access but no Bun/React app environment or approved live machine, so I did not claim a full web suite, signed build, or runtime capture. Run:
An isolated Node 22 synthetic 3,000-report fan-out benchmark (9 trials, median) improved from 5.617 ms with repeated spreads to 0.025 ms with appended arrays. This is a focused algorithm measurement, not a NEXT app CPU or wall-clock improvement claim. The meaningful verification is the web suite and a New Tab gallery/capture on the merged app head.
Boundaries / review requests
onOpenSessioncallschat.select({sessionId})with the bare ID. Distinct React keys and deduplication prevent visual collisions here but do not solve wrong-chat opening between peers. Address with peer-qualified selection all the way through the host before promising safe cross-machine navigation.lane.reportsToderives local-daemon direct reporting only; remote-to-remote delegation, nested leadership and stale/disconnected peer status still need explicit coverage. CurrentNeeds inputcount deliberately excludes errors and ambiguous offline signals.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the New Tab All view so each working leader appears once, in Leads, showing its machine and how many direct reports need input — previously leaders were duplicated in Leads and Active, and Leads showed only a report count. Also removes the O(k²) cost of accumulating large report groups in the leader builder.
Refactors
Written for commit ebd3696. Summary will update on new commits.