authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:18:44-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:18:44-07:00
log94d1fa7ff268e88476a341eb73f9f032e2af6a21
tree40a8c2d6c59ff000abe82e495b73b57ab909a167
parent9867eb12396439f58e03e3548e053d966f0f64a6
signature Signed by PGP key B5690EEEBB952194

test(server): consolidate agent activity opt-in coverage (#9988)


4 files changed, 7 insertions(+), 21 deletions(-)

apps/server/src/cli/connect.test.ts-8
...@@ -14,7 +14,6 @@ import * as BootService from "../cloud/bootService.ts";...@@ -14,7 +14,6 @@ import * as BootService from "../cloud/bootService.ts";
14import {14import {
15 acquireRelayClientForLink,15 acquireRelayClientForLink,
16 headlessSessionConfig,16 headlessSessionConfig,
17 isPublishAgentActivityEnabledValue,
18 reportCloudDisconnectResults,17 reportCloudDisconnectResults,
19} from "./connect.ts";18} from "./connect.ts";
20import { recoverServiceOnboardingOffer } from "./service.ts";19import { recoverServiceOnboardingOffer } from "./service.ts";
...@@ -190,10 +189,3 @@ it.effect("keeps disconnect causes in structured logs and out of console warning...@@ -190,10 +189,3 @@ it.effect("keeps disconnect causes in structured logs and out of console warning
190 ),189 ),
191 );190 );
192});191});
193
194it("treats only the literal 'true' as publish-enabled", () => {
195 assert.equal(isPublishAgentActivityEnabledValue("true"), true);
196 assert.equal(isPublishAgentActivityEnabledValue("false"), false);
197 assert.equal(isPublishAgentActivityEnabledValue(null), false);
198 assert.equal(isPublishAgentActivityEnabledValue("TRUE"), false);
199});
apps/server/src/cli/connect.ts+1-5
...@@ -144,10 +144,6 @@ function stringToBytes(value: string): Uint8Array {...@@ -144,10 +144,6 @@ function stringToBytes(value: string): Uint8Array {
144 return new TextEncoder().encode(value);144 return new TextEncoder().encode(value);
145}145}
146146
147export function isPublishAgentActivityEnabledValue(value: string | null): boolean {
148 return isAgentActivityPublishingEnabledValue(value);
149}
150
151interface CloudCliStatus {147interface CloudCliStatus {
152 readonly desired: boolean;148 readonly desired: boolean;
153 readonly authenticated: boolean;149 readonly authenticated: boolean;
...@@ -573,7 +569,7 @@ const connectStatusCommand = Command.make("status", {...@@ -573,7 +569,7 @@ const connectStatusCommand = Command.make("status", {
573 linked: Option.isSome(cloudUserId),569 linked: Option.isSome(cloudUserId),
574 cloudUserId: Option.isSome(cloudUserId) ? bytesToString(cloudUserId.value) : null,570 cloudUserId: Option.isSome(cloudUserId) ? bytesToString(cloudUserId.value) : null,
575 relayUrl: Option.isSome(relayUrl) ? bytesToString(relayUrl.value) : null,571 relayUrl: Option.isSome(relayUrl) ? bytesToString(relayUrl.value) : null,
576 publishAgentActivity: isPublishAgentActivityEnabledValue(572 publishAgentActivity: isAgentActivityPublishingEnabledValue(
577 Option.isSome(publishAgentActivity) ? bytesToString(publishAgentActivity.value) : null,573 Option.isSome(publishAgentActivity) ? bytesToString(publishAgentActivity.value) : null,
578 ),574 ),
579 relayClient: executable,575 relayClient: executable,
apps/server/src/relay/AgentAwarenessRelay.test.ts+5-3
...@@ -39,6 +39,7 @@ import {...@@ -39,6 +39,7 @@ import {
39 type ProjectionSnapshotQueryShape,39 type ProjectionSnapshotQueryShape,
40} from "../orchestration/Services/ProjectionSnapshotQuery.ts";40} from "../orchestration/Services/ProjectionSnapshotQuery.ts";
41import {41import {
42 isAgentActivityPublishingEnabledValue,
42 RELAY_ENVIRONMENT_CREDENTIAL_SECRET,43 RELAY_ENVIRONMENT_CREDENTIAL_SECRET,
43 RELAY_ISSUER_SECRET,44 RELAY_ISSUER_SECRET,
44 RELAY_URL_SECRET,45 RELAY_URL_SECRET,
...@@ -220,9 +221,10 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {...@@ -220,9 +221,10 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
220 });221 });
221222
222 it("requires an explicit opt-in before publishing agent activity", () => {223 it("requires an explicit opt-in before publishing agent activity", () => {
223 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled(null)).toBe(false);224 expect(isAgentActivityPublishingEnabledValue(null)).toBe(false);
224 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("false")).toBe(false);225 expect(isAgentActivityPublishingEnabledValue("false")).toBe(false);
225 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("true")).toBe(true);226 expect(isAgentActivityPublishingEnabledValue("TRUE")).toBe(false);
227 expect(isAgentActivityPublishingEnabledValue("true")).toBe(true);
226 });228 });
227229
228 it("redacts failed activity details and caps other relay detail", () => {230 it("redacts failed activity details and caps other relay detail", () => {
apps/server/src/relay/AgentAwarenessRelay.ts+1-5
...@@ -102,10 +102,6 @@ export function agentAwarenessPublishIdentity(state: RelayAgentActivityState | n...@@ -102,10 +102,6 @@ export function agentAwarenessPublishIdentity(state: RelayAgentActivityState | n
102 return JSON.stringify(meaningfulState);102 return JSON.stringify(meaningfulState);
103}103}
104104
105export function isAgentActivityPublishingEnabled(value: string | null): boolean {
106 return isAgentActivityPublishingEnabledValue(value);
107}
108
109export function resolveAgentActivityPublishingStartupState(input: {105export function resolveAgentActivityPublishingStartupState(input: {
110 readonly relayConfigured: boolean;106 readonly relayConfigured: boolean;
111 readonly publishEnabled: boolean;107 readonly publishEnabled: boolean;
...@@ -322,7 +318,7 @@ export const make = Effect.gen(function* () {...@@ -322,7 +318,7 @@ export const make = Effect.gen(function* () {
322 });318 });
323319
324 const readPublishAgentActivityEnabled = readSecretString(PUBLISH_AGENT_ACTIVITY_SECRET).pipe(320 const readPublishAgentActivityEnabled = readSecretString(PUBLISH_AGENT_ACTIVITY_SECRET).pipe(
325 Effect.map(isAgentActivityPublishingEnabled),321 Effect.map(isAgentActivityPublishingEnabledValue),
326 );322 );
327323
328 const makeRelayClient = (relayConfig: {324 const makeRelayClient = (relayConfig: {