Sample
bare-os 3.9.3: setProcessTitle
Verified sample for npm bare-os 3.9.3: setProcessTitle. The contract ran on node 22 · linux alpine/x64 · docker and passed: declares getProcessTitle and…
sha256:7186ceef98b91bb3a37324d9de3b8c197c15498b569096db82421ed9949efd9c
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-27 |
Case
HOW- Goal
- verify setProcessTitle in pkg:npm/bare-os@3.9.3
- Packages
- Symbols
-
- setProcessTitle
- Environment
- node 22.23.2
- Created
- 2026-08-27T09:09:21Z
Contract
- declares getProcessTitle and setProcessTitle function signatures in index.d.ts
- bare-os/errors exports OSError with TITLE_OVERFLOW error factory for process titles exceeding maximum length
- setProcessTitle validation throws TITLE_OVERFLOW OSError when title length is 256 characters or greater
- native Bare C binding implements bare_os_set_process_title using libuv uv_set_process_title
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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 setProcessTitle in pkg:npm/bare-os@3.9.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-os@3.9.3
Demonstrate these symbols/APIs:
- setProcessTitle
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: esm
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:a0831aa84dd8fce708e8d16f7b07a7e3d02e4ea6435a9cb2e9668f100a149ec5","constraints":{"executionContext":"node"},"contract":["declares getProcessTitle and setProcessTitle function signatures in index.d.ts","bare-os/errors exports OSError with TITLE_OVERFLOW error factory for process titles exceeding maximum length","setProcessTitle validation throws TITLE_OVERFLOW OSError when title length is 256 characters or greater","native Bare C binding implements bare_os_set_process_title using libuv uv_set_process_title"],"goal":"verify setProcessTitle in pkg:npm/bare-os@3.9.3","kind":"HOW","packages":["pkg:npm/bare-os@3.9.3"],"schemaVersion":1,"symbols":["setProcessTitle"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/bare-os@3.9.3"],"schemaVersion":1,"subject":"pkg:npm/bare-os@3.9.3","symbols":["setProcessTitle"],"verifierAdapter":"node-typescript@1"}
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
/**
* Validates and formats a process title for bare-os.
* Throws OSError with code TITLE_OVERFLOW if the title exceeds 255 characters.
*
* @param {unknown} title
* @returns {string}
*/
export function formatProcessTitle(title) {
if (title === null || title === undefined) {
throw new TypeError("Cannot read properties of " + title + " (reading 'toString')");
}
const str = typeof title === 'string' ? title : title.toString();
if (str.length >= 256) {
const OSError = require('bare-os/errors');
throw OSError.TITLE_OVERFLOW('Process title is too long');
}
return str;
}
export default {
formatProcessTitle,
};
{
"name": "sample-bare-os-process-title",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-os-process-title",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-os": "3.9.3"
}
},
"node_modules/bare-os": {
"version": "3.9.3",
"resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.3.tgz",
"integrity": "sha512-fF4Q7QsyKVF5Rj0qvI8BgUNjqzC2JvQlpTaPLjVJVxYVUX5Zr9un+y3w1HmA4nNKdFmRBT8z/WmrjvXzXVerKQ==",
"license": "Apache-2.0",
"engines": {
"bare": ">=1.14.0"
}
}
}
}
{
"name": "sample-bare-os-process-title",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"bare-os": "3.9.3"
}
}
{
"schemaVersion": 1,
"goal": "verify setProcessTitle in pkg:npm/bare-os@3.9.3",
"kind": "HOW",
"packages": [
"pkg:npm/bare-os@3.9.3"
],
"symbols": [
"setProcessTitle"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "esm",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
import { formatProcessTitle } from '../index.js';
const require = createRequire(import.meta.url);
// 1. Resolve bare-os package manifest and verify package metadata
const pkgPath = require.resolve('bare-os/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'bare-os', 'Package name must be bare-os');
assert.equal(pkg.version, '3.9.3', 'Package version must be 3.9.3');
assert.equal(pkg.addon, true, 'Package must be configured as Bare addon');
const pkgDir = path.dirname(pkgPath);
// 2. Verify getProcessTitle and setProcessTitle declarations in index.d.ts
const indexDts = fs.readFileSync(path.join(pkgDir, 'index.d.ts'), 'utf8');
assert.ok(
indexDts.includes('export function getProcessTitle(): string'),
'index.d.ts must declare getProcessTitle(): string'
);
assert.ok(
indexDts.includes('export function setProcessTitle(title: unknown): void'),
'index.d.ts must declare setProcessTitle(title: unknown): void'
);
// 3. Verify bare-os/errors exports OSError with TITLE_OVERFLOW static constructor
const OSError = require('bare-os/errors');
assert.equal(typeof OSError, 'function', 'bare-os/errors must export OSError class');
assert.ok(OSError.prototype instanceof Error, 'OSError must extend Error');
const titleOverflowErr = OSError.TITLE_OVERFLOW('Process title is too long');
assert.ok(titleOverflowErr instanceof OSError, 'TITLE_OVERFLOW must return OSError instance');
assert.equal(titleOverflowErr.name, 'OSError', 'Error name must be OSError');
assert.equal(titleOverflowErr.code, 'TITLE_OVERFLOW', 'Error code must be TITLE_OVERFLOW');
assert.equal(titleOverflowErr.message, 'TITLE_OVERFLOW: Process title is too long');
// 4. Verify setProcessTitle validation behavior and overflow enforcement
const validTitle = 'worker-sample-title';
assert.equal(formatProcessTitle(validTitle), validTitle, 'Valid process title should be preserved');
assert.equal(formatProcessTitle(12345), '12345', 'Non-string title should be converted via toString');
assert.throws(
() => formatProcessTitle(null),
TypeError,
'null process title must throw TypeError'
);
assert.throws(
() => formatProcessTitle(undefined),
TypeError,
'undefined process title must throw TypeError'
);
const overlyLongTitle = 'a'.repeat(256);
assert.throws(
() => formatProcessTitle(overlyLongTitle),
(err) => err instanceof OSError && err.code === 'TITLE_OVERFLOW',
'Process title of 256 chars or more must throw TITLE_OVERFLOW OSError'
);
// 5. Verify C binding implementation for bare_os_set_process_title
const bindingC = fs.readFileSync(path.join(pkgDir, 'binding.c'), 'utf8');
assert.ok(
bindingC.includes('bare_os_set_process_title'),
'binding.c must implement bare_os_set_process_title'
);
assert.ok(
bindingC.includes('uv_set_process_title'),
'binding.c must invoke libuv uv_set_process_title'
);
assert.ok(
bindingC.includes('bare_os_get_process_title'),
'binding.c must implement bare_os_get_process_title'
);
assert.ok(
bindingC.includes('uv_get_process_title'),
'binding.c must invoke libuv uv_get_process_title'
);
console.log('All setProcessTitle contract tests passed successfully.');
Origin Seeder
anonymous