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

state the activity grid's day-stepping and heatmap legend in terms of their own invariants

[._.]/ Adam Eivy378dcf34134b
diff --git a/client/src/components/CosDashboardWidget.jsx b/client/src/components/CosDashboardWidget.jsx
index 9c7b19ea07..4b252b117d 100644
--- a/client/src/components/CosDashboardWidget.jsx
+++ b/client/src/components/CosDashboardWidget.jsx
@@ -405,13 +405,14 @@ function ActivityCalendar({ data }) {
<span className="text-white font-medium">{formatCount(data.summary.totalTasks)}</span> runs,{' '}
<span className="text-white font-medium">{data.summary.avgTasksPerActiveDay}</span>/active day
</span>
- {/* Mini Legend */}
+ {/* Mini Legend — derived from the same table the cells use, so it
+ cannot drift from the scale it claims to explain. */}
<div className="flex items-center gap-0.5">
<span className="mr-1 hidden sm:inline">Less</span>
<div className="w-2 h-2 rounded-xs bg-port-border/20" />
- <div className="w-2 h-2 rounded-xs bg-emerald-900/50" />
- <div className="w-2 h-2 rounded-xs bg-emerald-500/70" />
- <div className="w-2 h-2 rounded-xs bg-emerald-400" />
+ {HEATMAP_SHADES.slice(1).map((shade) => (
+ <div key={shade} className={`w-2 h-2 rounded-xs ${shade}`} />
+ ))}
<span className="ml-1 hidden sm:inline">More</span>
</div>
</div>
diff --git a/server/services/cosActivityCalendar.js b/server/services/cosActivityCalendar.js
index 94ab4b8b3f..65c3519e47 100644
--- a/server/services/cosActivityCalendar.js
+++ b/server/services/cosActivityCalendar.js
@@ -53,8 +53,6 @@ import { loadAgentIndex } from './cosAgentIndex.js';
*/
const dayKey = (date) => date.toISOString().slice(0, 10);
-const MS_PER_DAY = 86400000;
-
/**
* Completed runs per day, from `sinceStr` forward, across both stores.
*
@@ -119,7 +117,12 @@ export async function getActivityCalendar(weeks = 12) {
let totalTasks = 0;
for (let i = 0; i < weeks * 7; i++) {
- const date = dayKey(new Date(start.getTime() + i * MS_PER_DAY));
+ // Calendar arithmetic, not epoch-ms stepping. Both are exact here (`start`
+ // is UTC midnight and UTC has no DST), but this form says "the i-th day
+ // after start" without asking the reader to know that.
+ const cursor = new Date(start);
+ cursor.setUTCDate(start.getUTCDate() + i);
+ const date = dayKey(cursor);
const isFuture = date > todayStr;
const tasks = isFuture ? 0 : (counts.get(date) || 0);