Skip to content

refactor: consolidate duplicate bounded-concurrency helpers onto mapWithConcurrency (#6602)#6718

Closed
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:refactor-consolidate-map-with-concurrency-6602
Closed

refactor: consolidate duplicate bounded-concurrency helpers onto mapWithConcurrency (#6602)#6718
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:refactor-consolidate-map-with-concurrency-6602

Conversation

@jaytbarimbao-collab

Copy link
Copy Markdown
Contributor

Closes #6602.

src/queue/map-with-concurrency.ts's mapWithConcurrency is the canonical bounded-concurrency worker-pool helper, but two hand-duplicated copies of the same loop had drifted in beside it (visibly so in processors.ts, which imports both mapWithConcurrency and mapWithConcurrencyLimit and uses each at different call sites):

  • src/signals/focus-manifest-loader.ts — exported mapWithConcurrencyLimit
  • src/queue/patchless-secret-scan.ts — private mapPatchLessSecretScanFilesWithConcurrency

Change

Both now delegate to mapWithConcurrency, preserving their existing names and (items, limit, mapper) signatures so every current caller compiles and behaves unchanged. After this, map-with-concurrency.ts is the only file under src/queue/ or src/signals/ that implements the worker-pool loop itself.

Pure internal consolidation — no change to public behavior, call signatures, or export names.

Tests / coverage

Per the issue, no new test file is required: both wrappers are already exercised transitively by their existing caller suites — test/unit/patchless-secret-scan.test.ts (54 tests, incl. the patch-less fallback path that calls the private helper) and test/unit/focus-manifest-loader.test.ts + the processors suites that drive mapWithConcurrencyLimit. Confirmed green locally, and the changed delegation lines are covered (focus-manifest-loader's uncovered set is 59-88, not the delegation).

…ithConcurrency (JSONbored#6602)

src/queue/map-with-concurrency.ts's mapWithConcurrency is the canonical
bounded-concurrency worker-pool helper, but two hand-duplicated copies of the
same loop had drifted in beside it:
- src/signals/focus-manifest-loader.ts's exported mapWithConcurrencyLimit
- src/queue/patchless-secret-scan.ts's private
  mapPatchLessSecretScanFilesWithConcurrency

Both now delegate to mapWithConcurrency, keeping their existing names and
(items, limit, mapper) signatures so every caller compiles and behaves
unchanged (processors.ts uses both mapWithConcurrency and
mapWithConcurrencyLimit side by side today). map-with-concurrency.ts is now
the only file under src/queue or src/signals that implements the loop itself.

Pure internal consolidation — no public behavior, signature, or export-name
change. Covered by the existing caller suites (patchless-secret-scan,
focus-manifest-loader/processors); no new test needed.

Closes JSONbored#6602
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

❌ 18 Tests Failed:

Tests completed Failed Passed Skipped
2835 18 2817 0
View the top 3 failed test(s) by shortest run time
test/unit/auth-github-token.test.ts > test/unit/auth-github-token.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/cloudflare-worker-runtime-detection.test.ts > test/unit/cloudflare-worker-runtime-detection.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-config-recommendation.test.ts > test/unit/mcp-config-recommendation.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-explain-gate-disposition.test.ts > test/unit/mcp-explain-gate-disposition.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-finding-taxonomy.test.ts > test/unit/mcp-finding-taxonomy.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-intake-idea.test.ts > test/unit/mcp-intake-idea.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-pr-reviewability.test.ts > test/unit/mcp-pr-reviewability.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-gate-outcome-breakdown.test.ts > test/unit/routes-gate-outcome-breakdown.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-issue-rag.test.ts > test/unit/routes-issue-rag.test.ts
Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
View the full list of 9 ❄️ flaky test(s)
test/integration/api.test.ts > test/integration/api.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/integration/orb-webhook.test.ts > test/integration/orb-webhook.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/index.test.ts > test/unit/index.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
test/unit/mcp-automation-state.test.ts > test/unit/mcp-automation-state.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-refresh-repo-docs.test.ts > test/unit/mcp-refresh-repo-docs.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-write-tools.test.ts > test/unit/mcp-write-tools.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/ops-wire.test.ts > test/unit/ops-wire.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-agent-approval.test.ts > test/unit/routes-agent-approval.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-self-dogfood-registration-pack.test.ts > test/unit/routes-self-dogfood-registration-pack.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-16 22:05:15 UTC

2 files · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This is a straightforward consolidation: both drift-prone worker-pool loops in focus-manifest-loader.ts and patchless-secret-scan.ts now delegate to the canonical mapWithConcurrency, preserving their existing exported names and (items, limit, mapper) signatures so no call site changes. The diff is mechanical and self-contained, and the doc comments correctly note the #6602 issue and the preserved contract for existing callers.

Nits — 5 non-blocking
  • I can't see src/queue/map-with-concurrency.ts's mapWithConcurrency in this diff, so I can't independently confirm its (items, limit, mapper) semantics are byte-identical to the removed loops (e.g. whether it still short-circuits on empty `items` the same way) — worth a quick eyeball pass since this is a hot path used by both files.
  • No new/changed test files ship with this PR; the description leans on existing suites exercising the delegation transitively, which is reasonable for a pure refactor but means the two wrapper functions themselves have no direct assertion that they now call through to the shared helper rather than reimplementing it.
  • Consider adding one small unit test per wrapper (focus-manifest-loader.test.ts, patchless-secret-scan.test.ts) that spies on mapWithConcurrency to lock in the delegation and prevent future drift back into a third copy.
  • If mapWithConcurrency in map-with-concurrency.ts has a different edge-case behavior for `limit <= 0` or `items.length === 0` than the old inline loops, call that out explicitly in the PR description for reviewers who can't diff the source implementation directly.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

CI checks failing

  • validate
  • validate-tests (6)
  • validate-tests (2)
  • validate-tests (1)
  • validate-tests (3)
  • validate-tests (5)
  • validate-tests (4)
  • validate-code

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6602
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 169 registered-repo PR(s), 88 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jaytbarimbao-collab; Gittensor profile; 169 PR(s), 4 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: moderate
Linked issue satisfaction

Addressed
Both hand-duplicated worker-pool loops are removed and replaced with thin delegations to mapWithConcurrency, preserving the existing exported names and (items, limit, mapper) signatures as required, satisfying all stated deliverables.

Review context
  • Author: jaytbarimbao-collab
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust
  • Official Gittensor activity: 169 PR(s), 4 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (6), validate-tests (2), validate-tests (1), validate-tests (3), validate-tests (5), validate-tests (4), validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate duplicate bounded-concurrency map helpers in src/queue and src/signals

1 participant