샘플
pump 3.0.4
검증된 샘플 — npm pump 3.0.4. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: pump throws Error when fewer than two streams are provided
sha256:eb6aeac4edccdcbb8f0695c85355496257cb56af5e87be78b67049b328bac748
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
케이스
HOW- 목표
- verify pkg:npm/pump@3.0.4
- 패키지
- 생성일
- 2026-08-23T13:25:32Z
컨트랙트
- pump throws Error when fewer than two streams are provided
- pump pipes data from readable stream through transform stream to writable stream and invokes callback on success
- pump accepts an array of streams and completes data piping successfully
- pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error
- pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error
- pump destroys all streams in the pipeline when an intermediate transform stream emits an error
- pump returns the destination stream from the pipeline
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.js
소스
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/pump@3.0.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pump@3.0.4
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:d3c34f9b7c348d9c5b897a2faca80a49a626db1e15fec96a29ab0579b571eaa9","contract":["pump throws Error when fewer than two streams are provided","pump pipes data from readable stream through transform stream to writable stream and invokes callback on success","pump accepts an array of streams and completes data piping successfully","pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error","pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error","pump destroys all streams in the pipeline when an intermediate transform stream emits an error","pump returns the destination stream from the pipeline"],"goal":"verify pkg:npm/pump@3.0.4","kind":"HOW","packages":["pkg:npm/pump@3.0.4"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/pump@3.0.4"],"schemaVersion":1,"subject":"pkg:npm/pump@3.0.4","verifierAdapter":"node-typescript@1"}
{
"name": "csx-sample-pump",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "csx-sample-pump",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"pump": "3.0.4"
}
},
"node_modules/end-of-stream": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
"license": "MIT",
"dependencies": {
"once": "^1.4.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/pump": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
"integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
"license": "MIT",
"dependencies": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"license": "ISC"
}
}
}
{
"name": "csx-sample-pump",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for pump",
"main": "test/contract.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"pump": "3.0.4"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/pump@3.0.4",
"kind": "HOW",
"packages": [
"pkg:npm/pump@3.0.4"
]
}
const assert = require('node:assert/strict');
const { Readable, Writable, Transform, PassThrough } = require('node:stream');
const pump = require('pump');
async function runContract() {
// 1. pump throws Error when fewer than two streams are provided
{
assert.throws(
() => pump(),
/^Error: pump requires two streams per minimum$/,
'pump() without arguments should throw Error'
);
assert.throws(
() => pump(new PassThrough()),
/^Error: pump requires two streams per minimum$/,
'pump(singleStream) should throw Error'
);
assert.throws(
() => pump([new PassThrough()]),
/^Error: pump requires two streams per minimum$/,
'pump([singleStream]) should throw Error'
);
}
// 2. pump pipes data from readable stream through transform stream to writable stream and invokes callback on success
await new Promise((resolve, reject) => {
const chunks = [];
const source = Readable.from(['hello', ' ', 'world']);
const uppercase = new Transform({
transform(chunk, encoding, callback) {
callback(null, chunk.toString().toUpperCase());
}
});
const destination = new Writable({
write(chunk, encoding, callback) {
chunks.push(chunk.toString());
callback();
}
});
pump(source, uppercase, destination, (err) => {
try {
assert.ifError(err);
assert.equal(chunks.join(''), 'HELLO WORLD');
resolve();
} catch (e) {
reject(e);
}
});
});
// 3. pump accepts an array of streams and completes data piping successfully
await new Promise((resolve, reject) => {
const received = [];
const source = Readable.from(['item1', 'item2', 'item3']);
const destination = new Writable({
write(chunk, encoding, callback) {
received.push(chunk.toString());
callback();
}
});
pump([source, destination], (err) => {
try {
assert.ifError(err);
assert.deepEqual(received, ['item1', 'item2', 'item3']);
resolve();
} catch (e) {
reject(e);
}
});
});
// 4. pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const destination = new PassThrough();
let destDestroyed = false;
destination.on('close', () => {
destDestroyed = true;
});
pump(source, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'source failed');
assert.equal(destination.destroyed || destDestroyed, true, 'Destination should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
source.destroy(new Error('source failed'));
});
// 5. pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const destination = new PassThrough();
let sourceDestroyed = false;
source.on('close', () => {
sourceDestroyed = true;
});
pump(source, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'destination failed');
assert.equal(source.destroyed || sourceDestroyed, true, 'Source should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
destination.destroy(new Error('destination failed'));
});
// 6. pump destroys all streams in the pipeline when an intermediate transform stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const transform = new PassThrough();
const destination = new PassThrough();
pump(source, transform, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'transform failed');
assert.equal(source.destroyed, true, 'Source should be destroyed');
assert.equal(destination.destroyed, true, 'Destination should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
transform.destroy(new Error('transform failed'));
});
// 7. pump returns the destination stream from the pipeline
{
const source = new PassThrough();
const destination = new PassThrough();
const result = pump(source, destination);
assert.strictEqual(result, destination, 'pump should return the last stream');
}
console.log('All pump contract assertions passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
오리진 시더
익명