Exemplo
luxon 3.6.1: IANAZone
Amostra verificada para npm luxon 3.6.1: IANAZone. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: IANAZone.create creates valid IANAZone…
sha256:c127b9fe62c451581d6a6c2cc5b5cca89ce7a1d8cd6c148ddedc95c249c82a94
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
Caso
HOW- Objetivo
- verify luxon.IANAZone in pkg:npm/luxon@3.6.1
- Pacotes
- Símbolos
-
- luxon.IANAZone
- Criado
- 2026-08-23T06:17:54Z
Contrato
- IANAZone.create creates valid IANAZone instances for valid IANA time zone identifiers
- IANAZone.isValidZone returns true for valid IANA zone identifiers and false for invalid zone identifiers
- IANAZone.create returns an invalid IANAZone instance with isValid false for invalid zone names without throwing
- IANAZone instances correctly compute UTC offsets and format offsets
- IANAZone instances with matching zone names are considered equal via equals method
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código-fonte
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 luxon.IANAZone in pkg:npm/luxon@3.6.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/luxon@3.6.1
Demonstrate these symbols/APIs:
- luxon.IANAZone
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:7e21cb5ae6d488e04181c13c6b02dc3eb4a7c511b94ead94a3dcb830de0ec20e","contract":["IANAZone.create creates valid IANAZone instances for valid IANA time zone identifiers","IANAZone.isValidZone returns true for valid IANA zone identifiers and false for invalid zone identifiers","IANAZone.create returns an invalid IANAZone instance with isValid false for invalid zone names without throwing","IANAZone instances correctly compute UTC offsets and format offsets","IANAZone instances with matching zone names are considered equal via equals method"],"goal":"verify luxon.IANAZone in pkg:npm/luxon@3.6.1","kind":"HOW","packages":["pkg:npm/luxon@3.6.1"],"schemaVersion":1,"symbols":["luxon.IANAZone"]},"contractCommand":["node","test/contract.js"],"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/luxon@3.6.1"],"schemaVersion":1,"subject":"pkg:npm/luxon@3.6.1","symbols":["luxon.IANAZone"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-luxon-ianazone",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-luxon-ianazone",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"luxon": "3.6.1"
}
},
"node_modules/luxon": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz",
"integrity": "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==",
"license": "MIT",
"engines": {
"node": ">=12"
}
}
}
}
{
"name": "sample-luxon-ianazone",
"version": "1.0.0",
"private": true,
"description": "verify luxon.IANAZone in pkg:npm/luxon@3.6.1",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"luxon": "3.6.1"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify luxon.IANAZone in pkg:npm/luxon@3.6.1",
"kind": "HOW",
"packages": [
"pkg:npm/luxon@3.6.1"
],
"symbols": [
"luxon.IANAZone"
]
}
'use strict';
const { IANAZone } = require('luxon');
function createZone(zoneName) {
return IANAZone.create(zoneName);
}
function isZoneValid(zoneName) {
return IANAZone.isValidZone(zoneName);
}
function getZoneOffset(zoneName, timestampMs) {
const zone = IANAZone.create(zoneName);
if (!zone.isValid) {
return null;
}
return zone.offset(timestampMs);
}
module.exports = {
IANAZone,
createZone,
isZoneValid,
getZoneOffset
};
'use strict';
const assert = require('node:assert');
const { IANAZone } = require('luxon');
const { createZone, isZoneValid, getZoneOffset } = require('../src/index.js');
async function run() {
// 1. IANAZone.create creates valid IANAZone instances for valid IANA time zone identifiers
const ny = IANAZone.create('America/New_York');
assert.strictEqual(ny.isValid, true, 'ny zone must be valid');
assert.strictEqual(ny.name, 'America/New_York', 'ny zone name must match');
assert.strictEqual(ny.type, 'iana', 'ny zone type must be iana');
assert.strictEqual(ny.isUniversal, false, 'ny zone isUniversal must be false');
const tokyo = IANAZone.create('Asia/Tokyo');
assert.strictEqual(tokyo.isValid, true, 'tokyo zone must be valid');
assert.strictEqual(tokyo.name, 'Asia/Tokyo', 'tokyo zone name must match');
assert.strictEqual(tokyo.type, 'iana', 'tokyo zone type must be iana');
assert.strictEqual(tokyo.isUniversal, false, 'tokyo zone isUniversal must be false');
// 2. IANAZone.isValidZone returns true for valid IANA zone identifiers and false for invalid zone identifiers
assert.strictEqual(IANAZone.isValidZone('America/New_York'), true, 'America/New_York must be valid');
assert.strictEqual(IANAZone.isValidZone('Asia/Tokyo'), true, 'Asia/Tokyo must be valid');
assert.strictEqual(IANAZone.isValidZone('UTC'), true, 'UTC must be valid');
assert.strictEqual(IANAZone.isValidZone('Europe/Paris'), true, 'Europe/Paris must be valid');
assert.strictEqual(IANAZone.isValidZone('Invalid/NonExistent_Zone'), false, 'Invalid zone name must return false');
assert.strictEqual(IANAZone.isValidZone(''), false, 'Empty string must return false');
assert.strictEqual(IANAZone.isValidSpecifier('America/New_York'), true, 'America/New_York must be valid specifier');
assert.strictEqual(IANAZone.isValidSpecifier(123), false, 'Number must not be valid specifier');
// 3. IANAZone.create returns an invalid IANAZone instance with isValid false for invalid zone names without throwing
const invalid = IANAZone.create('Invalid/NonExistent_Zone');
assert.strictEqual(invalid.isValid, false, 'invalid zone isValid must be false');
assert.strictEqual(invalid.name, 'Invalid/NonExistent_Zone', 'invalid zone name must match input');
assert.strictEqual(invalid.type, 'iana', 'invalid zone type must still be iana');
assert.strictEqual(Number.isNaN(invalid.offset(0)), true, 'invalid zone offset should be NaN');
// 4. IANAZone instances correctly compute UTC offsets and format offsets
const utc = IANAZone.create('UTC');
assert.strictEqual(utc.isValid, true, 'UTC zone must be valid');
assert.strictEqual(utc.offset(0), 0, 'UTC offset at timestamp 0 must be 0');
assert.strictEqual(utc.formatOffset(0, 'narrow'), '+0', 'UTC formatOffset narrow must be +0');
// Asia/Tokyo has fixed UTC+9 offset (540 minutes)
assert.strictEqual(tokyo.offset(0), 540, 'Tokyo offset at timestamp 0 must be 540 minutes');
assert.strictEqual(tokyo.formatOffset(0, 'short'), '+09:00', 'Tokyo formatOffset short must be +09:00');
assert.strictEqual(tokyo.formatOffset(0, 'narrow'), '+9', 'Tokyo formatOffset narrow must be +9');
// 5. IANAZone instances with matching zone names are considered equal via equals method
const ny2 = IANAZone.create('America/New_York');
assert.strictEqual(ny.equals(ny2), true, 'Same IANAZone instances must be equal');
assert.strictEqual(ny.equals(tokyo), false, 'Different IANAZone instances must not be equal');
assert.strictEqual(ny.equals(invalid), false, 'Valid and invalid zones must not be equal');
// 6. Helper functions in src/index.js
const helperZone = createZone('Asia/Tokyo');
assert.strictEqual(helperZone.isValid, true, 'helper createZone should return valid zone');
assert.strictEqual(isZoneValid('Asia/Tokyo'), true, 'helper isZoneValid should return true for valid zone');
assert.strictEqual(isZoneValid('Invalid/Zone'), false, 'helper isZoneValid should return false for invalid zone');
assert.strictEqual(getZoneOffset('Asia/Tokyo', 0), 540, 'helper getZoneOffset should return 540 for Tokyo');
assert.strictEqual(getZoneOffset('Invalid/Zone', 0), null, 'helper getZoneOffset should return null for invalid zone');
console.log('Contract tests passed successfully.');
}
run().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder de origem
anônimo