샘플
fs.realpath 1.0.0: unmonkeypatch
검증된 샘플 — npm fs.realpath 1.0.0: unmonkeypatch. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: assert unmonkeypatch is an exported function on…
sha256:13fc88f136434da4bd87bdf97a849876f2176c7f0175dd0e1040fd47ce3c7403
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-05 |
케이스
HOW- 목표
- verify fs.realpath.unmonkeypatch in pkg:npm/fs.realpath@1.0.0
- 심벌
-
- fs.realpath.unmonkeypatch
- 환경
- node 22.23.2
- 생성일
- 2026-09-05T17:46:53Z
컨트랙트
- assert unmonkeypatch is an exported function on fs.realpath
- assert unmonkeypatch restores fs.realpath to native implementation after monkeypatch
- assert unmonkeypatch restores fs.realpathSync to native implementation after monkeypatch
- assert isMonkeypatched returns false after unmonkeypatching
- assert unmonkeypatch is idempotent when invoked repeatedly
- assert native fs.realpath resolves existing path after unmonkeypatch
- assert native fs.realpathSync resolves existing path after unmonkeypatch
- assert native fs.realpathSync throws ENOENT for nonexistent path after unmonkeypatch
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
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 fs.realpath.unmonkeypatch in pkg:npm/fs.realpath@1.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/fs.realpath@1.0.0
Demonstrate these symbols/APIs:
- fs.realpath.unmonkeypatch
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:8f90a5556fbaa56e5f58e378bee6a7d3ece548e68bdebb24d6f89736aa699816","contract":["assert unmonkeypatch is an exported function on fs.realpath","assert unmonkeypatch restores fs.realpath to native implementation after monkeypatch","assert unmonkeypatch restores fs.realpathSync to native implementation after monkeypatch","assert isMonkeypatched returns false after unmonkeypatching","assert unmonkeypatch is idempotent when invoked repeatedly","assert native fs.realpath resolves existing path after unmonkeypatch","assert native fs.realpathSync resolves existing path after unmonkeypatch","assert native fs.realpathSync throws ENOENT for nonexistent path after unmonkeypatch"],"goal":"verify fs.realpath.unmonkeypatch in pkg:npm/fs.realpath@1.0.0","kind":"HOW","packages":["pkg:npm/fs.realpath@1.0.0"],"schemaVersion":1,"symbols":["fs.realpath.unmonkeypatch"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/fs.realpath@1.0.0"],"schemaVersion":1,"subject":"pkg:npm/fs.realpath@1.0.0","symbols":["fs.realpath.unmonkeypatch"],"verifierAdapter":"node-typescript@1"}
const fs = require('fs');
const rp = require('fs.realpath');
/**
* Applies monkeypatch from fs.realpath to native fs methods.
*/
function applyMonkeypatch() {
rp.monkeypatch();
}
/**
* Restores native fs.realpath and fs.realpathSync using unmonkeypatch.
*/
function restoreNativeFs() {
rp.unmonkeypatch();
}
/**
* Checks whether fs methods are currently patched with fs.realpath polyfill.
*
* @returns {boolean} true if fs.realpath and fs.realpathSync point to polyfill methods.
*/
function isMonkeypatched() {
return fs.realpath === rp && fs.realpathSync === rp.sync;
}
/**
* Resolves real path synchronously using current fs.realpathSync.
*
* @param {string} targetPath - Path to resolve.
* @returns {string} Resolved real path.
*/
function resolveRealPathSync(targetPath) {
return fs.realpathSync(targetPath);
}
/**
* Resolves real path asynchronously using current fs.realpath.
*
* @param {string} targetPath - Path to resolve.
* @returns {Promise<string>} Promise resolving to real path.
*/
function resolveRealPathAsync(targetPath) {
return new Promise((resolve, reject) => {
fs.realpath(targetPath, (err, resolved) => {
if (err) {
reject(err);
} else {
resolve(resolved);
}
});
});
}
module.exports = {
applyMonkeypatch,
restoreNativeFs,
isMonkeypatched,
resolveRealPathSync,
resolveRealPathAsync,
rp,
};
{
"name": "sample-fs-realpath-unmonkeypatch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-fs-realpath-unmonkeypatch",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"fs.realpath": "1.0.0"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC"
}
}
}
{
"name": "sample-fs-realpath-unmonkeypatch",
"version": "1.0.0",
"description": "Clean-room sample verifying fs.realpath.unmonkeypatch in pkg:npm/fs.realpath@1.0.0",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"fs.realpath": "1.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify fs.realpath.unmonkeypatch in pkg:npm/fs.realpath@1.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/fs.realpath@1.0.0"
],
"symbols": [
"fs.realpath.unmonkeypatch"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import rp from 'fs.realpath';
import {
applyMonkeypatch,
restoreNativeFs,
isMonkeypatched,
resolveRealPathSync,
resolveRealPathAsync,
} from '../index.js';
const origRealpath = fs.realpath;
const origRealpathSync = fs.realpathSync;
// 1. Export verification
assert.strictEqual(typeof rp.unmonkeypatch, 'function', 'assert unmonkeypatch is an exported function on fs.realpath');
assert.strictEqual(typeof restoreNativeFs, 'function', 'assert restoreNativeFs is a function');
// 2. Initial state verification
assert.strictEqual(fs.realpath, origRealpath, 'Initial fs.realpath must match native implementation');
assert.strictEqual(fs.realpathSync, origRealpathSync, 'Initial fs.realpathSync must match native implementation');
assert.strictEqual(isMonkeypatched(), false, 'isMonkeypatched must return false initially');
// 3. Monkeypatching
applyMonkeypatch();
assert.strictEqual(fs.realpath, rp, 'fs.realpath must match polyfill after monkeypatch');
assert.strictEqual(fs.realpathSync, rp.sync, 'fs.realpathSync must match polyfill sync after monkeypatch');
assert.strictEqual(isMonkeypatched(), true, 'isMonkeypatched must return true after applying monkeypatch');
// 4. Unmonkeypatch restoration
restoreNativeFs();
assert.strictEqual(fs.realpath, origRealpath, 'assert unmonkeypatch restores fs.realpath to native implementation after monkeypatch');
assert.strictEqual(fs.realpathSync, origRealpathSync, 'assert unmonkeypatch restores fs.realpathSync to native implementation after monkeypatch');
assert.strictEqual(isMonkeypatched(), false, 'assert isMonkeypatched returns false after unmonkeypatching');
// 5. Idempotency test (calling unmonkeypatch again)
rp.unmonkeypatch();
assert.strictEqual(fs.realpath, origRealpath, 'assert unmonkeypatch is idempotent when invoked repeatedly');
assert.strictEqual(fs.realpathSync, origRealpathSync, 'assert unmonkeypatch is idempotent when invoked repeatedly');
assert.strictEqual(isMonkeypatched(), false, 'isMonkeypatched remains false after repeated unmonkeypatch');
// 6. Path resolution after unmonkeypatch
const resolvedSync = resolveRealPathSync('.');
assert.strictEqual(typeof resolvedSync, 'string', 'assert native fs.realpathSync resolves existing path after unmonkeypatch');
assert.ok(resolvedSync.length > 0, 'assert resolved path is non-empty');
assert.strictEqual(resolvedSync, origRealpathSync('.'), 'assert resolved sync path matches origRealpathSync');
const resolvedAsync = await resolveRealPathAsync('.');
assert.strictEqual(resolvedAsync, resolvedSync, 'assert native fs.realpath resolves existing path after unmonkeypatch');
// 7. Error handling for nonexistent path after unmonkeypatch
assert.throws(
() => {
resolveRealPathSync('./nonexistent_path_contract_check_404');
},
/ENOENT/,
'assert native fs.realpathSync throws ENOENT for nonexistent path after unmonkeypatch'
);
console.log('All fs.realpath.unmonkeypatch contract assertions passed.');
오리진 시더
익명