Ejemplo
react-refresh 0.17.0: hasUnrecoverableErrors
Muestra verificada para npm react-refresh 0.17.0: hasUnrecoverableErrors. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:3588ea779a92d3b285a825aabf650a6f190c82f7ce1325ffe76251126e182c9c
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-05 |
Caso
HOW- Objetivo
- verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0
- Paquetes
- Símbolos
-
- react-refresh.hasUnrecoverableErrors
- Entorno
- node 22.23.2
- Creado
- 2026-09-05T01:31:22Z
Contrato
- hasUnrecoverableErrors returns false initially when no errors have occurred
- hasUnrecoverableErrors returns false after registering component types
- hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh
- hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls
- hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
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 react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-refresh@0.17.0
Demonstrate these symbols/APIs:
- react-refresh.hasUnrecoverableErrors
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:19b4bdc69ff3a63d6f6201fd33e41583ba8d0a1636bb6db2c88e12a503aa3874","constraints":{"executionContext":"node"},"contract":["hasUnrecoverableErrors returns false initially when no errors have occurred","hasUnrecoverableErrors returns false after registering component types","hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh","hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls","hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments"],"goal":"verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0","kind":"HOW","packages":["pkg:npm/react-refresh@0.17.0"],"schemaVersion":1,"symbols":["react-refresh.hasUnrecoverableErrors"]},"contractCommand":["node","test/contract.mjs"],"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/react-refresh@0.17.0"],"schemaVersion":1,"subject":"pkg:npm/react-refresh@0.17.0","symbols":["react-refresh.hasUnrecoverableErrors"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-refresh-has-unrecoverable-errors",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-refresh-has-unrecoverable-errors",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react-refresh": "0.17.0"
}
},
"node_modules/react-refresh": {
"version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
"integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-refresh-has-unrecoverable-errors",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"react-refresh": "0.17.0"
}
}
{
"schemaVersion": 1,
"goal": "verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0",
"kind": "HOW",
"packages": [
"pkg:npm/react-refresh@0.17.0"
],
"symbols": [
"react-refresh.hasUnrecoverableErrors"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import refreshRuntimeModule from "react-refresh/runtime";
export const RefreshRuntime =
refreshRuntimeModule && typeof refreshRuntimeModule === "object" && "default" in refreshRuntimeModule
? refreshRuntimeModule.default
: refreshRuntimeModule;
/**
* Checks whether Fast Refresh runtime has encountered unrecoverable errors.
*
* @param {...any} args - Optional arguments passed to the check function.
* @returns {boolean} False when the runtime has no unrecoverable errors.
*/
export function hasUnrecoverableErrors(...args) {
return RefreshRuntime.hasUnrecoverableErrors(...args);
}
/**
* Registers a component type with a persistent identifier for Fast Refresh.
*
* @param {any} type - The component function or object
* @param {string} id - Persistent identifier for the component family
*/
export function register(type, id) {
RefreshRuntime.register(type, id);
}
/**
* Triggers a Fast Refresh cycle across registered components and renderers.
*
* @returns {object|null} Refresh cycle result or null if nothing was refreshed
*/
export function performReactRefresh() {
return RefreshRuntime.performReactRefresh();
}
import assert from "node:assert/strict";
import refreshRuntimeModule from "react-refresh/runtime";
import {
RefreshRuntime,
hasUnrecoverableErrors,
register,
performReactRefresh
} from "../src/index.mjs";
const rawRuntime =
refreshRuntimeModule && typeof refreshRuntimeModule === "object" && "default" in refreshRuntimeModule
? refreshRuntimeModule.default
: refreshRuntimeModule;
// Contract 1: hasUnrecoverableErrors returns false initially when no errors have occurred
{
assert.equal(typeof hasUnrecoverableErrors(), "boolean");
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(typeof rawRuntime.hasUnrecoverableErrors, "function");
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 2: hasUnrecoverableErrors returns false after registering component types
{
function HeaderComponent() {
return "Header";
}
register(HeaderComponent, "HeaderId");
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 3: hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh
{
performReactRefresh();
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 4: hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls
{
for (let i = 0; i < 5; i++) {
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
}
// Contract 5: hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments
{
assert.equal(hasUnrecoverableErrors(null), false);
assert.equal(hasUnrecoverableErrors(undefined), false);
assert.equal(hasUnrecoverableErrors(new Error("simulated runtime error")), false);
assert.equal(hasUnrecoverableErrors("unexpected string", 123), false);
assert.equal(hasUnrecoverableErrors({ error: true }), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(new Error("raw test")), false);
}
console.log("All react-refresh.hasUnrecoverableErrors contract tests passed successfully.");
Seeder de origen
anónimo