Sample
js-yaml 4.3.1
Verified sample for npm js-yaml 4.3.1. The contract ran on node 22 · linux alpine/x64 · docker and passed: yaml.load parses YAML string with scalars, arrays…
sha256:ef6e650d864b6c5772325c8af5827317543f62fd0a78b129d3a24df0f287f856
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:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
Case
HOW- Goal
- verify pkg:npm/js-yaml@4.3.1
- Packages
- Created
- 2026-08-21T08:23:20Z
Contract
- yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects
- yaml.load handles null, boolean, integer, float, and date types accurately
- yaml.load throws YAMLException on invalid YAML syntax
- yaml.loadAll parses multiple documents separated by --- in a single string
- yaml.dump serializes JavaScript objects into valid YAML format
- yaml.dump supports options such as indent and sortKeys
- yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting
- yaml.load and yaml.dump round-trip preserves object structure and data integrity
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
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 pkg:npm/js-yaml@4.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/js-yaml@4.3.1
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:e2df9d02588b60d01fb15c8ad9ef68626a1cc6d0316e67f4d027ed1667ae020c","contract":["yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects","yaml.load handles null, boolean, integer, float, and date types accurately","yaml.load throws YAMLException on invalid YAML syntax","yaml.loadAll parses multiple documents separated by --- in a single string","yaml.dump serializes JavaScript objects into valid YAML format","yaml.dump supports options such as indent and sortKeys","yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting","yaml.load and yaml.dump round-trip preserves object structure and data integrity"],"goal":"verify pkg:npm/js-yaml@4.3.1","kind":"HOW","packages":["pkg:npm/js-yaml@4.3.1"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/js-yaml@4.3.1"],"schemaVersion":1,"subject":"pkg:npm/js-yaml@4.3.1","verifierAdapter":"node-typescript@1"}
{
"name": "js-yaml-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "js-yaml-verification",
"version": "1.0.0",
"dependencies": {
"js-yaml": "4.3.1"
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
},
"node_modules/js-yaml": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
}
}
}
{
"name": "js-yaml-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for js-yaml",
"dependencies": {
"js-yaml": "4.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/js-yaml@4.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/js-yaml@4.3.1"
]
}
const assert = require('node:assert');
const yaml = require('js-yaml');
// 1. yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects
const doc1 = `
title: CodeSampleX
count: 42
items:
- alpha
- beta
nested:
enabled: true
`;
const parsed1 = yaml.load(doc1);
assert.deepStrictEqual(parsed1, {
title: 'CodeSampleX',
count: 42,
items: ['alpha', 'beta'],
nested: { enabled: true }
});
// 2. yaml.load handles null, boolean, integer, float, and date types accurately
const doc2 = `
nullVal: null
tildeNull: ~
boolTrue: true
boolFalse: false
intVal: 100
floatVal: 3.1415
dateVal: 2026-08-21T00:00:00Z
`;
const parsed2 = yaml.load(doc2);
assert.strictEqual(parsed2.nullVal, null);
assert.strictEqual(parsed2.tildeNull, null);
assert.strictEqual(parsed2.boolTrue, true);
assert.strictEqual(parsed2.boolFalse, false);
assert.strictEqual(parsed2.intVal, 100);
assert.strictEqual(parsed2.floatVal, 3.1415);
assert.ok(parsed2.dateVal instanceof Date);
assert.strictEqual(parsed2.dateVal.toISOString(), '2026-08-21T00:00:00.000Z');
// 3. yaml.load throws YAMLException on invalid YAML syntax
assert.throws(() => {
yaml.load('foo: [bar: baz');
}, yaml.YAMLException);
// 4. yaml.loadAll parses multiple documents separated by --- in a single string
const multiDoc = `
---
doc: 1
---
doc: 2
`;
const docs = [];
yaml.loadAll(multiDoc, (d) => docs.push(d));
assert.deepStrictEqual(docs, [{ doc: 1 }, { doc: 2 }]);
assert.deepStrictEqual(yaml.loadAll(multiDoc), [{ doc: 1 }, { doc: 2 }]);
// 5. yaml.dump serializes JavaScript objects into valid YAML format
const obj = { name: 'test', values: [1, 2, 3] };
const dumped = yaml.dump(obj);
assert.strictEqual(typeof dumped, 'string');
assert.deepStrictEqual(yaml.load(dumped), obj);
// 6. yaml.dump supports options such as indent and sortKeys
const sortObj = { z: 1, a: 2, m: 3 };
const dumpedSorted = yaml.dump(sortObj, { sortKeys: true, indent: 4 });
assert.strictEqual(dumpedSorted, 'a: 2\nm: 3\nz: 1\n');
// 7. yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting
const failsafeDoc = 'number: 123\nflag: true';
const failsafeParsed = yaml.load(failsafeDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(failsafeParsed.number, '123');
assert.strictEqual(failsafeParsed.flag, 'true');
// 8. yaml.load and yaml.dump round-trip preserves object structure and data integrity
const complexObj = {
service: 'api-server',
port: 8080,
tags: ['web', 'node'],
meta: { active: true, version: 1.5 }
};
const roundTrip = yaml.load(yaml.dump(complexObj));
assert.deepStrictEqual(roundTrip, complexObj);
console.log('Contract passed');
Origin Seeder
anonymous