test(server): consolidate agent activity opt-in coverage (#9988)
This commit is contained in:
1 parent
9867eb1239
commit
94d1fa7ff2
4 files changed
+7
-21
No files matched your search
@@ -14,7 +14,6 @@ import * as BootService from "../cloud/bootService.ts";
|
||||
import {
|
||||
acquireRelayClientForLink,
|
||||
headlessSessionConfig,
|
||||
isPublishAgentActivityEnabledValue,
|
||||
reportCloudDisconnectResults,
|
||||
} from "./connect.ts";
|
||||
import { recoverServiceOnboardingOffer } from "./service.ts";
|
||||
@@ -190,10 +189,3 @@ it.effect("keeps disconnect causes in structured logs and out of console warning
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it("treats only the literal 'true' as publish-enabled", () => {
|
||||
assert.equal(isPublishAgentActivityEnabledValue("true"), true);
|
||||
assert.equal(isPublishAgentActivityEnabledValue("false"), false);
|
||||
assert.equal(isPublishAgentActivityEnabledValue(null), false);
|
||||
assert.equal(isPublishAgentActivityEnabledValue("TRUE"), false);
|
||||
});
|
||||
@@ -144,10 +144,6 @@ function stringToBytes(value: string): Uint8Array {
|
||||
return new TextEncoder().encode(value);
|
||||
}
|
||||
|
||||
export function isPublishAgentActivityEnabledValue(value: string | null): boolean {
|
||||
return isAgentActivityPublishingEnabledValue(value);
|
||||
}
|
||||
|
||||
interface CloudCliStatus {
|
||||
readonly desired: boolean;
|
||||
readonly authenticated: boolean;
|
||||
@@ -573,7 +569,7 @@ const connectStatusCommand = Command.make("status", {
|
||||
linked: Option.isSome(cloudUserId),
|
||||
cloudUserId: Option.isSome(cloudUserId) ? bytesToString(cloudUserId.value) : null,
|
||||
relayUrl: Option.isSome(relayUrl) ? bytesToString(relayUrl.value) : null,
|
||||
publishAgentActivity: isPublishAgentActivityEnabledValue(
|
||||
publishAgentActivity: isAgentActivityPublishingEnabledValue(
|
||||
Option.isSome(publishAgentActivity) ? bytesToString(publishAgentActivity.value) : null,
|
||||
),
|
||||
relayClient: executable,
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
type ProjectionSnapshotQueryShape,
|
||||
} from "../orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import {
|
||||
isAgentActivityPublishingEnabledValue,
|
||||
RELAY_ENVIRONMENT_CREDENTIAL_SECRET,
|
||||
RELAY_ISSUER_SECRET,
|
||||
RELAY_URL_SECRET,
|
||||
@@ -220,9 +221,10 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
|
||||
});
|
||||
|
||||
it("requires an explicit opt-in before publishing agent activity", () => {
|
||||
expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled(null)).toBe(false);
|
||||
expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("false")).toBe(false);
|
||||
expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("true")).toBe(true);
|
||||
expect(isAgentActivityPublishingEnabledValue(null)).toBe(false);
|
||||
expect(isAgentActivityPublishingEnabledValue("false")).toBe(false);
|
||||
expect(isAgentActivityPublishingEnabledValue("TRUE")).toBe(false);
|
||||
expect(isAgentActivityPublishingEnabledValue("true")).toBe(true);
|
||||
});
|
||||
|
||||
it("redacts failed activity details and caps other relay detail", () => {
|
||||
|
||||
@@ -102,10 +102,6 @@ export function agentAwarenessPublishIdentity(state: RelayAgentActivityState | n
|
||||
return JSON.stringify(meaningfulState);
|
||||
}
|
||||
|
||||
export function isAgentActivityPublishingEnabled(value: string | null): boolean {
|
||||
return isAgentActivityPublishingEnabledValue(value);
|
||||
}
|
||||
|
||||
export function resolveAgentActivityPublishingStartupState(input: {
|
||||
readonly relayConfigured: boolean;
|
||||
readonly publishEnabled: boolean;
|
||||
@@ -322,7 +318,7 @@ export const make = Effect.gen(function* () {
|
||||
});
|
||||
|
||||
const readPublishAgentActivityEnabled = readSecretString(PUBLISH_AGENT_ACTIVITY_SECRET).pipe(
|
||||
Effect.map(isAgentActivityPublishingEnabled),
|
||||
Effect.map(isAgentActivityPublishingEnabledValue),
|
||||
);
|
||||
|
||||
const makeRelayClient = (relayConfig: {
|
||||
|
||||
Reference in new issue
Block a user