CodeSampleX

Sample

semver 5.7.2: neq

Verified sample for npm semver 5.7.2: neq. The contract ran on node 22 · linux alpine/x64 · docker and passed: semver.neq returns true when two version…

sha256:eed218858c4d32cae8e2e727e4e163f38dbc8d463d28c42666d2fd5ff5c6eea2

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 alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-27

Case

HOW
Goal
verify semver.neq in pkg:npm/semver@5.7.2
Packages
Symbols
  • semver.neq
Created
2026-08-27T21:45:40Z

Contract

  1. semver.neq returns true when two version strings represent different semantic versions
  2. semver.neq returns false when two version strings are semantically identical including with prefixes or whitespace
  3. semver.neq distinguishes between differing prerelease identifiers and release versions
  4. semver.neq treats versions differing only by build metadata as semantically equal returning false

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Download the source artifact (tar.gz)

Source

PROMPT.md
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 semver.neq in pkg:npm/semver@5.7.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/semver@5.7.2
Demonstrate these symbols/APIs:
  - semver.neq

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.
csx.json
{"case":{"caseId":"case:sha256:7b016254d1009be4c6db9949326511af52c780779b8e8530d2961da507926ba1","contract":["semver.neq returns true when two version strings represent different semantic versions","semver.neq returns false when two version strings are semantically identical including with prefixes or whitespace","semver.neq distinguishes between differing prerelease identifiers and release versions","semver.neq treats versions differing only by build metadata as semantically equal returning false"],"goal":"verify semver.neq in pkg:npm/semver@5.7.2","kind":"HOW","packages":["pkg:npm/semver@5.7.2"],"schemaVersion":1,"symbols":["semver.neq"]},"contractCommand":["node","test/contract.js"],"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/semver@5.7.2"],"schemaVersion":1,"subject":"pkg:npm/semver@5.7.2","symbols":["semver.neq"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-semver-neq",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-semver-neq",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "semver": "5.7.2"
      }
    },
    "node_modules/semver": {
      "version": "5.7.2",
      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
      "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
      "license": "ISC",
      "bin": {
        "semver": "bin/semver"
      }
    }
  }
}
package.json
{
  "name": "sample-semver-neq",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification sample for semver.neq",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "semver": "5.7.2"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify semver.neq in pkg:npm/semver@5.7.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/semver@5.7.2"
  ],
  "symbols": [
    "semver.neq"
  ]
}
src/index.js
const semver = require('semver');

/**
 * Returns true if version v1 is not equal to v2 according to semver semantics.
 * @param {string} v1
 * @param {string} v2
 * @param {boolean|object} [options]
 * @returns {boolean}
 */
function notEqual(v1, v2, options) {
  return semver.neq(v1, v2, options);
}

/**
 * Filters a list of versions to only those not equal to the reference version.
 * @param {string[]} versions
 * @param {string} referenceVersion
 * @returns {string[]}
 */
function filterNotEqual(versions, referenceVersion) {
  return versions.filter(v => semver.neq(v, referenceVersion));
}

module.exports = {
  notEqual,
  filterNotEqual
};
test/contract.js
const assert = require('node:assert');
const semver = require('semver');
const { notEqual, filterNotEqual } = require('../src/index.js');

// 1. Basic inequality between different versions
assert.strictEqual(semver.neq('1.2.3', '1.2.4'), true, 'different patch versions should return true');
assert.strictEqual(semver.neq('1.2.3', '2.0.0'), true, 'different major versions should return true');
assert.strictEqual(semver.neq('1.2.3', '1.3.0'), true, 'different minor versions should return true');

// 2. Equality comparison returns false
assert.strictEqual(semver.neq('1.2.3', '1.2.3'), false, 'identical versions should return false');
assert.strictEqual(semver.neq('1.2.3', 'v1.2.3'), false, 'versions with v prefix should be treated as equal');
assert.strictEqual(semver.neq('  1.2.3  ', '1.2.3'), false, 'versions with whitespace should be treated as equal');

// 3. Prerelease tags inequality
assert.strictEqual(semver.neq('1.0.0-alpha', '1.0.0-beta'), true, 'different prerelease tags should return true');
assert.strictEqual(semver.neq('1.0.0-alpha.1', '1.0.0-alpha.2'), true, 'different prerelease versions should return true');
assert.strictEqual(semver.neq('1.0.0-alpha', '1.0.0'), true, 'prerelease vs release should return true');
assert.strictEqual(semver.neq('1.0.0-alpha', '1.0.0-alpha'), false, 'identical prerelease versions should return false');

// 4. Build metadata is ignored in semver equality/inequality
assert.strictEqual(semver.neq('1.0.0+build.1', '1.0.0+build.2'), false, 'versions differing only by build metadata are equal');

// 5. Helper function tests
assert.strictEqual(notEqual('1.0.0', '2.0.0'), true, 'helper notEqual returns true for differing versions');
assert.strictEqual(notEqual('1.0.0', '1.0.0'), false, 'helper notEqual returns false for matching versions');

const candidateVersions = ['1.0.0', '1.0.1', '1.0.0', '2.0.0'];
const filtered = filterNotEqual(candidateVersions, '1.0.0');
assert.deepStrictEqual(filtered, ['1.0.1', '2.0.0'], 'helper filterNotEqual correctly filters out equal versions');

console.log('Contract tests passed successfully.');

Origin Seeder

anonymous