Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: count the outcome 'older' remainder against the full population (#2689)

[._.]/ Adam Eivy2989263a0d6c
diff --git a/client/src/components/apps/LayeredIntelligenceOutcomes.jsx b/client/src/components/apps/LayeredIntelligenceOutcomes.jsx
index a20488c6d2..802383746f 100644
--- a/client/src/components/apps/LayeredIntelligenceOutcomes.jsx
+++ b/client/src/components/apps/LayeredIntelligenceOutcomes.jsx
@@ -95,13 +95,15 @@ export default function LayeredIntelligenceOutcomes({ appId }) {
);
}
- const counts = { ...stats, pending: stats.pending };
const mergeRateText = stats.mergeRate == null ? '—' : `${Math.round(stats.mergeRate)}%`;
const rejectionEntries = Array.isArray(rejections?.entries) ? rejections.entries : [];
const unknown = rejections?.unknown || 0;
const unclassified = rejections?.unclassified || 0;
const visible = Array.isArray(recent) ? recent.slice(0, RECENT_VISIBLE) : [];
- const hiddenCount = (Array.isArray(recent) ? recent.length : 0) - visible.length;
+ // Count against the FULL population (`stats.total`), not just the fetched slice:
+ // the API caps `recent` at a limit above what we render, so `recent.length` would
+ // undercount the real remainder for an app with a long proposal history.
+ const hiddenCount = Math.max(0, stats.total - visible.length);
return (
<div className="space-y-3 bg-port-bg border border-port-border rounded-lg px-3 py-3">
@@ -123,7 +125,7 @@ export default function LayeredIntelligenceOutcomes({ appId }) {
const meta = OUTCOME_META[key];
return (
<span key={key} className="flex items-center gap-1">
- <span className={meta.className}>{counts[key]}</span>
+ <span className={meta.className}>{stats[key]}</span>
<span className="text-gray-500">{meta.label.toLowerCase()}</span>
</span>
);
diff --git a/client/src/components/apps/LayeredIntelligenceOutcomes.test.jsx b/client/src/components/apps/LayeredIntelligenceOutcomes.test.jsx
index 3e74e6eeeb..4d2bd554b0 100644
--- a/client/src/components/apps/LayeredIntelligenceOutcomes.test.jsx
+++ b/client/src/components/apps/LayeredIntelligenceOutcomes.test.jsx
@@ -84,15 +84,20 @@ describe('LayeredIntelligenceOutcomes', () => {
expect(await screen.findByText(/Couldn.t load proposal outcomes/)).toBeInTheDocument();
});
- it('collapses recent rows past the visible cap to a count', async () => {
+ it('collapses the remainder to a count against the full population, not the fetched slice', async () => {
+ // 9 rows fetched, 30 filed total: the "+N older" must count the true remainder
+ // (30 - 6 rendered = 24), not just what was hidden within the returned slice.
const many = Array.from({ length: 9 }, (_, i) => ({
slug: `item-${i}`, scope: 'app-improvement', outcome: 'merged', rejectionReason: null,
filedAt: `2026-07-0${(i % 9) + 1}T00:00:00.000Z`, outcomeAt: `2026-07-0${(i % 9) + 1}T00:00:00.000Z`
}));
- getAppLayeredIntelligenceOutcomes.mockResolvedValue(ready({ recent: many }));
+ getAppLayeredIntelligenceOutcomes.mockResolvedValue(ready({
+ stats: { total: 30, merged: 30, rejected: 0, abandoned: 0, pending: 0, resolved: 30, mergeRate: 100 },
+ recent: many
+ }));
render(<LayeredIntelligenceOutcomes appId="app-001" />);
await waitFor(() => expect(screen.getByText('item-0')).toBeInTheDocument());
- expect(screen.getByText('+3 older')).toBeInTheDocument();
+ expect(screen.getByText('+24 older')).toBeInTheDocument();
});
});