Exemple
scheduler 0.25.0: unstable_LowPriority
Échantillon vérifié pour npm scheduler 0.25.0: unstable_LowPriority. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:bbd47e3311108bebaaefa699bac545e65e765b29b4048c45f3cc9c262863eb44
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 alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
Cas
HOW- Objectif
- verify scheduler.unstable_LowPriority in pkg:npm/scheduler@0.25.0
- Paquets
- Symboles
-
- scheduler.unstable_LowPriority
- Créé
- 2026-08-21T02:47:28Z
Contrat
- unstable_LowPriority is exported as a numeric priority constant
- unstable_runWithPriority executes callback with unstable_LowPriority priority level
- unstable_scheduleCallback accepts unstable_LowPriority and creates scheduled task
- unstable_wrapCallback binds current priority level when running with unstable_LowPriority
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 scheduler.unstable_LowPriority 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:
- scheduler.unstable_LowPriority
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:0e1f7d255ad6ad95911a124b0149f8bb8f6cdca01b863cc03cad12f319fbf993","contract":["unstable_LowPriority is exported as a numeric priority constant","unstable_runWithPriority executes callback with unstable_LowPriority priority level","unstable_scheduleCallback accepts unstable_LowPriority and creates scheduled task","unstable_wrapCallback binds current priority level when running with unstable_LowPriority"],"goal":"verify scheduler.unstable_LowPriority in pkg:npm/scheduler@0.25.0","kind":"HOW","packages":["pkg:npm/scheduler@0.25.0"],"schemaVersion":1,"symbols":["scheduler.unstable_LowPriority"]},"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":["scheduler.unstable_LowPriority"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-scheduler-low-priority",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-scheduler-low-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-low-priority",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of scheduler.unstable_LowPriority",
"main": "src/index.js",
"dependencies": {
"scheduler": "0.25.0"
}
}
{
"schemaVersion": 1,
"goal": "verify scheduler.unstable_LowPriority in pkg:npm/scheduler@0.25.0",
"kind": "HOW",
"packages": [
"pkg:npm/scheduler@0.25.0"
],
"symbols": [
"scheduler.unstable_LowPriority"
]
}
const scheduler = require('scheduler');
const {
unstable_LowPriority,
unstable_NormalPriority,
unstable_runWithPriority,
unstable_scheduleCallback,
unstable_cancelCallback,
unstable_wrapCallback,
unstable_getCurrentPriorityLevel
} = scheduler;
/**
* Get the numeric value of Low Priority level in Scheduler.
* @returns {number}
*/
function getLowPriorityLevel() {
return unstable_LowPriority;
}
/**
* Execute a function with low priority and return its result.
* @param {Function} callback
* @returns {*}
*/
function runAtLowPriority(callback) {
return unstable_runWithPriority(unstable_LowPriority, callback);
}
/**
* Schedule a task to be executed at low priority.
* @param {Function} callback
* @param {object} [options]
* @returns {object} Scheduled task node
*/
function scheduleLowPriorityTask(callback, options) {
return unstable_scheduleCallback(unstable_LowPriority, callback, options);
}
/**
* Wrap a callback so that it always executes at low priority.
* @param {Function} callback
* @returns {Function}
*/
function createLowPriorityCallback(callback) {
return unstable_runWithPriority(unstable_LowPriority, () => {
return unstable_wrapCallback(callback);
});
}
module.exports = {
unstable_LowPriority,
unstable_NormalPriority,
getLowPriorityLevel,
runAtLowPriority,
scheduleLowPriorityTask,
createLowPriorityCallback,
unstable_getCurrentPriorityLevel,
unstable_cancelCallback
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
unstable_LowPriority,
unstable_NormalPriority,
getLowPriorityLevel,
runAtLowPriority,
scheduleLowPriorityTask,
createLowPriorityCallback,
unstable_getCurrentPriorityLevel,
unstable_cancelCallback
} = require('../src/index.js');
// 1. unstable_LowPriority is exported as a numeric priority constant
assert.equal(typeof unstable_LowPriority, 'number', 'unstable_LowPriority must be a number');
assert.equal(unstable_LowPriority, 4, 'unstable_LowPriority value should be 4');
assert.equal(getLowPriorityLevel(), 4, 'getLowPriorityLevel() should return 4');
// 2. unstable_runWithPriority executes callback with unstable_LowPriority priority level
const defaultPriority = unstable_getCurrentPriorityLevel();
let capturedPriority = null;
const result = runAtLowPriority(() => {
capturedPriority = unstable_getCurrentPriorityLevel();
return 'low-priority-result';
});
assert.equal(result, 'low-priority-result', 'runAtLowPriority should return callback result');
assert.equal(capturedPriority, unstable_LowPriority, 'Priority inside runAtLowPriority should be unstable_LowPriority');
assert.equal(unstable_getCurrentPriorityLevel(), defaultPriority, 'Priority outside runAtLowPriority should be restored');
// 3. unstable_scheduleCallback accepts unstable_LowPriority and creates scheduled task
let taskRan = false;
const task = scheduleLowPriorityTask(() => {
taskRan = true;
return 'task-complete';
});
assert.equal(typeof task, 'object', 'scheduleLowPriorityTask should return a task object');
assert.equal(task.priorityLevel, unstable_LowPriority, 'Task priorityLevel should match unstable_LowPriority');
assert.equal(typeof task.id, 'number', 'Task should have numeric id');
// Cancel task cleanly
unstable_cancelCallback(task);
assert.equal(task.callback, null, 'Cancelled task callback should be null');
// 4. unstable_wrapCallback binds current priority level when running with unstable_LowPriority
const lowPriorityCallback = createLowPriorityCallback(() => {
return unstable_getCurrentPriorityLevel();
});
assert.equal(typeof lowPriorityCallback, 'function', 'createLowPriorityCallback should return a function');
const executionPriority = lowPriorityCallback();
assert.equal(executionPriority, unstable_LowPriority, 'Wrapped callback should run with unstable_LowPriority');
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme