CodeSampleX

Ejemplo

update-browserslist-db 1.2.3: name

Muestra verificada para npm update-browserslist-db 1.2.3: name. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.

sha256:d2d713bbfbb58bd38ae7efa4ad65eded420e68e14c0137b2a5377ce64f6979dd

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 debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-07

Caso

HOW
Objetivo
verify update-browserslist-db.name in pkg:npm/update-browserslist-db@1.2.3
Paquetes
Símbolos
  • update-browserslist-db.name
Entorno
node 22.23.2
Creado
2026-09-07T00:52:41Z

Contrato

  1. update-browserslist-db exports a function whose name property is updateDB
  2. update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when package.json is missing
  3. update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when lockfile is missing

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Descargar el artefacto de código fuente (tar.gz)

Código fuente

PROMPT.md
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 update-browserslist-db.name in pkg:npm/update-browserslist-db@1.2.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/update-browserslist-db@1.2.3
Demonstrate these symbols/APIs:
  - update-browserslist-db.name
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.
csx.json
{"case":{"caseId":"case:sha256:d74220e7df9945b7758a6045bcf15a4c3c16a2883f9751c741c0b45a82bd1b57","constraints":{"executionContext":"node"},"contract":["update-browserslist-db exports a function whose name property is updateDB","update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when package.json is missing","update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when lockfile is missing"],"goal":"verify update-browserslist-db.name in pkg:npm/update-browserslist-db@1.2.3","kind":"HOW","packages":["pkg:npm/update-browserslist-db@1.2.3"],"schemaVersion":1,"symbols":["update-browserslist-db.name"]},"contractCommand":["node","test/contract.cjs"],"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/update-browserslist-db@1.2.3"],"schemaVersion":1,"subject":"pkg:npm/update-browserslist-db@1.2.3","symbols":["update-browserslist-db.name"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "update-browserslist-db-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "update-browserslist-db-verification",
      "version": "1.0.0",
      "dependencies": {
        "update-browserslist-db": "1.2.3"
      }
    },
    "node_modules/baseline-browser-mapping": {
      "version": "2.11.19",
      "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.19.tgz",
      "integrity": "sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw==",
      "license": "Apache-2.0",
      "peer": true,
      "bin": {
        "baseline-browser-mapping": "dist/cli.cjs"
      },
      "engines": {
        "node": ">=6.0.0"
      }
    },
    "node_modules/browserslist": {
      "version": "4.28.8",
      "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
      "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
      "funding": [
        {
          "type": "opencollective",
          "url": "https://opencollective.com/browserslist"
        },
        {
          "type": "tidelift",
          "url": "https://tidelift.com/funding/github/npm/browserslist"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/ai"
        }
      ],
      "license": "MIT",
      "peer": true,
      "dependencies": {
        "baseline-browser-mapping": "^2.11.12",
        "caniuse-lite": "^1.0.30001809",
        "electron-to-chromium": "^1.5.402",
        "node-releases": "^2.0.53",
        "update-browserslist-db": "^1.3.0"
      },
      "bin": {
        "browserslist": "cli.js"
      },
      "engines": {
        "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
      }
    },
    "node_modules/browserslist/node_modules/update-browserslist-db": {
      "version": "1.3.1",
      "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz",
      "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==",
      "funding": [
        {
          "type": "opencollective",
          "url": "https://opencollective.com/browserslist"
        },
        {
          "type": "tidelift",
          "url": "https://tidelift.com/funding/github/npm/browserslist"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/ai"
        }
      ],
      "license": "MIT",
      "peer": true,
      "dependencies": {
        "escalade": "^3.2.0",
        "picocolors": "^1.1.1"
      },
      "bin": {
        "update-browserslist-db": "cli.js"
      },
      "peerDependencies": {
        "browserslist": ">= 4.21.0"
      }
    },
    "node_modules/caniuse-lite": {
      "version": "1.0.30001810",
      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
      "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
      "funding": [
        {
          "type": "opencollective",
          "url": "https://opencollective.com/browserslist"
        },
        {
          "type": "tidelift",
          "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/ai"
        }
      ],
      "license": "CC-BY-4.0",
      "peer": true
    },
    "node_modules/electron-to-chromium": {
      "version": "1.5.415",
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.415.tgz",
      "integrity": "sha512-958V+Kbhtgz+SxXeEVKBjrlKRBIDAYvUJfwhjxMZ5S6ut9jAl7l9ZKBkBrvjyjZE36PabLUo2L8kEeV5O4vgJg==",
      "license": "ISC",
      "peer": true
    },
    "node_modules/escalade": {
      "version": "3.2.0",
      "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
      "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/node-releases": {
      "version": "2.0.54",
      "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
      "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
      "license": "MIT",
      "peer": true,
      "engines": {
        "node": ">=18"
      }
    },
    "node_modules/picocolors": {
      "version": "1.1.1",
      "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
      "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
      "license": "ISC"
    },
    "node_modules/update-browserslist-db": {
      "version": "1.2.3",
      "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
      "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
      "funding": [
        {
          "type": "opencollective",
          "url": "https://opencollective.com/browserslist"
        },
        {
          "type": "tidelift",
          "url": "https://tidelift.com/funding/github/npm/browserslist"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/ai"
        }
      ],
      "license": "MIT",
      "dependencies": {
        "escalade": "^3.2.0",
        "picocolors": "^1.1.1"
      },
      "bin": {
        "update-browserslist-db": "cli.js"
      },
      "peerDependencies": {
        "browserslist": ">= 4.21.0"
      }
    }
  }
}
package.json
{
  "name": "update-browserslist-db-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for update-browserslist-db",
  "dependencies": {
    "update-browserslist-db": "1.2.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify update-browserslist-db.name in pkg:npm/update-browserslist-db@1.2.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/update-browserslist-db@1.2.3"
  ],
  "symbols": [
    "update-browserslist-db.name"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
const assert = require('node:assert');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const updateDb = require('update-browserslist-db');

// 1. update-browserslist-db exports a function whose name property is updateDB
assert.strictEqual(typeof updateDb, 'function');
assert.strictEqual(updateDb.name, 'updateDB');
assert.strictEqual(updateDb.length, 0);

// 2. update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when package.json is missing
const tempDirNoPkg = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-nopkg-'));
const originalCwd = process.cwd();
try {
  process.chdir(tempDirNoPkg);
  let printed = [];
  const customPrint = (msg) => {
    printed.push(msg);
  };
  assert.throws(
    () => updateDb(customPrint),
    (err) => {
      return (
        err instanceof Error &&
        err.name === 'BrowserslistUpdateError' &&
        err.browserslist === true &&
        typeof err.message === 'string' &&
        err.message.includes('Cannot find package.json')
      );
    }
  );
  assert.strictEqual(printed.length, 0);
} finally {
  process.chdir(originalCwd);
  fs.rmdirSync(tempDirNoPkg);
}

// 3. update-browserslist-db throws BrowserslistUpdateError with name BrowserslistUpdateError when lockfile is missing
const tempDirPkgOnly = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-pkgonly-'));
try {
  fs.writeFileSync(
    path.join(tempDirPkgOnly, 'package.json'),
    JSON.stringify({ name: 'csx-mock-app', version: '1.0.0' })
  );
  process.chdir(tempDirPkgOnly);
  let printed = [];
  const customPrint = (msg) => {
    printed.push(msg);
  };
  assert.throws(
    () => updateDb(customPrint),
    (err) => {
      return (
        err instanceof Error &&
        err.name === 'BrowserslistUpdateError' &&
        err.browserslist === true &&
        typeof err.message === 'string' &&
        err.message.includes('No lockfile found')
      );
    }
  );
  assert.strictEqual(printed.length, 0);
} finally {
  process.chdir(originalCwd);
  fs.rmSync(tempDirPkgOnly, { recursive: true, force: true });
}

console.log('Contract passed');

Seeder de origen

anónimo