Ejemplo
react 19.2.8: StrictMode
Muestra verificada para npm react 19.2.8: StrictMode. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: StrictMode is exported as a…
sha256:bc7b608fee0220bc8876958bcc8c44ca64321465c792194df44cfcfbb22c03a2
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
linux 24 · ubuntu · glibc 2.39 x64 npm
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-27 |
Caso
HOW- Objetivo
- verify react.StrictMode in pkg:npm/react@19.2.8
- Paquetes
- Símbolos
-
- react.StrictMode
- Creado
- 2026-08-27T15:04:42Z
Contrato
- StrictMode is exported as a symbol from react matching Symbol.for('react.strict_mode')
- StrictMode is distinct from other built-in React symbols including Fragment, Profiler, Suspense, and Activity
- React.createElement with StrictMode produces a valid React element with type StrictMode and $$typeof react.transitional.element
- StrictMode container element is counted as 1 element by React.Children.count and passes React.Children.only
- React.cloneElement preserves StrictMode element type while applying updated key, props, and children
- Helper utilities isStrictModeElement, wrapInStrictMode, and cloneStrictMode correctly inspect, wrap, and clone StrictMode elements
Archivos
- NOTES.md
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Código fuente
# React 19 StrictMode Contract and Behavior
## Prior Search Results
A search for `pkg:npm/react@19.2.8` `react.StrictMode` returned `NO_SAFE_MATCH`.
## Key Behaviors Proven
1. **Symbol Export and Identity**: `React.StrictMode` and named export `StrictMode` are exported from `react` as a `symbol` matching the global `Symbol.for('react.strict_mode')`.
2. **Built-in Type Distinctness**: `StrictMode` is uniquely distinct from other built-in React symbols including `Fragment`, `Profiler`, `Suspense`, and `Activity`.
3. **Element Creation and React 19 Structure**: Calling `React.createElement(StrictMode, ...)` produces a valid React element with `$$typeof` equal to `Symbol.for('react.transitional.element')` and `type` equal to `StrictMode`.
4. **React.Children Utility Compatibility**: `React.Children.count` treats a `StrictMode` element as a single container, `React.Children.only` accepts it, and nested children are accurately accessible via `props.children`.
5. **Element Cloning**: `React.cloneElement` clones `StrictMode` elements preserving the component type while updating props, keys, and children.
6. **Helper Utilities**: `isStrictModeElement`, `wrapInStrictMode`, and `cloneStrictMode` provide safe inspection and transformation wrappers around `StrictMode`.
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.StrictMode 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.StrictMode
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:e08378861a4ed648aa6df052bd44a1cf777c3c773b8d111ed52547d2e6e415d6","contract":["StrictMode is exported as a symbol from react matching Symbol.for('react.strict_mode')","StrictMode is distinct from other built-in React symbols including Fragment, Profiler, Suspense, and Activity","React.createElement with StrictMode produces a valid React element with type StrictMode and $$typeof react.transitional.element","StrictMode container element is counted as 1 element by React.Children.count and passes React.Children.only","React.cloneElement preserves StrictMode element type while applying updated key, props, and children","Helper utilities isStrictModeElement, wrapInStrictMode, and cloneStrictMode correctly inspect, wrap, and clone StrictMode elements"],"goal":"verify react.StrictMode in pkg:npm/react@19.2.8","kind":"HOW","packages":["pkg:npm/react@19.2.8"],"schemaVersion":1,"symbols":["react.StrictMode"]},"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/react@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react@19.2.8","symbols":["react.StrictMode"],"verifierAdapter":"node-typescript@1"}
{
"name": "npm-react-strict-mode",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "npm-react-strict-mode",
"version": "1.0.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": "npm-react-strict-mode",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"react": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react.StrictMode in pkg:npm/react@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react@19.2.8"
],
"symbols": [
"react.StrictMode"
]
}
import React, { StrictMode } from 'react';
/**
* Checks whether a given object is a valid React StrictMode element.
* @param {any} node
* @returns {boolean}
*/
export function isStrictModeElement(node) {
return React.isValidElement(node) && node.type === StrictMode;
}
/**
* Wraps children in a React StrictMode element.
* @param {any} children
* @param {object} [props={}]
* @returns {import('react').ReactElement}
*/
export function wrapInStrictMode(children, props = {}) {
return React.createElement(StrictMode, props, children);
}
/**
* Clones a StrictMode element with additional props or new children.
* @param {import('react').ReactElement} element
* @param {object} [nextProps={}]
* @param {any} [nextChildren]
* @returns {import('react').ReactElement}
*/
export function cloneStrictMode(element, nextProps = {}, nextChildren) {
if (!isStrictModeElement(element)) {
throw new TypeError('Expected a React StrictMode element');
}
if (nextChildren !== undefined) {
return React.cloneElement(element, nextProps, nextChildren);
}
return React.cloneElement(element, nextProps);
}
export { StrictMode };
export default StrictMode;
import assert from 'node:assert/strict';
import React, { StrictMode } from 'react';
import {
isStrictModeElement,
wrapInStrictMode,
cloneStrictMode
} from '../src/index.mjs';
// 1. Export identity & Symbol definition:
// StrictMode is exported as a symbol from 'react' matching Symbol.for('react.strict_mode')
assert.equal(typeof StrictMode, 'symbol', 'StrictMode should be of type symbol');
assert.equal(StrictMode, React.StrictMode, 'Named export StrictMode matches React.StrictMode');
assert.equal(StrictMode, Symbol.for('react.strict_mode'), 'StrictMode matches Symbol.for("react.strict_mode")');
// Distinct from other built-in React symbols
assert.notEqual(StrictMode, React.Fragment, 'StrictMode is distinct from Fragment');
assert.notEqual(StrictMode, React.Profiler, 'StrictMode is distinct from Profiler');
assert.notEqual(StrictMode, React.Suspense, 'StrictMode is distinct from Suspense');
assert.notEqual(StrictMode, React.Activity, 'StrictMode is distinct from Activity');
// 2. React Element Creation & React 19 Transitional Element structure:
const childText = 'Hello StrictMode';
const element = React.createElement(StrictMode, { key: 'strict-key' }, childText);
assert.ok(React.isValidElement(element), 'Element created with StrictMode is a valid React element');
assert.equal(element.type, StrictMode, 'Element type is StrictMode symbol');
assert.equal(element.key, 'strict-key', 'Element key is preserved');
assert.equal(element.props.children, childText, 'Element props.children contains the child content');
assert.equal(element.$$typeof, Symbol.for('react.transitional.element'), 'React 19 element $$typeof is react.transitional.element');
// 3. React.Children utility behavior:
const multiChildElement = React.createElement(
StrictMode,
null,
React.createElement('span', { key: '1' }, 'Child 1'),
React.createElement('span', { key: '2' }, 'Child 2')
);
assert.equal(React.Children.count(multiChildElement), 1, 'React.Children.count views StrictMode container as 1 element');
assert.equal(React.Children.only(multiChildElement), multiChildElement, 'React.Children.only succeeds for StrictMode element');
const extractedChildren = React.Children.toArray(multiChildElement.props.children);
assert.equal(extractedChildren.length, 2, 'React.Children.toArray extracts nested children correctly');
assert.equal(extractedChildren[0].props.children, 'Child 1');
assert.equal(extractedChildren[1].props.children, 'Child 2');
// 4. React.cloneElement support:
const clonedElement = React.cloneElement(element, { key: 'cloned-key', 'data-custom': 'strict-val' }, 'New Child');
assert.ok(React.isValidElement(clonedElement), 'Cloned element is valid');
assert.equal(clonedElement.type, StrictMode, 'Cloned element preserves StrictMode type');
assert.equal(clonedElement.key, 'cloned-key', 'Cloned element has updated key');
assert.equal(clonedElement.props['data-custom'], 'strict-val', 'Cloned element includes new custom prop');
assert.equal(clonedElement.props.children, 'New Child', 'Cloned element has updated children');
// 5. Helper module integration (isStrictModeElement, wrapInStrictMode, cloneStrictMode):
assert.equal(isStrictModeElement(element), true, 'isStrictModeElement returns true for StrictMode element');
assert.equal(isStrictModeElement(React.createElement('div', null)), false, 'isStrictModeElement returns false for div element');
assert.equal(isStrictModeElement(null), false, 'isStrictModeElement returns false for null');
assert.equal(isStrictModeElement({}), false, 'isStrictModeElement returns false for plain object');
const wrapped = wrapInStrictMode(React.createElement('p', null, 'Strict Paragraph'), { key: 'p-wrapper' });
assert.ok(isStrictModeElement(wrapped), 'wrapInStrictMode creates valid StrictMode element');
assert.equal(wrapped.key, 'p-wrapper');
const reCloned = cloneStrictMode(wrapped, { key: 'p-wrapper-updated' });
assert.equal(reCloned.key, 'p-wrapper-updated');
assert.ok(isStrictModeElement(reCloned));
assert.throws(
() => cloneStrictMode(React.createElement('div', null)),
/Expected a React StrictMode element/,
'cloneStrictMode throws TypeError when given non-StrictMode element'
);
console.log('All react.StrictMode contract assertions passed successfully!');
Seeder de origen
anónimo