Exemplo
lru-cache 6.0.0
Amostra verificada para npm lru-cache 6.0.0. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: cache.set(key, value) and cache.get(key) store…
sha256:4889208dd521d04e712cd35ec4b50e62c5f5f738754494631e6701226e613c9a
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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/lru-cache@6.0.0
- Pacotes
- Criado
- 2026-08-21T13:50:43Z
Contrato
- cache.set(key, value) and cache.get(key) store and retrieve values
- cache.has(key) returns true for existing keys and false for missing keys
- cache.del(key) removes the key and reduces itemCount
- cache evicts the least recently used item when max capacity is exceeded
- cache.get(key) updates recency so the accessed item is not evicted next
- cache.reset() clears all cached entries and resets itemCount to 0
- cache.keys() and cache.values() return active keys and values in recency order
Arquivos
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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/lru-cache@6.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/lru-cache@6.0.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:47e1a2affbbb295cb66ba426707a9aaee4bcd3db7fed3b64b5c386801487e487","contract":["cache.set(key, value) and cache.get(key) store and retrieve values","cache.has(key) returns true for existing keys and false for missing keys","cache.del(key) removes the key and reduces itemCount","cache evicts the least recently used item when max capacity is exceeded","cache.get(key) updates recency so the accessed item is not evicted next","cache.reset() clears all cached entries and resets itemCount to 0","cache.keys() and cache.values() return active keys and values in recency order"],"goal":"verify pkg:npm/lru-cache@6.0.0","kind":"HOW","packages":["pkg:npm/lru-cache@6.0.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/lru-cache@6.0.0"],"schemaVersion":1,"subject":"pkg:npm/lru-cache@6.0.0","verifierAdapter":"node-typescript@1"}
import LRU from 'lru-cache';
export function createCache(options) {
return new LRU(options);
}
{
"name": "sample-lru-cache",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-lru-cache",
"version": "1.0.0",
"dependencies": {
"lru-cache": "6.0.0"
}
},
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"license": "ISC",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
}
}
}
{
"name": "sample-lru-cache",
"version": "1.0.0",
"description": "Clean-room verification sample for lru-cache",
"type": "module",
"private": true,
"dependencies": {
"lru-cache": "6.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/lru-cache@6.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/lru-cache@6.0.0"
]
}
import assert from 'node:assert/strict';
import LRU from 'lru-cache';
import { createCache } from '../index.mjs';
// 1. cache.set(key, value) and cache.get(key) store and retrieve values
const cache = createCache({ max: 3 });
cache.set('a', 'alpha');
cache.set('b', 'beta');
assert.equal(cache.get('a'), 'alpha');
assert.equal(cache.get('b'), 'beta');
assert.equal(cache.get('c'), undefined);
// 2. cache.has(key) returns true for existing keys and false for missing keys
assert.equal(cache.has('a'), true);
assert.equal(cache.has('b'), true);
assert.equal(cache.has('missing'), false);
// 3. cache.del(key) removes the key and reduces itemCount
assert.equal(cache.itemCount, 2);
cache.del('b');
assert.equal(cache.has('b'), false);
assert.equal(cache.get('b'), undefined);
assert.equal(cache.itemCount, 1);
// 4. cache evicts the least recently used item when max capacity is exceeded
const smallCache = new LRU({ max: 2 });
smallCache.set('x', 1);
smallCache.set('y', 2);
smallCache.set('z', 3);
assert.equal(smallCache.has('x'), false);
assert.equal(smallCache.get('y'), 2);
assert.equal(smallCache.get('z'), 3);
assert.equal(smallCache.itemCount, 2);
// 5. cache.get(key) updates recency so the accessed item is not evicted next
const lruCache = new LRU({ max: 2 });
lruCache.set('first', '1');
lruCache.set('second', '2');
lruCache.get('first');
lruCache.set('third', '3');
assert.equal(lruCache.has('second'), false);
assert.equal(lruCache.has('first'), true);
assert.equal(lruCache.has('third'), true);
// 6. cache.reset() clears all cached entries and resets itemCount to 0
lruCache.reset();
assert.equal(lruCache.itemCount, 0);
assert.equal(lruCache.has('first'), false);
assert.equal(lruCache.has('third'), false);
// 7. cache.keys() and cache.values() return active keys and values in recency order
const iterCache = new LRU({ max: 3 });
iterCache.set('k1', 'v1');
iterCache.set('k2', 'v2');
iterCache.set('k3', 'v3');
assert.deepEqual(Array.from(iterCache.keys()), ['k3', 'k2', 'k1']);
assert.deepEqual(Array.from(iterCache.values()), ['v3', 'v2', 'v1']);
console.log('All lru-cache@6.0.0 contract assertions passed.');
Seeder de origem
anônimo