Sample
p-limit 2.3.0
Verified sample for npm p-limit 2.3.0. The contract ran on node 22 · linux alpine/x64 · docker and passed: pLimit creates a limiter that restricts…
sha256:216d91d91e968222fd88085bfbc9d41ef2424cfeac222cad6936d625e0e8bcd0
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
windows 10 x64 npm vm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
Case
HOW- Goal
- verify pkg:npm/p-limit@2.3.0
- Packages
- Created
- 2026-08-19T22:57:03Z
Contract
- pLimit creates a limiter that restricts concurrency to the specified limit
- runWithLimit executes tasks concurrently up to the specified limit
- activeCount and pendingCount track running and queued tasks
- clearQueue discards pending tasks that have not started execution
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- sample.mjs
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/p-limit@2.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/p-limit@2.3.0
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:d52bdca73158231e4015007d106f0ae588771e0fd89505c6ceffdb94dfe2b81d","contract":["pLimit creates a limiter that restricts concurrency to the specified limit","runWithLimit executes tasks concurrently up to the specified limit","activeCount and pendingCount track running and queued tasks","clearQueue discards pending tasks that have not started execution"],"goal":"verify pkg:npm/p-limit@2.3.0","kind":"HOW","packages":["pkg:npm/p-limit@2.3.0"],"schemaVersion":1,"symbols":["p-limit","p-limit.activeCount","p-limit.pendingCount","p-limit.clearQueue"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","os":"windows","osVersionBucket":"10","packageManager":"npm","schemaVersion":1,"virtualization":"vm"},"license":"MIT-0","packages":["pkg:npm/p-limit@2.3.0"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample",
"version": "1.0.0",
"dependencies": {
"p-limit": "2.3.0"
}
},
"node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"engines": {
"node": ">=6"
}
}
}
}
{
"name": "sample",
"version": "1.0.0",
"type": "module",
"dependencies": {
"p-limit": "2.3.0"
}
}
import pLimit from 'p-limit';
/**
* Creates a concurrency limiter with the specified limit.
* @param {number} concurrency
* @returns {Function}
*/
export function createLimiter(concurrency) {
return pLimit(concurrency);
}
/**
* Runs a list of tasks with a concurrency limit.
* @param {Array<() => Promise<any>>} tasks
* @param {number} concurrency
* @returns {Promise<any[]>}
*/
export async function runWithLimit(tasks, concurrency) {
const limit = pLimit(concurrency);
return Promise.all(tasks.map((task) => limit(task)));
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/p-limit@2.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/p-limit@2.3.0"
]
}
import assert from 'node:assert/strict';
import pLimit from 'p-limit';
import { createLimiter, runWithLimit } from '../sample.mjs';
async function testConcurrencyLimit() {
const limit = createLimiter(2);
let active = 0;
let maxActive = 0;
const tasks = Array.from({ length: 6 }, (_, i) => async () => {
active++;
if (active > maxActive) {
maxActive = active;
}
await new Promise((resolve) => setTimeout(resolve, 30));
active--;
return i;
});
const results = await Promise.all(tasks.map((t) => limit(t)));
assert.deepEqual(results, [0, 1, 2, 3, 4, 5], 'all tasks should complete in order');
assert(maxActive <= 2, `max concurrent tasks (${maxActive}) should not exceed limit (2)`);
console.log('Contract 1 passed: concurrency limit respected');
}
async function testRunWithLimit() {
const tasks = [
async () => 10,
async () => 20,
async () => 30
];
const results = await runWithLimit(tasks, 2);
assert.deepEqual(results, [10, 20, 30], 'runWithLimit should return mapped task results');
console.log('Contract 2 passed: runWithLimit works');
}
async function testCountsAndQueue() {
const limit = pLimit(1);
let resolveFirst;
const firstPromise = new Promise((resolve) => {
resolveFirst = resolve;
});
const p1 = limit(() => firstPromise);
const p2 = limit(() => Promise.resolve('second'));
const p3 = limit(() => Promise.resolve('third'));
assert.equal(limit.activeCount, 1, 'activeCount should be 1');
assert.equal(limit.pendingCount, 2, 'pendingCount should be 2');
limit.clearQueue();
assert.equal(limit.pendingCount, 0, 'pendingCount should be 0 after clearQueue');
resolveFirst('first');
const res1 = await p1;
assert.equal(res1, 'first', 'first task should complete');
console.log('Contract 3 & 4 passed: activeCount, pendingCount, and clearQueue verified');
}
async function main() {
await testConcurrencyLimit();
await testRunWithLimit();
await testCountsAndQueue();
console.log('All contracts passed successfully.');
}
main().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Origin Seeder
anonymous