Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
test(shared): replace redundant pins with behavior checks (#1167)
Generec9f2fe40eb3
diff --git a/src/daemon/src/constants.test.ts b/src/daemon/src/constants.test.tsindex 4513ab5cf..0e2b4a3fb 100644--- a/src/daemon/src/constants.test.ts+++ b/src/daemon/src/constants.test.ts@@ -35,10 +35,6 @@ describe("magic-number extractions", () => {expect(SESSION_STOP_GRACE_MS).toBeLessThan(Number(match![1]));});- it("PROBE_TIMEOUT_MS is set to 5000 in the driver package", () => {- expect(readSrc("../agent-driver/src/internal/probe.ts")).toMatch(/PROBE_TIMEOUT_MS\s*=\s*5000\b/);- });-it("the removed raw-stderr manager buffer limit stays deleted", () => {expect(readSrc("manager/managerRuntime.ts")).not.toMatch(/\bSTDERR_LOG_MAX_LEN\b/);});diff --git a/src/shared/test/constants.test.ts b/src/shared/test/constants.test.tsindex 06a647399..a2919fb76 100644--- a/src/shared/test/constants.test.ts+++ b/src/shared/test/constants.test.ts@@ -10,7 +10,7 @@ import {NOTIF_LEVELS, NOTIFICATION_LEVEL_VALUES, notifLevelDisplay, normalizeNotifLevel,PARTICIPANT_SOURCE, MENTION_KIND,} from "../src/constants/community"-import { communityChannel, communityMention } from "../src/db/community-schema"+import { communityMention } from "../src/db/community-schema"describe("constants", () => {it("OFFLINE_THRESHOLD_MS is 30s", () => expect(OFFLINE_THRESHOLD_MS).toBe(30_000))@@ -169,10 +169,4 @@ describe("PARTICIPANT_SOURCE / MENTION_KIND (single source)", () => {expect((communityMention.kind as { default?: unknown }).default).toBe(MENTION_KIND.MENTION)})- it("community_channel.parentChannelId column exists (schema module loaded for the default probe)", () => {- // Sanity that the schema import resolved; the meaningful assertion is the- // kind-default parity above. (channel_member.source lives on a table not- // re-exported here; message-handler/thread tests cover its use.)- expect(communityChannel).toBeTruthy()- })})diff --git a/src/shared/test/queries/chunk.test.ts b/src/shared/test/queries/chunk.test.tsindex 80c67ac64..fced5bb71 100644--- a/src/shared/test/queries/chunk.test.ts+++ b/src/shared/test/queries/chunk.test.ts@@ -81,7 +81,6 @@ describe("maxInParams", () => {describe("constants", () => {it("D1_MAX_IN_PARAMS leaves headroom under the hard limit", () => {- expect(D1_MAX_BIND_PARAMS).toBe(100);expect(D1_MAX_IN_PARAMS).toBeLessThan(D1_MAX_BIND_PARAMS);});});diff --git a/src/shared/test/queries/community-bot-audit-log.test.ts b/src/shared/test/queries/community-bot-audit-log.test.tsindex 9581a3c00..e5250513d 100644--- a/src/shared/test/queries/community-bot-audit-log.test.ts+++ b/src/shared/test/queries/community-bot-audit-log.test.ts@@ -11,12 +11,6 @@ import {HostBotAuditEventFrameSchema,} from "../../src/schemas"-/**- * Smoke test — verifies the bot-audit-log query module exports the documented- * helpers. Integration-level behaviour (batch atomicity, retention prune,- * cursor pagination, soft-delete filter) is exercised in the- * `tests/e2e/community-bot-audit-log.e2e.test.ts` suite where a real D1 lives.- */describe("community/bot-audit-log exports", () => {it("exposes writers", () => {expect(typeof q.insertBotActivityEventStatement).toBe("function")@@ -24,13 +18,6 @@ describe("community/bot-audit-log exports", () => {expect(typeof q.insertBotAuditWakeTrigger).toBe("function")expect(typeof q.insertBotAuditError).toBe("function")})--- it("exposes the retention cap constant", () => {- // Plan §Retention: 500 rows per bot. Locked here so a refactor- // changing the constant surfaces as a test failure.- expect(q.AUDIT_LOG_MAX_ROWS_PER_BOT).toBe(500)- })})describe("listOwnedBotActivityEvents", () => {@@ -100,6 +87,46 @@ describe("listOwnedBotActivityEvents", () => {afterEach(() => sqlite.close())+ it("retains the newest 500 events with tied timestamps without pruning another bot", async () => {+ const createdAt = "2026-09-02T00:00:00.000Z"+ const insert = sqlite.prepare(`+ INSERT INTO community_bot_activity_event+ (id, bot_id, kind, payload, created_at)+ VALUES (?, 'empty_bot', 'tool_call', '{}', ?)+ `)+ for (let i = 0; i <= 500; i++) {+ insert.run(+ `retention_${String(i).padStart(3, "0")}`,+ i === 0 ? "2026-09-01T01:00:00.000Z" : "2026-09-01T00:00:00.000Z",+ )+ }+ const unrelatedBefore = sqlite.prepare(+ "SELECT * FROM community_bot_activity_event WHERE bot_id != ? ORDER BY id",+ ).all("empty_bot")++ await expect(q.insertBotActivityEventAndPrune(db, {+ id: "retention_501",+ botId: "empty_bot",+ kind: "tool_call",+ payload: "{}",+ createdAt,+ })).resolves.toEqual({ id: "retention_501", createdAt })++ const retained = sqlite.prepare(+ "SELECT id FROM community_bot_activity_event WHERE bot_id = ? ORDER BY created_at DESC, id DESC",+ ).all("empty_bot")+ expect(retained).toEqual([+ { id: "retention_501" },+ { id: "retention_000" },+ ...Array.from({ length: 498 }, (_, i) => ({+ id: `retention_${String(500 - i).padStart(3, "0")}`,+ })),+ ])+ expect(sqlite.prepare(+ "SELECT * FROM community_bot_activity_event WHERE bot_id != ? ORDER BY id",+ ).all("empty_bot")).toEqual(unrelatedBefore)+ })+it("returns a newest-first bounded page in exactly one select", async () => {const selectSpy = vi.spyOn(db, "select")const rows = await q.listOwnedBotActivityEvents(db, {diff --git a/src/shared/test/schemas/daemon-input-limits.test.ts b/src/shared/test/schemas/daemon-input-limits.test.tsindex 8a5387cf5..6bb8f8e65 100644--- a/src/shared/test/schemas/daemon-input-limits.test.ts+++ b/src/shared/test/schemas/daemon-input-limits.test.ts@@ -2,7 +2,6 @@ import { describe, expect, it } from "vitest";import {ActivateTokenRequestSchema,COMMUNITY_RUNTIME_LIST_MAX,- MAX_POLL_TASKS,PollRequestSchema,RegisterDaemonRequestSchema,} from "../../src/schemas";@@ -11,7 +10,6 @@ describe("daemon input limits", () => {it("keeps zero invalid and positive legacy poll counts compatible", () => {expect(PollRequestSchema.safeParse({ daemon_id: "d1", max_tasks: 0 }).success).toBe(false);expect(PollRequestSchema.parse({ daemon_id: "d1", max_tasks: 125 }).max_tasks).toBe(125);- expect(MAX_POLL_TASKS).toBe(50);});it.each([diff --git a/src/web/scripts/dedupe-server-chunks.test.ts b/src/web/scripts/dedupe-server-chunks.test.tsindex 61b938ac3..6da2b2590 100644--- a/src/web/scripts/dedupe-server-chunks.test.ts+++ b/src/web/scripts/dedupe-server-chunks.test.ts@@ -42,7 +42,13 @@ describe("dedupeServerChunks", () => {expect(result.savedBytes).toBeGreaterThan(0)expect(result.updatedTraces).toBe(1)expect(readFileSync(join(f.standalone, "a.js"), "utf8")).toBe(chunk)- expect(readFileSync(join(f.standalone, "z.js"), "utf8")).toBe('module.exports = require("./a.js");\n')+ const require = createRequire(join(f.root, "entry.cjs"))+ const canonical = require(join(f.standalone, "a.js"))+ const alias = require(join(f.standalone, "z.js"))+ expect(alias).toBe(canonical)+ const context = { exports: {} }+ alias[1](context)+ expect(context.exports).toEqual({ value: "same" })expect(readFileSync(join(f.original, "z.js"), "utf8")).toBe(chunk)expect(JSON.parse(readFileSync(trace, "utf8"))).toEqual({ version: 1, files: ["../../chunks/z.js", "../../chunks/a.js"] })expect(dedupeServerChunks(f.root)).toEqual({ aliases: 0, savedBytes: 0, updatedTraces: 0 })diff --git a/src/web/scripts/stage-service-worker.test.ts b/src/web/scripts/stage-service-worker.test.tsindex e8d27a043..34917dc91 100644--- a/src/web/scripts/stage-service-worker.test.ts+++ b/src/web/scripts/stage-service-worker.test.ts@@ -1,5 +1,6 @@import type { createSerwistRoute } from "@serwist/turbopack"import { createHash } from "node:crypto"+import { createRequire } from "node:module"import { mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs"import { tmpdir } from "node:os"import { resolve } from "node:path"@@ -37,7 +38,13 @@ describe("complete build shell and worker staging", () => {writeFileSync(resolve(chunks, "b.js"), source)await stageServiceWorker(root)expect(readFileSync(resolve(chunks, "a.js"), "utf8")).toBe(source)- expect(readFileSync(resolve(chunks, "b.js"), "utf8")).toBe('module.exports = require("./a.js");\n')+ const require = createRequire(resolve(root, "entry.cjs"))+ const canonical = require(resolve(chunks, "a.js"))+ const alias = require(resolve(chunks, "b.js"))+ expect(alias).toBe(canonical)+ const context = { exports: {} }+ alias[1](context)+ expect(context.exports).toEqual({ value: "same" })})it("builds a classic worker from explicit public asset globs", async () => {await stageServiceWorker(fixture())diff --git a/src/web/src/hooks/community/use-server-members.dom.test.ts b/src/web/src/hooks/community/use-server-members.dom.test.tsindex 9a82a32eb..1169ff313 100644--- a/src/web/src/hooks/community/use-server-members.dom.test.ts+++ b/src/web/src/hooks/community/use-server-members.dom.test.ts@@ -118,12 +118,6 @@ function isSearchUrl(value: unknown): value is string {return typeof value === "string" && value.includes("/members/search?")}-describe("SEARCH_DEBOUNCE_MS", () => {- it("is 200ms (matches plan)", () => {- expect(SEARCH_DEBOUNCE_MS).toBe(200)- })-})-describe("mergeMemberSearchPage", () => {it("appends serial search pages and drops duplicate boundary rows", () => {const first = [m("a"), m("b")]@@ -532,8 +526,10 @@ describe("useServerMembers search lifecycle", () => {})await act(async () => {- await vi.advanceTimersByTimeAsync(SEARCH_DEBOUNCE_MS)+ await vi.advanceTimersByTimeAsync(199)})+ expect(apiFetchMock.mock.calls.filter(([url]) => isSearchUrl(url))).toEqual([])+ await act(async () => { await vi.advanceTimersByTimeAsync(1) })expect(apiFetchMock.mock.calls.filter(([url]) => isSearchUrl(url))).toEqual([["/api/community/servers/srv_1/members/search?q=ad", expect.objectContaining({ authenticationAccount: "viewer", signal: expect.any(AbortSignal) })],])diff --git a/src/web/src/hooks/community/use-user-profile.test.ts b/src/web/src/hooks/community/use-user-profile.test.tsindex 8ebeea20b..f356f686d 100644--- a/src/web/src/hooks/community/use-user-profile.test.ts+++ b/src/web/src/hooks/community/use-user-profile.test.ts@@ -66,8 +66,6 @@ describe("useUserProfile / userProfileQueryFn", () => {expect(client.getQueryState(key)?.isInvalidated).toBe(true)})- it("exports a positive PROFILE_STALE_TIME_MS", () => expect(PROFILE_STALE_TIME_MS).toBeGreaterThan(0))-it("a re-fetch for the same userId within the stale window resolves from cache, no second network call", async () => {const { client } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(profile)diff --git a/src/web/src/lib/community/storage.test.ts b/src/web/src/lib/community/storage.test.tsindex 538aa2c9e..1f5bd01de 100644--- a/src/web/src/lib/community/storage.test.ts+++ b/src/web/src/lib/community/storage.test.ts@@ -27,12 +27,9 @@ describe("serverIconUrl", () => {})describe("buildUserAvatarKey", () => {- it("is deterministic (no randomness)", () => {- expect(buildUserAvatarKey("u1")).toBe(buildUserAvatarKey("u1"))- })-- it("has the correct format", () => {- expect(buildUserAvatarKey("u1")).toBe("user-avatar/u1")+ it("returns the canonical alias on repeated calls", () => {+ expect([buildUserAvatarKey("u1"), buildUserAvatarKey("u1")])+ .toEqual(["user-avatar/u1", "user-avatar/u1"])})})@@ -47,12 +44,9 @@ describe("user avatar object ownership", () => {})describe("buildBotAvatarKey", () => {- it("is deterministic (no randomness)", () => {- expect(buildBotAvatarKey("b1")).toBe(buildBotAvatarKey("b1"))- })-- it("has the correct format", () => {- expect(buildBotAvatarKey("b1")).toBe("bot-avatar/b1")+ it("returns the canonical alias on repeated calls", () => {+ expect([buildBotAvatarKey("b1"), buildBotAvatarKey("b1")])+ .toEqual(["bot-avatar/b1", "bot-avatar/b1"])})})