CodeSampleX

Ejemplo

fast-uri 3.1.9: equal

Muestra verificada para npm fast-uri 3.1.9: equal. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó: fastUri.equal determines RFC 3986…

sha256:91c6af8d5e1b19a162c1fb950ffe16bc801a82e059a33b9c4b5117506c788369

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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

Caso

HOW
Objetivo
verify fast-uri.equal in pkg:npm/fast-uri@3.1.9
Paquetes
Símbolos
  • fast-uri.equal
Creado
2026-10-21T03:36:55Z

Contrato

  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

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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');

Seeder de origen

anónimo