Sample
scheduler 0.25.0: unstable_scheduleCallback
Verified sample for npm scheduler 0.25.0: unstable_scheduleCallback. The contract ran on node 22 · linux debian/x64 · docker and passed.
sha256:8ac5e07497d9d5091714cee039886021afee195292eb8efabad9d5bffa9983b3
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify unstable_scheduleCallback in pkg:npm/scheduler@0.25.0
- Packages
- Symbols
-
- unstable_scheduleCallback
- Created
- 2026-09-02T14:24:31Z
Contract
- unstable_scheduleCallback is exported as a function
- unstable_scheduleCallback schedules a task with priorityLevel and returns a task descriptor
- unstable_scheduleCallback computes expirationTime according to priority timeout
- unstable_scheduleCallback offsets startTime when delay option is provided
- unstable_scheduleCallback generates sequential task IDs for new tasks
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
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_scheduleCallback 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_scheduleCallback
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:6e90286abe4018be44abe0255f922b7a1d3c2134d5b36bec941f3356b094e4d3","contract":["unstable_scheduleCallback is exported as a function","unstable_scheduleCallback schedules a task with priorityLevel and returns a task descriptor","unstable_scheduleCallback computes expirationTime according to priority timeout","unstable_scheduleCallback offsets startTime when delay option is provided","unstable_scheduleCallback generates sequential task IDs for new tasks"],"goal":"verify unstable_scheduleCallback in pkg:npm/scheduler@0.25.0","kind":"HOW","packages":["pkg:npm/scheduler@0.25.0"],"schemaVersion":1,"symbols":["unstable_scheduleCallback"]},"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_scheduleCallback"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-scheduler-schedule-callback",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-scheduler-schedule-callback",
"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-schedule-callback",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of scheduler unstable_scheduleCallback",
"main": "src/index.js",
"dependencies": {
"scheduler": "0.25.0"
}
}
{
"schemaVersion": 1,
"goal": "verify unstable_scheduleCallback in pkg:npm/scheduler@0.25.0",
"kind": "HOW",
"packages": [
"pkg:npm/scheduler@0.25.0"
],
"symbols": [
"unstable_scheduleCallback"
]
}
const scheduler = require('scheduler');
/**
* Schedules a callback with a specified priority level and optional settings.
* @param {number} priority - The priority level constant.
* @param {Function} callback - The callback function to execute.
* @param {object} [options] - Options such as { delay: number }.
* @returns {object} The scheduled task object.
*/
function scheduleWithPriority(priority, callback, options) {
return scheduler.unstable_scheduleCallback(priority, callback, options);
}
/**
* Schedules an immediate priority task.
* @param {Function} callback - The callback function.
* @returns {object} The scheduled task object.
*/
function scheduleImmediate(callback) {
return scheduler.unstable_scheduleCallback(
scheduler.unstable_ImmediatePriority,
callback
);
}
/**
* Schedules a normal priority task.
* @param {Function} callback - The callback function.
* @param {object} [options] - Scheduling options.
* @returns {object} The scheduled task object.
*/
function scheduleNormal(callback, options) {
return scheduler.unstable_scheduleCallback(
scheduler.unstable_NormalPriority,
callback,
options
);
}
/**
* Schedules a delayed task with normal priority.
* @param {Function} callback - The callback function.
* @param {number} delayMs - Delay in milliseconds.
* @returns {object} The scheduled task object.
*/
function scheduleDelayed(callback, delayMs) {
return scheduler.unstable_scheduleCallback(
scheduler.unstable_NormalPriority,
callback,
{ delay: delayMs }
);
}
module.exports = {
scheduler,
scheduleWithPriority,
scheduleImmediate,
scheduleNormal,
scheduleDelayed
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
scheduler,
scheduleWithPriority,
scheduleImmediate,
scheduleNormal,
scheduleDelayed
} = require('../src/index.js');
// 1. unstable_scheduleCallback is exported as a function
assert.equal(
typeof scheduler.unstable_scheduleCallback,
'function',
'unstable_scheduleCallback must be a function'
);
// 2. unstable_scheduleCallback schedules a task with priorityLevel and returns a task descriptor
{
const noop = () => {};
const task = scheduleNormal(noop);
assert.ok(task, 'Task descriptor must be returned');
assert.equal(typeof task.id, 'number', 'Task must have a numeric id');
assert.equal(task.callback, noop, 'Task callback must match provided function');
assert.equal(
task.priorityLevel,
scheduler.unstable_NormalPriority,
'Task priority level must match NormalPriority'
);
assert.equal(typeof task.startTime, 'number', 'Task startTime must be numeric');
assert.equal(typeof task.expirationTime, 'number', 'Task expirationTime must be numeric');
}
// 3. unstable_scheduleCallback computes expirationTime according to priority timeout
{
const noop = () => {};
const normalTask = scheduleWithPriority(scheduler.unstable_NormalPriority, noop);
const immediateTask = scheduleWithPriority(scheduler.unstable_ImmediatePriority, noop);
const lowTask = scheduleWithPriority(scheduler.unstable_LowPriority, noop);
const userBlockingTask = scheduleWithPriority(scheduler.unstable_UserBlockingPriority, noop);
const idleTask = scheduleWithPriority(scheduler.unstable_IdlePriority, noop);
// Immediate priority timeout: -1ms
assert.equal(immediateTask.expirationTime, immediateTask.startTime - 1);
// User blocking priority timeout: 250ms
assert.equal(userBlockingTask.expirationTime, userBlockingTask.startTime + 250);
// Normal priority timeout: 5000ms
assert.equal(normalTask.expirationTime, normalTask.startTime + 5000);
// Low priority timeout: 10000ms
assert.equal(lowTask.expirationTime, lowTask.startTime + 10000);
// Idle priority timeout: 1073741823ms (maxSigned31BitInt)
assert.equal(idleTask.expirationTime, idleTask.startTime + 1073741823);
}
// 4. unstable_scheduleCallback offsets startTime when delay option is provided
{
const noop = () => {};
const delayMs = 500;
const beforeTime = scheduler.unstable_now();
const delayedTask = scheduleDelayed(noop, delayMs);
const afterTime = scheduler.unstable_now();
assert.ok(
delayedTask.startTime >= beforeTime + delayMs &&
delayedTask.startTime <= afterTime + delayMs,
'Delayed task startTime must be offset by delay amount'
);
assert.equal(
delayedTask.sortIndex,
delayedTask.startTime,
'Delayed task sortIndex must equal startTime'
);
}
// 5. unstable_scheduleCallback generates sequential task IDs for new tasks
{
const noop = () => {};
const task1 = scheduleNormal(noop);
const task2 = scheduleNormal(noop);
assert.equal(
task2.id,
task1.id + 1,
'Subsequent tasks must receive incremented task IDs'
);
}
console.log('Contract assertions for unstable_scheduleCallback passed.');
Origin Seeder
anonymous