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

address review (self): drop speculative level-alias remaps

[._.]/ Adam Eivye8697b7084de
diff --git a/client/src/components/city/CityIntelPane.jsx b/client/src/components/city/CityIntelPane.jsx
index 9bcf3a0ea0..e4a18a765b 100644
--- a/client/src/components/city/CityIntelPane.jsx
+++ b/client/src/components/city/CityIntelPane.jsx
@@ -277,6 +277,7 @@ function TimelineView({ logs }) {
</div>
<div className="flex items-end gap-px h-8" title="Event density over the last 10 minutes">
{density.map((slot, i) => {
+ // Floor non-empty bins at 12% so a single event is still visible.
const heightPct = slot.count > 0 ? Math.max(12, (slot.count / maxCount) * 100) : 0;
const colorClass = slot.level ? (DENSITY_BAR_COLORS[slot.level] || DENSITY_BAR_COLORS.info) : 'bg-cyan-500/10';
return (
diff --git a/client/src/utils/cityTimeline.js b/client/src/utils/cityTimeline.js
index 9aee3afa5a..bb73cbe39f 100644
--- a/client/src/utils/cityTimeline.js
+++ b/client/src/utils/cityTimeline.js
@@ -6,17 +6,15 @@
// and grouping them into relative-age buckets. Both transforms are pure so
// they can be unit-tested without a DOM (mirrors cityFilter.js).
-// Newest-first, only events with a usable timestamp, capped so a runaway log
-// can't blow up the render. `now` is injectable for deterministic tests.
+// Default cap on events the timeline considers, so a runaway log can't blow
+// up the render. `now` is injectable into both transforms for deterministic tests.
const MAX_TIMELINE_EVENTS = 40;
-const normalizeLevel = (level) => {
- const l = (level || 'info').toLowerCase();
- if (l === 'warning') return 'warn';
- if (l === 'err' || l === 'fatal') return 'error';
- if (l === 'ok' || l === 'done') return 'success';
- return l;
-};
+// Lower-case so lookups against the lower-cased color maps in CityIntelPane
+// stay robust; the cos:log stream only emits info/warn/error/success/debug, so
+// unknown values just fall through to the maps' info default (same as the
+// sibling ACTIVITY tab).
+const normalizeLevel = (level) => (level || 'info').toLowerCase();
const eventTime = (log) => {
const t = new Date(log?.timestamp ?? NaN).getTime();
diff --git a/client/src/utils/cityTimeline.test.js b/client/src/utils/cityTimeline.test.js
index 7709f38e32..3709bde396 100644
--- a/client/src/utils/cityTimeline.test.js
+++ b/client/src/utils/cityTimeline.test.js
@@ -95,15 +95,15 @@ describe('buildTimelineBuckets', () => {
expect(total).toBe(10);
});
- it('normalizes level aliases', () => {
+ it('lower-cases the level and defaults a missing one to info', () => {
const logs = [
- { _localId: 1, timestamp: secsAgo(1), level: 'warning', message: 'w' },
- { _localId: 2, timestamp: secsAgo(2), level: 'OK', message: 'o' },
+ { _localId: 1, timestamp: secsAgo(1), level: 'WARN', message: 'w' },
+ { _localId: 2, timestamp: secsAgo(2), message: 'no-level' },
];
const buckets = buildTimelineBuckets(logs, { now: NOW });
const levels = buckets.flatMap(b => b.events.map(e => e.level));
expect(levels).toContain('warn');
- expect(levels).toContain('success');
+ expect(levels).toContain('info');
});
it('skips events with future or invalid timestamps', () => {