CodeSampleX

サンプル

fast-uri 3.1.9: equal

検証済みサンプル — npm fast-uri 3.1.9: equal. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: fastUri.equal determines RFC 3986 equivalence between…

sha256:91c6af8d5e1b19a162c1fb950ffe16bc801a82e059a33b9c4b5117506c788369

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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-10-21

ケース

HOW
ゴール
verify fast-uri.equal in pkg:npm/fast-uri@3.1.9
パッケージ
シンボル
  • fast-uri.equal
作成日
2026-10-21T03:36:55Z

コントラクト

  1. fastUri.equal determines RFC 3986 equivalence between equivalent URI strings
  2. fastUri.equal normalizes scheme and host casing for case-insensitive comparison
  3. fastUri.equal normalizes unreserved percent-encoded characters according to RFC 3986
  4. fastUri.equal treats default scheme ports as equivalent to omitted ports
  5. fastUri.equal normalizes empty path to root slash for hierarchical schemes
  6. fastUri.equal accepts parsed URIComponent objects as arguments
  7. fastUri.equal returns false for malformed authority or invalid port
  8. fastUri.equal returns false when either argument is undefined

ファイル

  • PROMPT.md
  • csx.json
  • 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 fast-uri.equal in pkg:npm/fast-uri@3.1.9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/fast-uri@3.1.9
Demonstrate these symbols/APIs:
  - fast-uri.equal

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:0515bf6d33d529fd15e6cdad0214abefeb82fe5ec8f12c0c4358a7d392cbb028","contract":["fastUri.equal determines RFC 3986 equivalence between equivalent URI strings","fastUri.equal normalizes scheme and host casing for case-insensitive comparison","fastUri.equal normalizes unreserved percent-encoded characters according to RFC 3986","fastUri.equal treats default scheme ports as equivalent to omitted ports","fastUri.equal normalizes empty path to root slash for hierarchical schemes","fastUri.equal accepts parsed URIComponent objects as arguments","fastUri.equal returns false for malformed authority or invalid port","fastUri.equal returns false when either argument is undefined"],"goal":"verify fast-uri.equal in pkg:npm/fast-uri@3.1.9","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.9"],"schemaVersion":1,"symbols":["fast-uri.equal"]},"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/fast-uri@3.1.9"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.9","symbols":["fast-uri.equal"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "fast-uri-equal-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "fast-uri-equal-verification",
      "version": "1.0.0",
      "dependencies": {
        "fast-uri": "3.1.9"
      }
    },
    "node_modules/fast-uri": {
      "version": "3.1.9",
      "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
      "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/fastify"
        },
        {
          "type": "opencollective",
          "url": "https://opencollective.com/fastify"
        }
      ],
      "license": "BSD-3-Clause"
    }
  }
}
package.json
{
  "name": "fast-uri-equal-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of fast-uri.equal",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "fast-uri": "3.1.9"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify fast-uri.equal in pkg:npm/fast-uri@3.1.9",
  "kind": "HOW",
  "packages": [
    "pkg:npm/fast-uri@3.1.9"
  ],
  "symbols": [
    "fast-uri.equal"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import uri from 'fast-uri';

// 1. fastUri.equal determines RFC 3986 equivalence between equivalent URI strings
assert.strictEqual(uri.equal('http://example.com/a/b/../c', 'http://example.com/a/c'), true);
assert.strictEqual(uri.equal('http://example.com:8080/test', 'http://example.com:8080/test'), true);
assert.strictEqual(uri.equal('http://example.com/a', 'http://example.com/b'), false);

// 2. fastUri.equal normalizes scheme and host casing for case-insensitive comparison
assert.strictEqual(uri.equal('HTTP://EXAMPLE.COM/path', 'http://example.com/path'), true);

// 3. fastUri.equal normalizes unreserved percent-encoded characters according to RFC 3986
assert.strictEqual(uri.equal('http://example.com/%7Euser/%7A', 'http://example.com/~user/z'), true);

// 4. fastUri.equal treats default scheme ports as equivalent to omitted ports
assert.strictEqual(uri.equal('http://example.com:80/path', 'http://example.com/path'), true);
assert.strictEqual(uri.equal('https://example.com:443/path', 'https://example.com/path'), true);

// 5. fastUri.equal normalizes empty path to root slash for hierarchical schemes
assert.strictEqual(uri.equal('http://example.com', 'http://example.com/'), true);

// 6. fastUri.equal accepts parsed URIComponent objects as arguments
const parsedA = uri.parse('http://example.com/a/b');
const parsedB = uri.parse('http://EXAMPLE.COM/a/b');
assert.strictEqual(uri.equal(parsedA, parsedB), true);
assert.strictEqual(uri.equal(parsedA, 'http://example.com/a/b'), true);

// 7. fastUri.equal returns false for malformed authority or invalid port
assert.strictEqual(uri.equal('http://example.com:invalid', 'http://example.com:invalid'), false);

// 8. fastUri.equal returns false when either argument is undefined
assert.strictEqual(uri.equal(undefined, 'http://example.com'), false);
assert.strictEqual(uri.equal('http://example.com', undefined), false);
assert.strictEqual(uri.equal(undefined, undefined), false);

console.log('Contract passed');

オリジンシーダー

匿名