サンプル
node-releases 2.0.51: slice
検証済みサンプル — npm node-releases 2.0.51: slice. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: slice extracts a subset of release records without…
sha256:c2dc9a59d353c85e42439d5f1f1ea410e85a59fc2681e56f77ec8cdfe2fd8b6c
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-05 |
ケース
HOW- ゴール
- verify node-releases.slice in pkg:npm/node-releases@2.0.51
- パッケージ
- シンボル
-
- node-releases.slice
- 環境
- node 22.23.2
- 作成日
- 2026-09-05T22:53:55Z
コントラクト
- slice extracts a subset of release records without mutating the source envs array
- slice with positive start and end extracts the exact range of release records
- slice with negative start extracts the most recent N releases from the end of the array
- slice with start index greater than or equal to array length returns an empty array
- slice without arguments creates a shallow copy of all release records with identical elements
- slice with negative start exceeding array length normalizes to index zero and returns elements from start
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
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 node-releases.slice in pkg:npm/node-releases@2.0.51
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/node-releases@2.0.51
Demonstrate these symbols/APIs:
- node-releases.slice
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:fd76e71f29f4c34221d40ff3c66978f452de3acba4352c331f0aac3d4e27d391","contract":["slice extracts a subset of release records without mutating the source envs array","slice with positive start and end extracts the exact range of release records","slice with negative start extracts the most recent N releases from the end of the array","slice with start index greater than or equal to array length returns an empty array","slice without arguments creates a shallow copy of all release records with identical elements","slice with negative start exceeding array length normalizes to index zero and returns elements from start"],"goal":"verify node-releases.slice in pkg:npm/node-releases@2.0.51","kind":"HOW","packages":["pkg:npm/node-releases@2.0.51"],"schemaVersion":1,"symbols":["node-releases.slice"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/node-releases@2.0.51"],"schemaVersion":1,"subject":"pkg:npm/node-releases@2.0.51","symbols":["node-releases.slice"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-node-releases-slice",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-node-releases-slice",
"version": "1.0.0",
"dependencies": {
"node-releases": "2.0.51"
}
},
"node_modules/node-releases": {
"version": "2.0.51",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz",
"integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==",
"license": "MIT",
"engines": {
"node": ">=18"
}
}
}
}
{
"name": "sample-node-releases-slice",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"node-releases": "2.0.51"
}
}
{
"schemaVersion": 1,
"goal": "verify node-releases.slice in pkg:npm/node-releases@2.0.51",
"kind": "HOW",
"packages": [
"pkg:npm/node-releases@2.0.51"
],
"symbols": [
"node-releases.slice"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import envs from 'node-releases/data/processed/envs.json' with { type: 'json' };
// Ensure source data is valid array
assert.ok(Array.isArray(envs), 'envs must be an array');
const initialLength = envs.length;
assert.ok(initialLength > 0, 'envs must contain records');
// 1. slice extracts a subset of release records without mutating the source envs array
const firstTen = envs.slice(0, 10);
assert.equal(firstTen.length, 10, 'Sliced length should be 10');
assert.equal(envs.length, initialLength, 'Original envs length must remain unchanged');
assert.deepEqual(firstTen[0], envs[0], 'First element of slice must match original');
assert.deepEqual(firstTen[9], envs[9], 'Tenth element of slice must match original');
// 2. slice with positive start and end extracts the exact range of release records
const range = envs.slice(5, 15);
assert.equal(range.length, 10, 'Range slice length should be 10');
assert.deepEqual(range[0], envs[5], 'First element of range must equal envs[5]');
assert.deepEqual(range[9], envs[14], 'Last element of range must equal envs[14]');
// 3. slice with negative start extracts the most recent N releases from the end of the array
const recentFive = envs.slice(-5);
assert.equal(recentFive.length, 5, 'Negative start slice should have 5 items');
assert.deepEqual(recentFive[0], envs[initialLength - 5], 'First element of negative slice must match corresponding tail index');
assert.deepEqual(recentFive[4], envs[initialLength - 1], 'Last element of negative slice must match last release');
// 4. slice with start index greater than or equal to array length returns an empty array
const emptySlice = envs.slice(initialLength + 10);
assert.ok(Array.isArray(emptySlice), 'Empty slice must be an array');
assert.equal(emptySlice.length, 0, 'Empty slice length must be 0');
// 5. slice without arguments creates a shallow copy of all release records with identical elements
const fullCopy = envs.slice();
assert.notEqual(fullCopy, envs, 'Slice shallow copy must have different reference');
assert.equal(fullCopy.length, initialLength, 'Shallow copy must have same length as source');
assert.deepEqual(fullCopy[0], envs[0], 'First element of copy must match source');
assert.deepEqual(fullCopy[initialLength - 1], envs[initialLength - 1], 'Last element of copy must match source');
// 6. slice with negative start exceeding array length normalizes to index zero and returns elements from start
const clampedSlice = envs.slice(-1000, 3);
assert.equal(clampedSlice.length, 3, 'Slice with large negative start should start at index 0');
assert.deepEqual(clampedSlice[0], envs[0], 'Element at index 0 should match source[0]');
// CommonJS compatibility check
const require = createRequire(import.meta.url);
const cjsEnvs = require('node-releases/data/processed/envs.json');
assert.ok(Array.isArray(cjsEnvs), 'CJS envs must be an array');
const cjsSlice = cjsEnvs.slice(0, 5);
assert.equal(cjsSlice.length, 5, 'CJS slice should return 5 elements');
assert.deepEqual(cjsSlice[0], cjsEnvs[0], 'CJS slice first element must match');
オリジンシーダー
匿名