Ejemplo
react 19.2.8: useEffect
Muestra verificada para npm react 19.2.8: useEffect. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: react package.json declares export…
sha256:91a4b2f23a5324c2474b6c9e96de75ebaa1ed7f2a493db6f6ef0d4a91ae7b07a
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
Caso
HOW- Objetivo
- verify react.useEffect in pkg:npm/react@19.2.8
- Paquetes
- Símbolos
-
- react.useEffect
- Entorno
- node 22.23.2
- Creado
- 2026-08-26T08:07:35Z
Contrato
- react package.json declares export mappings for client and react-server entries at version 19.2.8
- react exports useEffect as a function on the default client runtime interface
- react useEffect throws a TypeError when invoked outside an active component render dispatcher
- react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher
- react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher
- react react-server entry explicitly omits useEffect export in server component environments
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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.useEffect in pkg:npm/react@19.2.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react@19.2.8
Demonstrate these symbols/APIs:
- react.useEffect
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:2b6a8f7ce6f5ffd2466facba62575a958115792146fbe0f6caf91ae691ef794c","contract":["react package.json declares export mappings for client and react-server entries at version 19.2.8","react exports useEffect as a function on the default client runtime interface","react useEffect throws a TypeError when invoked outside an active component render dispatcher","react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher","react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher","react react-server entry explicitly omits useEffect export in server component environments"],"goal":"verify react.useEffect in pkg:npm/react@19.2.8","kind":"HOW","packages":["pkg:npm/react@19.2.8"],"schemaVersion":1,"symbols":["react.useEffect"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","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@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react@19.2.8","symbols":["react.useEffect"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-use-effect",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-use-effect",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react": "19.2.8"
}
},
"node_modules/react": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-use-effect",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"react": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react.useEffect in pkg:npm/react@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react@19.2.8"
],
"symbols": [
"react.useEffect"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';
import React from 'react';
const require = createRequire(import.meta.url);
// Contract 1: react package.json declares export mappings for client and react-server entries at version 19.2.8
{
const pkgJsonPath = require.resolve('react/package.json');
assert.ok(fs.existsSync(pkgJsonPath));
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
assert.strictEqual(pkgJson.name, 'react');
assert.strictEqual(pkgJson.version, '19.2.8');
assert.strictEqual(pkgJson.exports['.']['default'], './index.js');
assert.strictEqual(pkgJson.exports['.']['react-server'], './react.react-server.js');
}
// Contract 2: react exports useEffect as a function on the default client runtime interface
{
assert.strictEqual(typeof React.useEffect, 'function');
assert.strictEqual(React.version, '19.2.8');
}
// Contract 3: react useEffect throws a TypeError when invoked outside an active component render dispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
assert.ok(internals && typeof internals === 'object');
assert.strictEqual(internals.H, null);
assert.throws(
() => {
React.useEffect(() => {});
},
{
name: 'TypeError'
}
);
}
// Contract 4: react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
let receivedCall = null;
const mockReturn = { __registered: true };
internals.H = {
useEffect(create, deps) {
receivedCall = { create, deps };
return mockReturn;
}
};
try {
const effectCallback = () => {};
const deps = ['item1', 42, true];
const result = React.useEffect(effectCallback, deps);
assert.strictEqual(result, mockReturn);
assert.ok(receivedCall !== null);
assert.strictEqual(receivedCall.create, effectCallback);
assert.strictEqual(receivedCall.deps, deps);
} finally {
internals.H = null;
}
}
// Contract 5: react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
let receivedCalls = [];
internals.H = {
useEffect(create, deps) {
receivedCalls.push({ create, deps });
}
};
try {
const fn1 = () => {};
const fn2 = () => {};
// Without dependencies argument
React.useEffect(fn1);
assert.strictEqual(receivedCalls.length, 1);
assert.strictEqual(receivedCalls[0].create, fn1);
assert.strictEqual(receivedCalls[0].deps, undefined);
// With empty dependencies array
React.useEffect(fn2, []);
assert.strictEqual(receivedCalls.length, 2);
assert.strictEqual(receivedCalls[1].create, fn2);
assert.deepStrictEqual(receivedCalls[1].deps, []);
} finally {
internals.H = null;
}
}
// Contract 6: react react-server entry explicitly omits useEffect export in server component environments
{
const pkgJsonPath = require.resolve('react/package.json');
const pkgDir = path.dirname(pkgJsonPath);
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
const reactServerEntry = path.join(pkgDir, pkgJson.exports['.']['react-server']);
const reactServer = require(reactServerEntry);
assert.strictEqual(reactServer.version, '19.2.8');
assert.strictEqual(reactServer.useEffect, undefined);
}
console.log('All react.useEffect contract tests passed.');
Seeder de origen
anónimo