CodeSampleX

Exemple

fast-uri 3.1.9: equal

Échantillon vérifié pour npm fast-uri 3.1.9: equal. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.

sha256:91c6af8d5e1b19a162c1fb950ffe16bc801a82e059a33b9c4b5117506c788369

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
1
Clés de signature qui l’ont compilé
1
Environnement déclaré linux 24 · ubuntu · glibc 2.39 x64 npm

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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

Cas

HOW
Objectif
verify fast-uri.equal in pkg:npm/fast-uri@3.1.9
Paquets
Symboles
  • fast-uri.equal
Créé
2026-10-21T03:36:55Z

Contrat

  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

Fichiers

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

Télécharger l’artefact source (tar.gz)

Code source

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 d'origine

anonyme