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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
test: pin cityChronotype's midnight-seam blending with a symmetry check absolute distance can't pass (#3898)
[._.]/ Adam Eivyab6902163226
diff --git a/client/src/utils/cityChronotype.test.js b/client/src/utils/cityChronotype.test.jsindex 8ab630e156..3aa73a0ca1 100644--- a/client/src/utils/cityChronotype.test.js+++ b/client/src/utils/cityChronotype.test.js@@ -82,6 +82,24 @@ describe('computeChronotypeEnergy — energy curve', () => {expect(at1am.energy).toBeLessThan(atPeak.energy);expect(at1am.energy).toBeLessThan(0.5);});++ it('blends anchors across the midnight seam (circular distance, not absolute)', () => {+ // Only two anchors, and the low one sits exactly on midnight: peak center 12:00,+ // sleep 00:00. Hours 23:00 and 01:00 are one hour from the sleep anchor and+ // eleven from the peak in EITHER direction, so on a 24h clock they must produce+ // the same energy. With plain |a - b| the pre-midnight hour would read as 23+ // hours from sleep and fall to the peak anchor instead — the symmetry below is+ // what distinguishes the two.+ const midnightSleeper = {+ recommendations: { peakFocusStart: '11:00', peakFocusEnd: '13:00', sleepTime: '00:00' },+ };+ const before = computeChronotypeEnergy(midnightSleeper, 23);+ const after = computeChronotypeEnergy(midnightSleeper, 1);+ expect(before.energy).toBeCloseTo(after.energy, 10);+ // Both sit near the sleep anchor's 0.12, nowhere near the peak's 1.0.+ expect(before.energy).toBeLessThan(0.2);+ expect(after.energy).toBeLessThan(0.2);+ });});describe('computeChronotypeEnergy — neutral no-op fallbacks', () => {