CodeSampleX

Sample

js-yaml 4.3.0: FAILSAFE_SCHEMA

Verified sample for npm js-yaml 4.3.0: FAILSAFE_SCHEMA. The contract ran on node 22 · linux debian/x64 · docker and passed: yaml.load with FAILSAFE_SCHEMA…

sha256:80e7191e53aea39c2ef6dfe2ad9f583ad9bb8f09f8600cdaa44395d86f430320

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-04

Case

HOW
Goal
verify js-yaml.FAILSAFE_SCHEMA in pkg:npm/js-yaml@4.3.0
Packages
Symbols
  • js-yaml.FAILSAFE_SCHEMA
Created
2026-09-04T23:04:29Z

Contract

  1. yaml.load with FAILSAFE_SCHEMA parses integer and float scalars as strings without numeric conversion
  2. yaml.load with FAILSAFE_SCHEMA parses boolean scalars true and false as literal strings
  3. yaml.load with FAILSAFE_SCHEMA parses null and tilde scalars as literal strings
  4. yaml.load with FAILSAFE_SCHEMA parses YAML mappings into plain JavaScript objects with string scalar values
  5. yaml.load with FAILSAFE_SCHEMA parses YAML sequences into plain JavaScript arrays with string scalar values
  6. yaml.loadAll with FAILSAFE_SCHEMA parses multiple YAML documents preserving scalar string types
  7. yaml.dump with FAILSAFE_SCHEMA serializes data structures using failsafe schema types

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

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 js-yaml.FAILSAFE_SCHEMA in pkg:npm/js-yaml@4.3.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/js-yaml@4.3.0
Demonstrate these symbols/APIs:
  - js-yaml.FAILSAFE_SCHEMA

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:a5aa3e2ef0fa157eb04ac68bb5be8d3e3c221ff7dc8b03eb0ef8c0c2db811cf7","contract":["yaml.load with FAILSAFE_SCHEMA parses integer and float scalars as strings without numeric conversion","yaml.load with FAILSAFE_SCHEMA parses boolean scalars true and false as literal strings","yaml.load with FAILSAFE_SCHEMA parses null and tilde scalars as literal strings","yaml.load with FAILSAFE_SCHEMA parses YAML mappings into plain JavaScript objects with string scalar values","yaml.load with FAILSAFE_SCHEMA parses YAML sequences into plain JavaScript arrays with string scalar values","yaml.loadAll with FAILSAFE_SCHEMA parses multiple YAML documents preserving scalar string types","yaml.dump with FAILSAFE_SCHEMA serializes data structures using failsafe schema types"],"goal":"verify js-yaml.FAILSAFE_SCHEMA in pkg:npm/js-yaml@4.3.0","kind":"HOW","packages":["pkg:npm/js-yaml@4.3.0"],"schemaVersion":1,"symbols":["js-yaml.FAILSAFE_SCHEMA"]},"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.0"],"schemaVersion":1,"subject":"pkg:npm/js-yaml@4.3.0","symbols":["js-yaml.FAILSAFE_SCHEMA"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "js-yaml-failsafe-schema-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "js-yaml-failsafe-schema-verification",
      "version": "1.0.0",
      "dependencies": {
        "js-yaml": "4.3.0"
      }
    },
    "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.0",
      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
      "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
      "license": "MIT",
      "dependencies": {
        "argparse": "^2.0.1"
      },
      "bin": {
        "js-yaml": "bin/js-yaml.js"
      }
    }
  }
}
package.json
{
  "name": "js-yaml-failsafe-schema-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for js-yaml FAILSAFE_SCHEMA",
  "dependencies": {
    "js-yaml": "4.3.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify js-yaml.FAILSAFE_SCHEMA in pkg:npm/js-yaml@4.3.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/js-yaml@4.3.0"
  ],
  "symbols": [
    "js-yaml.FAILSAFE_SCHEMA"
  ]
}
test/contract.cjs
const assert = require('node:assert');
const yaml = require('js-yaml');

// 1. yaml.load with FAILSAFE_SCHEMA parses integer and float scalars as strings without numeric conversion
const numericDoc = `
intVal: 42
negativeInt: -100
floatVal: 3.14159
expVal: 1e+05
`;
const numericParsed = yaml.load(numericDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(typeof numericParsed.intVal, 'string');
assert.strictEqual(numericParsed.intVal, '42');
assert.strictEqual(typeof numericParsed.negativeInt, 'string');
assert.strictEqual(numericParsed.negativeInt, '-100');
assert.strictEqual(typeof numericParsed.floatVal, 'string');
assert.strictEqual(numericParsed.floatVal, '3.14159');
assert.strictEqual(typeof numericParsed.expVal, 'string');
assert.strictEqual(numericParsed.expVal, '1e+05');

// 2. yaml.load with FAILSAFE_SCHEMA parses boolean scalars true and false as literal strings
const boolDoc = `
flagTrue: true
flagFalse: false
yesVal: yes
noVal: no
`;
const boolParsed = yaml.load(boolDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(typeof boolParsed.flagTrue, 'string');
assert.strictEqual(boolParsed.flagTrue, 'true');
assert.strictEqual(typeof boolParsed.flagFalse, 'string');
assert.strictEqual(boolParsed.flagFalse, 'false');
assert.strictEqual(typeof boolParsed.yesVal, 'string');
assert.strictEqual(boolParsed.yesVal, 'yes');
assert.strictEqual(typeof boolParsed.noVal, 'string');
assert.strictEqual(boolParsed.noVal, 'no');

// 3. yaml.load with FAILSAFE_SCHEMA parses null and tilde scalars as literal strings
const nullDoc = `
nullKey: null
tildeKey: ~
`;
const nullParsed = yaml.load(nullDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(typeof nullParsed.nullKey, 'string');
assert.strictEqual(nullParsed.nullKey, 'null');
assert.strictEqual(typeof nullParsed.tildeKey, 'string');
assert.strictEqual(nullParsed.tildeKey, '~');

// 4. yaml.load with FAILSAFE_SCHEMA parses YAML mappings into plain JavaScript objects with string scalar values
const mapDoc = `
service:
  name: test-app
  port: 8080
  active: true
`;
const mapParsed = yaml.load(mapDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.deepStrictEqual(mapParsed, {
  service: {
    name: 'test-app',
    port: '8080',
    active: 'true'
  }
});

// 5. yaml.load with FAILSAFE_SCHEMA parses YAML sequences into plain JavaScript arrays with string scalar values
const seqDoc = `
items:
  - 10
  - true
  - null
  - stringValue
`;
const seqParsed = yaml.load(seqDoc, { schema: yaml.FAILSAFE_SCHEMA });
assert.deepStrictEqual(seqParsed, {
  items: ['10', 'true', 'null', 'stringValue']
});

// 6. yaml.loadAll with FAILSAFE_SCHEMA parses multiple YAML documents preserving scalar string types
const multiDoc = `
---
version: 1
---
version: 2
`;
const multiParsed = [];
yaml.loadAll(multiDoc, (doc) => multiParsed.push(doc), { schema: yaml.FAILSAFE_SCHEMA });
assert.deepStrictEqual(multiParsed, [
  { version: '1' },
  { version: '2' }
]);

// 7. yaml.dump with FAILSAFE_SCHEMA serializes data structures using failsafe schema types
const objToDump = {
  title: 'example',
  tags: ['alpha', 'beta']
};
const dumpedYaml = yaml.dump(objToDump, { schema: yaml.FAILSAFE_SCHEMA });
assert.strictEqual(typeof dumpedYaml, 'string');
const reloaded = yaml.load(dumpedYaml, { schema: yaml.FAILSAFE_SCHEMA });
assert.deepStrictEqual(reloaded, objToDump);

console.log('Contract passed');

Origin Seeder

anonymous