CodeSampleX

Sample

golang.org/x/sys v0.0.0-20220406155245-289d7a0edf71

Verified sample for golang golang.org/x/sys v0.0.0-20220406155245-289d7a0edf71. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.

sha256:859ce8c7da3ed81ab7ca9b66cc296028f80437be3a6a62f7f0e07e040800ccd4

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 linux 24 · ubuntu · glibc 2.39 x64 go

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f…
2026-08-27

Case

HOW
Goal
verify pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71
Packages
Created
2026-08-27T13:05:23Z

Contract

  1. unix.Getrlimit retrieves resource limits where Cur does not exceed Max
  2. unix.Getuid and unix.Getgid return non-negative user and group identifiers
  3. unix.Pipe creates connected pipe descriptors that transfer byte payload
  4. unix.ClockGettime with CLOCK_MONOTONIC retrieves non-zero Timespec

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Download the source artifact (tar.gz)

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 pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - 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.
csx.json
{"case":{"caseId":"case:sha256:45d7476876e59e7bc0e4fbceb11fea625f3ced58b0587f099e45fa8dcfa88066","contract":["unix.Getrlimit retrieves resource limits where Cur does not exceed Max","unix.Getuid and unix.Getgid return non-negative user and group identifiers","unix.Pipe creates connected pipe descriptors that transfer byte payload","unix.ClockGettime with CLOCK_MONOTONIC retrieves non-zero Timespec"],"goal":"verify pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71","kind":"HOW","packages":["pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71","verifierAdapter":"golang@1"}
go.mod
module sample

go 1.26.6

require golang.org/x/sys v0.0.0-20220406155245-289d7a0edf71
go.sum
golang.org/x/sys v0.0.0-20220406155245-289d7a0edf71 h1:PRD0hj6tTuUnCFD08vkvjkYFbQg/9lV8KIxe1y4/cvU=
golang.org/x/sys v0.0.0-20220406155245-289d7a0edf71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
main.go
package main

import (
	"bytes"
	"fmt"
	"os"

	"golang.org/x/sys/unix"
)

func main() {
	var rlim unix.Rlimit
	if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil {
		fmt.Fprintf(os.Stderr, "failed to get rlimit: %v\n", err)
		os.Exit(1)
	}

	uid := unix.Getuid()
	gid := unix.Getgid()

	var p [2]int
	if err := unix.Pipe(p[:]); err != nil {
		fmt.Fprintf(os.Stderr, "failed to create pipe: %v\n", err)
		os.Exit(1)
	}
	defer unix.Close(p[0])
	defer unix.Close(p[1])

	msg := []byte("hello unix")
	if _, err := unix.Write(p[1], msg); err != nil {
		fmt.Fprintf(os.Stderr, "failed to write to pipe: %v\n", err)
		os.Exit(1)
	}

	buf := make([]byte, len(msg))
	if _, err := unix.Read(p[0], buf); err != nil {
		fmt.Fprintf(os.Stderr, "failed to read from pipe: %v\n", err)
		os.Exit(1)
	}

	var ts unix.Timespec
	if err := unix.ClockGettime(unix.CLOCK_MONOTONIC, &ts); err != nil {
		fmt.Fprintf(os.Stderr, "failed to get monotonic clock: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("RLIMIT_NOFILE: Cur=%d, Max=%d\n", rlim.Cur, rlim.Max)
	fmt.Printf("UID: %d, GID: %d\n", uid, gid)
	fmt.Printf("Pipe read: %s (equal=%t)\n", string(buf), bytes.Equal(buf, msg))
	fmt.Printf("Monotonic time: %d.%09d\n", ts.Sec, ts.Nsec)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/sys@v0.0.0-20220406155245-289d7a0edf71"
  ]
}
test/contract.go
package main

import (
	"bytes"
	"fmt"
	"os"

	"golang.org/x/sys/unix"
)

func main() {
	if err := runContract(); err != nil {
		fmt.Fprintf(os.Stderr, "Contract verification failed: %v\n", err)
		os.Exit(1)
	}
	fmt.Println("All golang.org/x/sys/unix contract assertions passed.")
}

func runContract() error {
	// Assertion 1: unix.Getrlimit retrieves resource limits where Cur does not exceed Max
	var rlim unix.Rlimit
	if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil {
		return fmt.Errorf("unix.Getrlimit failed: %w", err)
	}
	if rlim.Cur > rlim.Max {
		return fmt.Errorf("expected rlim.Cur <= rlim.Max, got Cur=%d Max=%d", rlim.Cur, rlim.Max)
	}

	// Assertion 2: unix.Getuid and unix.Getgid return non-negative user and group identifiers
	uid := unix.Getuid()
	gid := unix.Getgid()
	if uid < 0 || gid < 0 {
		return fmt.Errorf("expected non-negative uid and gid, got uid=%d gid=%d", uid, gid)
	}

	// Assertion 3: unix.Pipe creates connected pipe descriptors that transfer byte payload
	var p [2]int
	if err := unix.Pipe(p[:]); err != nil {
		return fmt.Errorf("unix.Pipe failed: %w", err)
	}
	defer unix.Close(p[0])
	defer unix.Close(p[1])

	testMsg := []byte("csx-pipe-test")
	n, err := unix.Write(p[1], testMsg)
	if err != nil || n != len(testMsg) {
		return fmt.Errorf("unix.Write failed: n=%d, err=%w", n, err)
	}

	buf := make([]byte, len(testMsg))
	nr, err := unix.Read(p[0], buf)
	if err != nil || nr != len(testMsg) {
		return fmt.Errorf("unix.Read failed: nr=%d, err=%w", nr, err)
	}
	if !bytes.Equal(buf, testMsg) {
		return fmt.Errorf("payload mismatch: got %s, want %s", string(buf), string(testMsg))
	}

	// Assertion 4: unix.ClockGettime with CLOCK_MONOTONIC retrieves non-zero Timespec
	var ts unix.Timespec
	if err := unix.ClockGettime(unix.CLOCK_MONOTONIC, &ts); err != nil {
		return fmt.Errorf("unix.ClockGettime failed: %w", err)
	}
	if ts.Sec <= 0 && ts.Nsec <= 0 {
		return fmt.Errorf("expected non-zero Timespec from ClockGettime, got sec=%d nsec=%d", ts.Sec, ts.Nsec)
	}

	return nil
}

Origin Seeder

anonymous