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
fix: keep peer identity out of sync logs
[._.]/ Adam Eivy5a892efe4870
diff --git a/server/services/instances.js b/server/services/instances.jsindex 6f8f219949..09a24696fe 100644--- a/server/services/instances.js+++ b/server/services/instances.js@@ -212,28 +212,12 @@ function validName(name, fallback) {}// "NaN" and "undefined" are what a missing number or a missing value stringify-// to. They are not peer names. The string "null" is left alone: a hostname can-// actually be "null", and addPeer accepts it.-const UNUSABLE_PEER_LABEL = /^(nan|undefined)$/i;-/**- * The name to print for a peer in a server log.- *- * A missing name must not stringify as "NaN". Fall through host, address, then- * a short instance id so two peers in one sync line stay distinguishable.+ * Peer display names, hosts, addresses and instance IDs can identify a machine.+ * Keep server logs generic so runtime sync events do not persist that data.*/-export function peerLogLabel(peer) {- const text = (value) => (typeof value === 'string' ? value.trim() : '');- const usable = (value) => Boolean(value) && !UNUSABLE_PEER_LABEL.test(value);- const name = text(peer?.name);- if (usable(name)) return name;- const host = text(peer?.host);- if (usable(host)) return host;- const address = text(peer?.address);- if (usable(address)) return address;- const id = text(peer?.instanceId);- if (usable(id)) return id.length > 12 ? `${id.slice(0, 8)}…` : id;- return 'unnamed peer';+export function peerLogLabel() {+ return 'peer';}function isIPAddress(str) {diff --git a/server/services/instances.test.js b/server/services/instances.test.jsindex 03aa4d2606..09de9be886 100644--- a/server/services/instances.test.js+++ b/server/services/instances.test.js@@ -175,16 +175,10 @@ describe('instances.js', () => {});describe('peerLogLabel', () => {- it('does not stringify a missing name as NaN', () => {- expect(peerLogLabel({ name: 'NaN', host: 'peer-b.example', instanceId: 'abc123def456' })).toBe('peer-b.example');- expect(peerLogLabel({ name: NaN, address: '192.0.2.20' })).toBe('192.0.2.20');- expect(peerLogLabel({ instanceId: 'abc123def4567890' })).toBe('abc123de…');- expect(peerLogLabel({})).toBe('unnamed peer');- });-- it('keeps a real name, including the hostname "null"', () => {- expect(peerLogLabel({ name: 'null', address: '192.0.2.10' })).toBe('null');- expect(peerLogLabel({ name: 'studio', instanceId: 'abc' })).toBe('studio');+ it('never includes peer names or network identity in server logs', () => {+ expect(peerLogLabel({ name: 'Example Machine', host: 'peer.example', address: '192.0.2.20', instanceId: 'abc123def456' })).toBe('peer');+ expect(peerLogLabel({ name: 'NaN', host: 'peer.example' })).toBe('peer');+ expect(peerLogLabel({})).toBe('peer');});});diff --git a/server/services/syncOrchestrator.test.js b/server/services/syncOrchestrator.test.jsindex 058be16a20..eeda4e43c5 100644--- a/server/services/syncOrchestrator.test.js+++ b/server/services/syncOrchestrator.test.js@@ -767,7 +767,7 @@ describe('syncOrchestrator', () => {await syncWithPeer({ ...mockPeer, syncCategories: { usage: true } });- const logged = errorSpy.mock.calls.find(([msg]) => String(msg).includes('usage sync with test-peer failed'));+ const logged = errorSpy.mock.calls.find(([msg]) => String(msg).includes('usage sync with peer failed'));expect(logged).toBeTruthy();// The stack rides as a second argument (logFailureWithStack), so the// failure names a frame instead of collapsing to one message-only line.@@ -1261,7 +1261,7 @@ describe('syncOrchestrator', () => {await syncAllPeers();expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync cycle: 1 peer online'));- expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync starting with test-peer'));+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync starting with peer'));expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync cycle complete: 0 changes applied across 1 peer'));} finally {logSpy.mockRestore();@@ -1286,7 +1286,7 @@ describe('syncOrchestrator', () => {try {await syncAllPeers();- expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Synced with test-peer: 1 brain changes'));+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Synced with peer: 1 brain changes'));expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync cycle complete: 1 change applied across 1 peer'));} finally {logSpy.mockRestore();@@ -1310,7 +1310,7 @@ describe('syncOrchestrator', () => {try {await syncAllPeers();- expect(errorSpy.mock.calls.some(([message]) => String(message).includes('usage sync with test-peer failed'))).toBe(true);+ expect(errorSpy.mock.calls.some(([message]) => String(message).includes('usage sync with peer failed'))).toBe(true);expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('Sync cycle complete: 0 changes applied across 1 peer'));} finally {logSpy.mockRestore();