CodeSampleX

Beispiel

js-yaml 4.3.1

Verifiziertes Beispiel für npm js-yaml 4.3.1. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: yaml.load parses YAML string with scalars…

sha256:ef6e650d864b6c5772325c8af5827317543f62fd0a78b129d3a24df0f287f856

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify pkg:npm/js-yaml@4.3.1
Pakete
Erstellt
2026-08-21T08:23:20Z

Contract

  1. yaml.load parses YAML string with scalars, arrays, and nested mappings into JavaScript objects
  2. yaml.load handles null, boolean, integer, float, and date types accurately
  3. yaml.load throws YAMLException on invalid YAML syntax
  4. yaml.loadAll parses multiple documents separated by --- in a single string
  5. yaml.dump serializes JavaScript objects into valid YAML format
  6. yaml.dump supports options such as indent and sortKeys
  7. yaml.load with FAILSAFE_SCHEMA parses all scalars as strings without implicit type casting
  8. yaml.load and yaml.dump round-trip preserves object structure and data integrity

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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 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.
csx.json
{"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"}
package-lock.json
{
  "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"
      }
    }
  }
}
package.json
{
  "name": "js-yaml-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for js-yaml",
  "dependencies": {
    "js-yaml": "4.3.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/js-yaml@4.3.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/js-yaml@4.3.1"
  ]
}
test/contract.cjs
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');

Ursprungs-Seeder

anonym