Ejemplo
universalify 0.1.2
Muestra verificada para npm universalify 0.1.2. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: fromCallback wraps a callback-taking…
sha256:37618a98709c1b3c09a53bd633b3a29930d0ad8e512fd7f838a9e0acc297720b
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
Caso
HOW- Objetivo
- verify pkg:npm/universalify@0.1.2
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-21T16:02:56Z
Contrato
- fromCallback wraps a callback-taking function so it accepts a callback or returns a Promise
- fromCallback propagates errors to both callback and rejected Promise
- fromPromise wraps a promise-returning function so it accepts a callback or returns a Promise
- fromPromise propagates errors to both callback and rejected Promise
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código fuente
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/universalify@0.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/universalify@0.1.2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:473bddac776163c93a8bffba5abcaaa987cb6155215c404a71c11f6894dcf3c1","constraints":{"executionContext":"node"},"contract":["fromCallback wraps a callback-taking function so it accepts a callback or returns a Promise","fromCallback propagates errors to both callback and rejected Promise","fromPromise wraps a promise-returning function so it accepts a callback or returns a Promise","fromPromise propagates errors to both callback and rejected Promise"],"goal":"verify pkg:npm/universalify@0.1.2","kind":"HOW","packages":["pkg:npm/universalify@0.1.2"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/universalify@0.1.2"],"schemaVersion":1,"subject":"pkg:npm/universalify@0.1.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-universalify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-universalify",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"universalify": "0.1.2"
}
},
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"license": "MIT",
"engines": {
"node": ">= 4.0.0"
}
}
}
}
{
"name": "sample-universalify",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for universalify",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"universalify": "0.1.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/universalify@0.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/universalify@0.1.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const universalify = require('universalify');
function callbackFn(value, callback) {
setTimeout(() => {
if (value === 'error') {
callback(new Error('callback failed'));
} else {
callback(null, `callback:${value}`);
}
}, 5);
}
function promiseFn(value) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (value === 'error') {
reject(new Error('promise failed'));
} else {
resolve(`promise:${value}`);
}
}, 5);
});
}
const universalCallback = universalify.fromCallback(callbackFn);
const universalPromise = universalify.fromPromise(promiseFn);
module.exports = {
universalCallback,
universalPromise
};
const assert = require('node:assert');
const universalify = require('universalify');
const { universalCallback, universalPromise } = require('../src/index.js');
async function runTests() {
// 1. fromCallback with callback on success
await new Promise((resolve, reject) => {
universalCallback('hello', (err, res) => {
if (err) return reject(err);
try {
assert.strictEqual(res, 'callback:hello');
resolve();
} catch (e) {
reject(e);
}
});
});
// 2. fromCallback with callback on error
await new Promise((resolve, reject) => {
universalCallback('error', (err, res) => {
try {
assert(err instanceof Error);
assert.strictEqual(err.message, 'callback failed');
assert.strictEqual(res, undefined);
resolve();
} catch (e) {
reject(e);
}
});
});
// 3. fromCallback without callback returns Promise (resolve)
const resCbPromise = await universalCallback('world');
assert.strictEqual(resCbPromise, 'callback:world');
// 4. fromCallback without callback returns Promise (reject)
await assert.rejects(
async () => {
await universalCallback('error');
},
{
name: 'Error',
message: 'callback failed'
}
);
// 5. fromPromise with callback on success
await new Promise((resolve, reject) => {
universalPromise('hello', (err, res) => {
if (err) return reject(err);
try {
assert.strictEqual(res, 'promise:hello');
resolve();
} catch (e) {
reject(e);
}
});
});
// 6. fromPromise with callback on error
await new Promise((resolve, reject) => {
universalPromise('error', (err, res) => {
try {
assert(err instanceof Error);
assert.strictEqual(err.message, 'promise failed');
assert.strictEqual(res, undefined);
resolve();
} catch (e) {
reject(e);
}
});
});
// 7. fromPromise without callback returns Promise (resolve)
const resPromPromise = await universalPromise('world');
assert.strictEqual(resPromPromise, 'promise:world');
// 8. fromPromise without callback returns Promise (reject)
await assert.rejects(
async () => {
await universalPromise('error');
},
{
name: 'Error',
message: 'promise failed'
}
);
console.log('Contract tests passed successfully.');
}
runTests().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder de origen
anónimo