Exemple
scheduler 0.25.0: unstable_IdlePriority
Échantillon vérifié pour npm scheduler 0.25.0: unstable_IdlePriority. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:623a47f538c4f6a455275461066decf9816582f9870298eca8c0b5d4bf2cba1e
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-02 |
Cas
HOW- Objectif
- verify unstable_IdlePriority in pkg:npm/scheduler@0.25.0
- Paquets
- Symboles
-
- unstable_IdlePriority
- Créé
- 2026-09-02T14:19:15Z
Contrat
- unstable_IdlePriority is exported as a numeric constant with value 5
- unstable_IdlePriority has the lowest priority level relative to Immediate, UserBlocking, Normal, and Low priorities
- unstable_runWithPriority executes callbacks with current priority set to unstable_IdlePriority
- unstable_scheduleCallback schedules tasks assigned with unstable_IdlePriority level
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Code source
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 unstable_IdlePriority in pkg:npm/scheduler@0.25.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/scheduler@0.25.0
Demonstrate these symbols/APIs:
- unstable_IdlePriority
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:3451599b82e307f7f0553405a66755a18a39481fe5524910cd7868b76b442176","contract":["unstable_IdlePriority is exported as a numeric constant with value 5","unstable_IdlePriority has the lowest priority level relative to Immediate, UserBlocking, Normal, and Low priorities","unstable_runWithPriority executes callbacks with current priority set to unstable_IdlePriority","unstable_scheduleCallback schedules tasks assigned with unstable_IdlePriority level"],"goal":"verify unstable_IdlePriority in pkg:npm/scheduler@0.25.0","kind":"HOW","packages":["pkg:npm/scheduler@0.25.0"],"schemaVersion":1,"symbols":["unstable_IdlePriority"]},"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/scheduler@0.25.0"],"schemaVersion":1,"subject":"pkg:npm/scheduler@0.25.0","symbols":["unstable_IdlePriority"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-scheduler-unstable-idle-priority",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-scheduler-unstable-idle-priority",
"version": "1.0.0",
"dependencies": {
"scheduler": "0.25.0"
}
},
"node_modules/scheduler": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz",
"integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==",
"license": "MIT"
}
}
}
{
"name": "sample-scheduler-unstable-idle-priority",
"version": "1.0.0",
"private": true,
"description": "Verification of unstable_IdlePriority in scheduler",
"main": "src/index.js",
"dependencies": {
"scheduler": "0.25.0"
}
}
{
"schemaVersion": 1,
"goal": "verify unstable_IdlePriority in pkg:npm/scheduler@0.25.0",
"kind": "HOW",
"packages": [
"pkg:npm/scheduler@0.25.0"
],
"symbols": [
"unstable_IdlePriority"
]
}
const scheduler = require('scheduler');
/**
* Returns the numeric priority constant for idle priority.
* @returns {number} The unstable_IdlePriority value.
*/
function getIdlePriority() {
return scheduler.unstable_IdlePriority;
}
/**
* Executes a callback within the context of idle priority level.
* @param {Function} action - The action to execute under idle priority.
* @returns {{ priority: number, result: any }} The observed priority level and execution result.
*/
function runWithIdlePriority(action) {
return scheduler.unstable_runWithPriority(scheduler.unstable_IdlePriority, () => {
const priority = scheduler.unstable_getCurrentPriorityLevel();
const result = action ? action() : undefined;
return { priority, result };
});
}
/**
* Schedules a callback task with idle priority.
* @param {Function} callback - The task callback.
* @param {object} [options] - Optional task options.
* @returns {object} The scheduled task node.
*/
function scheduleIdleTask(callback, options) {
return scheduler.unstable_scheduleCallback(
scheduler.unstable_IdlePriority,
callback,
options
);
}
module.exports = {
getIdlePriority,
runWithIdlePriority,
scheduleIdleTask,
scheduler
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
getIdlePriority,
runWithIdlePriority,
scheduleIdleTask,
scheduler
} = require('../src/index.js');
// 1. Symbol export and value verification
assert.strictEqual(typeof scheduler.unstable_IdlePriority, 'number', 'unstable_IdlePriority must be exported as a number');
assert.strictEqual(scheduler.unstable_IdlePriority, 5, 'unstable_IdlePriority must have value 5');
assert.strictEqual(getIdlePriority(), 5, 'getIdlePriority helper must return 5');
// 2. Relative priority level ordering (lower numeric value means higher urgency)
assert.strictEqual(scheduler.unstable_ImmediatePriority, 1, 'unstable_ImmediatePriority is 1');
assert.strictEqual(scheduler.unstable_UserBlockingPriority, 2, 'unstable_UserBlockingPriority is 2');
assert.strictEqual(scheduler.unstable_NormalPriority, 3, 'unstable_NormalPriority is 3');
assert.strictEqual(scheduler.unstable_LowPriority, 4, 'unstable_LowPriority is 4');
assert.strictEqual(scheduler.unstable_IdlePriority, 5, 'unstable_IdlePriority is 5');
assert.ok(
scheduler.unstable_ImmediatePriority < scheduler.unstable_UserBlockingPriority &&
scheduler.unstable_UserBlockingPriority < scheduler.unstable_NormalPriority &&
scheduler.unstable_NormalPriority < scheduler.unstable_LowPriority &&
scheduler.unstable_LowPriority < scheduler.unstable_IdlePriority,
'unstable_IdlePriority has the lowest priority level'
);
// 3. Execution under idle priority with unstable_runWithPriority
const executed = runWithIdlePriority(() => 'idle-task-result');
assert.strictEqual(executed.priority, scheduler.unstable_IdlePriority, 'Observed current priority during execution is unstable_IdlePriority (5)');
assert.strictEqual(executed.result, 'idle-task-result', 'Action returns the expected result');
// 4. Scheduling tasks with unstable_scheduleCallback using unstable_IdlePriority
const task = scheduleIdleTask(() => 'queued-result');
assert.strictEqual(typeof task, 'object', 'scheduleIdleTask returns a valid task object');
assert.strictEqual(task.priorityLevel, scheduler.unstable_IdlePriority, 'Task priorityLevel matches unstable_IdlePriority (5)');
assert.strictEqual(typeof task.callback, 'function', 'Task callback is attached');
assert.ok(typeof task.expirationTime === 'number' && task.expirationTime > 0, 'Task has a positive numeric expirationTime');
console.log('Contract assertions for scheduler.unstable_IdlePriority passed.');
Seeder d'origine
anonyme