Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
test(secrets): cover the concurrent secret migration sweep
nirholasc3d9210cc6a6
diff --git a/scripts/migrate-plaintext-secrets.mjs b/scripts/migrate-plaintext-secrets.mjsindex 211f6713a..b8c674e60 100755--- a/scripts/migrate-plaintext-secrets.mjs+++ b/scripts/migrate-plaintext-secrets.mjs@@ -154,7 +154,7 @@ const EXTRA_SECRETS = new Set([// gcloud is a Python process per invocation, so a fan-out has to be bounded or a// sweep of a few dozen secrets spawns a few dozen interpreters at once and the// machine starts swapping. Everything here runs through this pool.-async function mapLimit(items, limit, fn) {+export async function mapLimit(items, limit, fn) {const results = new Array(items.length);let next = 0;const worker = async () => {diff --git a/tests/migrate-plaintext-secrets.test.js b/tests/migrate-plaintext-secrets.test.jsindex cb1f89195..1da9e9239 100644--- a/tests/migrate-plaintext-secrets.test.js+++ b/tests/migrate-plaintext-secrets.test.js@@ -9,7 +9,7 @@// docs/ops/gcp-production.md).import { describe, it, expect } from 'vitest';-import { classify, defaultSecretName } from '../scripts/migrate-plaintext-secrets.mjs';+import { classify, defaultSecretName, mapLimit } from '../scripts/migrate-plaintext-secrets.mjs';describe('credential classifier', () => {it('treats the wallet secret keys as credentials', () => {@@ -79,3 +79,32 @@ describe('secret naming', () => {expect(defaultSecretName('ECONOMY_MASTER_SECRET_BASE58')).toBe('economy-master-secret-base58');});});++// Every gcloud call is a Python process. An unbounded fan-out over the ~50 secrets+// on this project spawned 57 interpreters at once and the machine OOM-killed the+// run, so the bound is not a nicety.+describe('mapLimit', () => {+ it('never runs more than the limit at once', async () => {+ let running = 0;+ let peak = 0;+ await mapLimit([...Array(20).keys()], 4, async () => {+ running++;+ peak = Math.max(peak, running);+ await new Promise((r) => setTimeout(r, 1));+ running--;+ });+ expect(peak).toBeLessThanOrEqual(4);+ });++ it('returns results in input order, not completion order', async () => {+ const out = await mapLimit([30, 1, 20, 2], 4, async (ms) => {+ await new Promise((r) => setTimeout(r, ms));+ return ms;+ });+ expect(out).toEqual([30, 1, 20, 2]);+ });++ it('handles an empty list without spawning a worker', async () => {+ expect(await mapLimit([], 4, async () => 'never')).toEqual([]);+ });+});