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: stop re-logging expected peer-pull denials on every poll
[._.]/ Adam Eivye8c9a3a43941
diff --git a/server/services/sharing/peerPullAuthorization.js b/server/services/sharing/peerPullAuthorization.jsindex a70f12d73c..676775939b 100644--- a/server/services/sharing/peerPullAuthorization.js+++ b/server/services/sharing/peerPullAuthorization.js@@ -147,9 +147,18 @@ function refuseOnce(decision, route) {logOnce(`deny:${key}`, `🔒 Refused peer-sync ${route} for ${describeCaller(decision)} (${decision.reason}) — this data only federates to a configured, outbound-allowed peer`);}+// `severity: 'warning'` suppresses `asyncHandler`'s generic `❌ Route error`+// line for this code. A refusal here is a POLICY outcome, not a fault, and it+// repeats forever: a peer that can't be identified re-polls its sync categories+// every few seconds, so the error line arrived every ~10s per category for the+// life of the process and buried genuine errors in the log. The throttled `🔒`+// line from `refuseOnce` is this path's log of record — once per caller per+// boot, which is exactly what the throttle exists to guarantee. The 403 the+// caller receives is unchanged.const pullForbidden = (decision) => new ServerError('peer not authorized for this record', {status: 403,code: 'PEER_PULL_FORBIDDEN',+ severity: 'warning',context: { reason: decision.reason },});@@ -165,12 +174,16 @@ export async function authorizePeerPull(req, { recordKind = null, syncCategory =const decision = await decidePeerPull({ callerId: readCallerInstanceId(req), recordKind, syncCategory });if (decision.allowed) return decision;const label = route || 'pull';- // `alwaysEnforce` short-circuits the settings read: the answer cannot change.- if (alwaysEnforce) {+ // Both ways of reaching a 403 refuse for the same reason, so both log the same+ // throttled line — strict mode used to throw silently, and now that the 403 no+ // longer self-logs through the route handler, that would leave a user who+ // turned strict mode on with no indication of why a peer stopped syncing.+ // `alwaysEnforce` still short-circuits the settings read: it cannot change the+ // answer.+ if (alwaysEnforce || await strictPullAuthorizationEnabled()) {refuseOnce(decision, label);throw pullForbidden(decision);}- if (await strictPullAuthorizationEnabled()) throw pullForbidden(decision);warnOnce(decision, label);return decision;}diff --git a/server/services/sharing/peerPullAuthorization.test.js b/server/services/sharing/peerPullAuthorization.test.jsindex 9da6a4aba0..273841c8f4 100644--- a/server/services/sharing/peerPullAuthorization.test.js+++ b/server/services/sharing/peerPullAuthorization.test.js@@ -167,12 +167,20 @@ describe('peerPullAuthorization', () => {it('403s a denied pull once strictPullAuthorization is on', async () => {settings = { federation: { strictPullAuthorization: true } };setPeers(universePeer());+ // `severity: 'warning'` is what keeps asyncHandler from re-logging its+ // generic `❌ Route error` on every poll of a peer that will be refused+ // forever; the throttled 🔒 line below is this path's log of record.await expect(authorizePeerPull(req(PEER_A), { recordKind: 'series' }))- .rejects.toMatchObject({ status: 403, code: 'PEER_PULL_FORBIDDEN' });+ .rejects.toMatchObject({ status: 403, code: 'PEER_PULL_FORBIDDEN', severity: 'warning' });await expect(authorizePeerPull(req(null), { recordKind: 'universe' })).rejects.toMatchObject({ status: 403 });- // Strict mode rejects instead of logging the compatibility warning.- expect(console.warn).not.toHaveBeenCalled();+ // Strict mode rejects instead of logging the compatibility ⚠️ — but it is+ // not silent: it logs the same throttled 🔒 refusal `alwaysEnforce` does,+ // once per caller. Since the 403 no longer self-logs, this is the only+ // record of a peer being cut off.+ const lines = console.warn.mock.calls.map((c) => c[0]);+ expect(lines).toHaveLength(2);+ for (const line of lines) expect(line).toContain('🔒');});it('still allows an authorized pull under strict mode', async () => {