CodeSampleX

Пример

fast-uri 3.1.9: equal

Проверенный пример — npm fast-uri 3.1.9: equal. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: fastUri.equal determines RFC 3986…

sha256:91c6af8d5e1b19a162c1fb950ffe16bc801a82e059a33b9c4b5117506c788369

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. 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');

Исходный сидер

аноним