CodeSampleX

샘플

roarr 2.15.4: ROARR

검증된 샘플 — npm roarr 2.15.4: ROARR. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: assert ROARR is an object exposed on globalThis and exported by…

sha256:d1a18c8b73040673b867e1adc90e350f5569636ed32b0853973785a127d50382

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
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-06

케이스

HOW
목표
verify roarr.ROARR in pkg:npm/roarr@2.15.4
패키지
심벌
  • roarr.ROARR
생성일
2026-09-06T09:44:14Z

컨트랙트

  1. assert ROARR is an object exposed on globalThis and exported by the roarr package
  2. assert ROARR.versions is an array containing the package version 2.15.4
  3. assert ROARR.sequence is a number tracking log sequence count
  4. assert ROARR.write is a function that can be overridden to intercept serialized log records
  5. assert custom ROARR.write receives serialized JSON log entry with expected structure and sequence
  6. assert ROARR.sequence increments monotonically with each logger call

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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 roarr.ROARR in pkg:npm/roarr@2.15.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/roarr@2.15.4
Demonstrate these symbols/APIs:
  - roarr.ROARR

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:53d5702d69717c7c9b97d66a29f42906f843d6664be8e36c6f49f521e6d7d001","contract":["assert ROARR is an object exposed on globalThis and exported by the roarr package","assert ROARR.versions is an array containing the package version 2.15.4","assert ROARR.sequence is a number tracking log sequence count","assert ROARR.write is a function that can be overridden to intercept serialized log records","assert custom ROARR.write receives serialized JSON log entry with expected structure and sequence","assert ROARR.sequence increments monotonically with each logger call"],"goal":"verify roarr.ROARR in pkg:npm/roarr@2.15.4","kind":"HOW","packages":["pkg:npm/roarr@2.15.4"],"schemaVersion":1,"symbols":["roarr.ROARR"]},"contractCommand":["node","test/contract.mjs"],"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/roarr@2.15.4"],"schemaVersion":1,"subject":"pkg:npm/roarr@2.15.4","symbols":["roarr.ROARR"],"verifierAdapter":"node-typescript@1"}
index.js
if (typeof process.env.ROARR_LOG === 'undefined') {
  process.env.ROARR_LOG = 'true';
}

const { ROARR, default: Roarr } = require('roarr');

function getRoarrGlobal() {
  return ROARR;
}

function getSequence() {
  return ROARR.sequence;
}

function setSequence(value) {
  ROARR.sequence = value;
  return ROARR.sequence;
}

function getVersions() {
  return ROARR.versions;
}

function setWriter(writer) {
  const previousWriter = ROARR.write;
  ROARR.write = writer;
  return previousWriter;
}

function createLogCollector() {
  const logs = [];
  const previousWriter = ROARR.write;
  ROARR.write = (message) => {
    logs.push(JSON.parse(message));
  };
  return {
    getLogs: () => logs,
    restore: () => {
      ROARR.write = previousWriter;
    },
  };
}

module.exports = {
  ROARR,
  Roarr,
  getRoarrGlobal,
  getSequence,
  setSequence,
  getVersions,
  setWriter,
  createLogCollector,
};
package-lock.json
{
  "name": "sample-roarr",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-roarr",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "roarr": "2.15.4"
      }
    },
    "node_modules/boolean": {
      "version": "3.2.0",
      "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
      "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
      "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
      "license": "MIT"
    },
    "node_modules/define-data-property": {
      "version": "1.1.4",
      "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
      "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
      "license": "MIT",
      "dependencies": {
        "es-define-property": "^1.0.0",
        "es-errors": "^1.3.0",
        "gopd": "^1.0.1"
      },
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/define-properties": {
      "version": "1.2.1",
      "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
      "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
      "license": "MIT",
      "dependencies": {
        "define-data-property": "^1.0.1",
        "has-property-descriptors": "^1.0.0",
        "object-keys": "^1.1.1"
      },
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/detect-node": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
      "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
      "license": "MIT"
    },
    "node_modules/es-define-property": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
      "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/es-errors": {
      "version": "1.3.0",
      "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
      "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/globalthis": {
      "version": "1.0.4",
      "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
      "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",
      "license": "MIT",
      "dependencies": {
        "define-properties": "^1.2.1",
        "gopd": "^1.0.1"
      },
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/gopd": {
      "version": "1.2.0",
      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
      "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/has-property-descriptors": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
      "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
      "license": "MIT",
      "dependencies": {
        "es-define-property": "^1.0.0"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/json-stringify-safe": {
      "version": "5.0.1",
      "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
      "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
      "license": "ISC"
    },
    "node_modules/object-keys": {
      "version": "1.1.1",
      "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
      "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/roarr": {
      "version": "2.15.4",
      "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
      "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
      "license": "BSD-3-Clause",
      "dependencies": {
        "boolean": "^3.0.1",
        "detect-node": "^2.0.4",
        "globalthis": "^1.0.1",
        "json-stringify-safe": "^5.0.1",
        "semver-compare": "^1.0.0",
        "sprintf-js": "^1.1.2"
      },
      "engines": {
        "node": ">=8.0"
      }
    },
    "node_modules/semver-compare": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
      "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",
      "license": "MIT"
    },
    "node_modules/sprintf-js": {
      "version": "1.1.3",
      "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
      "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
      "license": "BSD-3-Clause"
    }
  }
}
package.json
{
  "name": "sample-roarr",
  "version": "1.0.0",
  "description": "Minimal clean-room sample verifying roarr.ROARR in roarr",
  "main": "index.js",
  "license": "MIT-0",
  "dependencies": {
    "roarr": "2.15.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify roarr.ROARR in pkg:npm/roarr@2.15.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/roarr@2.15.4"
  ],
  "symbols": [
    "roarr.ROARR"
  ]
}
test/contract.mjs
import assert from 'node:assert';

process.env.ROARR_LOG = 'true';

import roarrLib from '../index.js';
const {
  ROARR,
  Roarr,
  getRoarrGlobal,
  getSequence,
  setSequence,
  getVersions,
  setWriter,
  createLogCollector,
} = roarrLib;

// 1. assert ROARR is an object exposed on globalThis and exported by the roarr package
assert(ROARR && typeof ROARR === 'object', 'ROARR must be an object');
assert.strictEqual(globalThis.ROARR, ROARR, 'ROARR must equal globalThis.ROARR');
assert.strictEqual(getRoarrGlobal(), ROARR, 'getRoarrGlobal must return ROARR');

// 2. assert ROARR.versions is an array containing the package version 2.15.4
assert(Array.isArray(ROARR.versions), 'ROARR.versions must be an array');
assert(ROARR.versions.includes('2.15.4'), 'ROARR.versions must contain 2.15.4');
assert.strictEqual(getVersions(), ROARR.versions, 'getVersions must return ROARR.versions');

// 3. assert ROARR.sequence is a number tracking log sequence count
assert.strictEqual(typeof ROARR.sequence, 'number', 'ROARR.sequence must be a number');
assert.strictEqual(getSequence(), ROARR.sequence, 'getSequence must return ROARR.sequence');

// 4. assert ROARR.write is a function that can be overridden to intercept serialized log records
assert.strictEqual(typeof ROARR.write, 'function', 'ROARR.write must be a function');
const originalWriter = ROARR.write;
const dummyWriter = () => {};
setWriter(dummyWriter);
assert.strictEqual(ROARR.write, dummyWriter, 'setWriter must update ROARR.write');
setWriter(originalWriter);
assert.strictEqual(ROARR.write, originalWriter, 'setWriter must restore original ROARR.write');

// 5. assert custom ROARR.write receives serialized JSON log entry with expected structure and sequence
const initialSeq = getSequence();
const collector = createLogCollector();
try {
  Roarr('test message %s', 'first');
  const logs = collector.getLogs();
  assert.strictEqual(logs.length, 1, 'collector should have captured exactly 1 log');
  const entry = logs[0];
  assert.strictEqual(entry.message, 'test message first', 'entry.message must match formatted message');
  assert.strictEqual(entry.sequence, initialSeq, 'entry.sequence must match initial sequence');
  assert.strictEqual(entry.version, '1.0.0', 'entry.version must be 1.0.0');
  assert.strictEqual(typeof entry.time, 'number', 'entry.time must be numeric timestamp');
  assert.deepStrictEqual(entry.context, {}, 'entry.context must be empty object by default');

  // 6. assert ROARR.sequence increments monotonically with each logger call
  assert.strictEqual(getSequence(), initialSeq + 1, 'sequence must increment after first log');

  Roarr({ tag: 'contract-test' }, 'second message');
  assert.strictEqual(getSequence(), initialSeq + 2, 'sequence must increment after second log');
  assert.strictEqual(logs.length, 2, 'collector should have captured 2 logs');
  assert.strictEqual(logs[1].message, 'second message', 'second message must match');
  assert.strictEqual(logs[1].context.tag, 'contract-test', 'second context must contain tag');
  assert.strictEqual(logs[1].sequence, initialSeq + 1, 'second entry sequence must be initialSeq + 1');
} finally {
  collector.restore();
}

console.log('All ROARR contract assertions passed.');

오리진 시더

익명