Beispiel
scheduler 0.25.0: unstable_ImmediatePriority
Verifiziertes Beispiel für npm scheduler 0.25.0: unstable_ImmediatePriority. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.
sha256:ffce32c65a1b89be64a6b405b2637d33d6928d3a1988479d9529121e4980e2b8
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify unstable_ImmediatePriority in pkg:npm/scheduler@0.25.0
- Pakete
- Symbole
-
- unstable_ImmediatePriority
- Umgebung
- node 22.23.2
- Erstellt
- 2026-09-02T14:20:07Z
Contract
- scheduler.unstable_ImmediatePriority is exported as a numeric constant with value 1
- unstable_ImmediatePriority has highest priority level compared to UserBlocking, Normal, Low, and Idle priorities
- scheduler.unstable_runWithPriority executes callbacks with current priority set to unstable_ImmediatePriority
- scheduler.unstable_scheduleCallback schedules tasks assigned with unstable_ImmediatePriority level
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Quelltext
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_ImmediatePriority 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_ImmediatePriority
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:4bfbd69abb01128a28765a5f7012ff73529a1b991d52f51d7c406199a51cc4c9","constraints":{"executionContext":"node"},"contract":["scheduler.unstable_ImmediatePriority is exported as a numeric constant with value 1","unstable_ImmediatePriority has highest priority level compared to UserBlocking, Normal, Low, and Idle priorities","scheduler.unstable_runWithPriority executes callbacks with current priority set to unstable_ImmediatePriority","scheduler.unstable_scheduleCallback schedules tasks assigned with unstable_ImmediatePriority level"],"goal":"verify unstable_ImmediatePriority in pkg:npm/scheduler@0.25.0","kind":"HOW","packages":["pkg:npm/scheduler@0.25.0"],"schemaVersion":1,"symbols":["unstable_ImmediatePriority"]},"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/scheduler@0.25.0"],"schemaVersion":1,"subject":"pkg:npm/scheduler@0.25.0","symbols":["unstable_ImmediatePriority"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-scheduler-immediate-priority",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-scheduler-immediate-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-immediate-priority",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of scheduler unstable_ImmediatePriority",
"main": "src/index.js",
"dependencies": {
"scheduler": "0.25.0"
}
}
{
"schemaVersion": 1,
"goal": "verify unstable_ImmediatePriority in pkg:npm/scheduler@0.25.0",
"kind": "HOW",
"packages": [
"pkg:npm/scheduler@0.25.0"
],
"symbols": [
"unstable_ImmediatePriority"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const scheduler = require('scheduler');
/**
* Returns the numeric constant representing the immediate priority level.
* @returns {number} The immediate priority level constant.
*/
function getImmediatePriority() {
return scheduler.unstable_ImmediatePriority;
}
/**
* Executes a callback synchronously under the immediate priority level.
* @param {Function} action - Function to execute under immediate priority.
* @returns {*} The result of the action and the observed priority level.
*/
function runWithImmediatePriority(action) {
return scheduler.unstable_runWithPriority(scheduler.unstable_ImmediatePriority, () => {
const currentPriority = scheduler.unstable_getCurrentPriorityLevel();
const result = action ? action() : undefined;
return {
priority: currentPriority,
result
};
});
}
/**
* Schedules a callback task with immediate priority level.
* @param {Function} callback - Task callback.
* @param {object} [options] - Scheduling options.
* @returns {object} The scheduled task node.
*/
function scheduleImmediateTask(callback, options) {
return scheduler.unstable_scheduleCallback(
scheduler.unstable_ImmediatePriority,
callback,
options
);
}
module.exports = {
getImmediatePriority,
runWithImmediatePriority,
scheduleImmediateTask,
scheduler
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
getImmediatePriority,
runWithImmediatePriority,
scheduleImmediateTask,
scheduler
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof scheduler.unstable_ImmediatePriority, 'number', 'unstable_ImmediatePriority should be exported as a number');
assert.strictEqual(scheduler.unstable_ImmediatePriority, 1, 'unstable_ImmediatePriority should equal 1');
assert.strictEqual(getImmediatePriority(), 1, 'getImmediatePriority should return 1');
// 2. Relative priority level ordering (1 is highest priority)
assert.ok(scheduler.unstable_ImmediatePriority < scheduler.unstable_UserBlockingPriority, 'Immediate priority is higher than UserBlocking');
assert.ok(scheduler.unstable_ImmediatePriority < scheduler.unstable_NormalPriority, 'Immediate priority is higher than Normal');
assert.ok(scheduler.unstable_ImmediatePriority < scheduler.unstable_LowPriority, 'Immediate priority is higher than Low');
assert.ok(scheduler.unstable_ImmediatePriority < scheduler.unstable_IdlePriority, 'Immediate priority is higher than Idle');
// 3. Execution under immediate priority with runWithImmediatePriority
const executed = runWithImmediatePriority(() => 'immediate-action-executed');
assert.strictEqual(executed.priority, scheduler.unstable_ImmediatePriority, 'Observed execution priority is unstable_ImmediatePriority');
assert.strictEqual(executed.result, 'immediate-action-executed', 'Action returns expected result under immediate priority');
// 4. Scheduling a task with unstable_ImmediatePriority
const task = scheduleImmediateTask(() => 'immediate-task-result');
assert.strictEqual(typeof task, 'object', 'scheduleImmediateTask returns a task object');
assert.strictEqual(task.priorityLevel, scheduler.unstable_ImmediatePriority, 'Task priorityLevel is unstable_ImmediatePriority');
assert.strictEqual(typeof task.callback, 'function', 'Task callback is queued');
assert.ok(typeof task.expirationTime === 'number', 'Task expirationTime is a number');
console.log('Contract assertions for unstable_ImmediatePriority passed.');
Ursprungs-Seeder
anonym