Sample
github.com/jackc/pgio v1.0.0: AppendInt32
Verified sample for golang github.com/jackc/pgio v1.0.0: AppendInt32. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.
sha256:82d0955505d3c744d863de52d9573ce17ebb27335146afd3c6db42990f2b2e7c
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
- 2
- Signing keys that built it
- 1
Declared environment
go 1.26 linux 24 · ubuntu · glibc 2.39 amd64 go 1.26 go go 1
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-26 |
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-07 |
Case
HOW- Goal
- verify github.com/jackc/pgio.AppendInt32 in pkg:golang/github.com/jackc/pgio@v1.0.0
- Packages
- Symbols
-
- github.com/jackc/pgio.AppendInt32
- Environment
- go 1.26.6
- Created
- 2026-08-26T01:31:06Z
Contract
- pgio.AppendInt32(buf, n) appends the 4-byte big-endian binary encoding of an int32 to the buffer
- pgio.AppendInt32 preserves existing slice prefix and increases slice length by 4 bytes
- pgio.AppendInt32 correctly encodes positive, negative, zero, MaxInt32, and MinInt32 values
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract_test.go
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 github.com/jackc/pgio.AppendInt32 in pkg:golang/github.com/jackc/pgio@v1.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/jackc/pgio@v1.0.0
Demonstrate these symbols/APIs:
- github.com/jackc/pgio.AppendInt32
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.
{"case":{"caseId":"case:sha256:39b42d9b8b5f385317021d15c4fecee3c32348148bf810a7d0f0c30cb771fecc","contract":["pgio.AppendInt32(buf, n) appends the 4-byte big-endian binary encoding of an int32 to the buffer","pgio.AppendInt32 preserves existing slice prefix and increases slice length by 4 bytes","pgio.AppendInt32 correctly encodes positive, negative, zero, MaxInt32, and MinInt32 values"],"goal":"verify github.com/jackc/pgio.AppendInt32 in pkg:golang/github.com/jackc/pgio@v1.0.0","kind":"HOW","packages":["pkg:golang/github.com/jackc/pgio@v1.0.0"],"schemaVersion":1,"symbols":["github.com/jackc/pgio.AppendInt32"]},"contractCommand":["go","test","./..."],"environment":{"arch":"amd64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","moduleSystem":"go","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/jackc/pgio@v1.0.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/jackc/pgio@v1.0.0","symbols":["github.com/jackc/pgio.AppendInt32"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.22
require github.com/jackc/pgio v1.0.0
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
package main
import (
"bytes"
"encoding/binary"
"fmt"
"github.com/jackc/pgio"
)
func main() {
buf := make([]byte, 0, 16)
buf = pgio.AppendInt32(buf, 42)
buf = pgio.AppendInt32(buf, -100)
var val1, val2 int32
r := bytes.NewReader(buf)
_ = binary.Read(r, binary.BigEndian, &val1)
_ = binary.Read(r, binary.BigEndian, &val2)
fmt.Printf("encoded: %x, decoded: %d, %d\n", buf, val1, val2)
}
{
"schemaVersion": 1,
"goal": "verify github.com/jackc/pgio.AppendInt32 in pkg:golang/github.com/jackc/pgio@v1.0.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/jackc/pgio@v1.0.0"
],
"symbols": [
"github.com/jackc/pgio.AppendInt32"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
package test
import (
"bytes"
"encoding/binary"
"math"
"testing"
"github.com/jackc/pgio"
)
func TestAppendInt32(t *testing.T) {
tests := []struct {
name string
input int32
expected []byte
}{
{
name: "zero",
input: 0,
expected: []byte{0x00, 0x00, 0x00, 0x00},
},
{
name: "positive one",
input: 1,
expected: []byte{0x00, 0x00, 0x00, 0x01},
},
{
name: "negative one",
input: -1,
expected: []byte{0xff, 0xff, 0xff, 0xff},
},
{
name: "arbitrary positive integer",
input: 0x12345678,
expected: []byte{0x12, 0x34, 0x56, 0x78},
},
{
name: "max int32",
input: math.MaxInt32,
expected: []byte{0x7f, 0xff, 0xff, 0xff},
},
{
name: "min int32",
input: math.MinInt32,
expected: []byte{0x80, 0x00, 0x00, 0x00},
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
buf := make([]byte, 0, 4)
result := pgio.AppendInt32(buf, tc.input)
if len(result) != 4 {
t.Fatalf("expected length 4, got %d", len(result))
}
if !bytes.Equal(result, tc.expected) {
t.Fatalf("expected bytes %x, got %x", tc.expected, result)
}
var decoded int32
if err := binary.Read(bytes.NewReader(result), binary.BigEndian, &decoded); err != nil {
t.Fatalf("failed to decode int32: %v", err)
}
if decoded != tc.input {
t.Fatalf("decoded value mismatch: expected %d, got %d", tc.input, decoded)
}
})
}
}
func TestAppendInt32_PreservesPrefix(t *testing.T) {
prefix := []byte{0xAA, 0xBB, 0xCC}
buf := append([]byte(nil), prefix...)
result := pgio.AppendInt32(buf, 12345)
if len(result) != len(prefix)+4 {
t.Fatalf("expected length %d, got %d", len(prefix)+4, len(result))
}
if !bytes.Equal(result[:len(prefix)], prefix) {
t.Fatalf("prefix was modified: expected %x, got %x", prefix, result[:len(prefix)])
}
var decoded int32
if err := binary.Read(bytes.NewReader(result[len(prefix):]), binary.BigEndian, &decoded); err != nil {
t.Fatalf("failed to decode int32: %v", err)
}
if decoded != 12345 {
t.Fatalf("decoded value mismatch: expected 12345, got %d", decoded)
}
}
func TestAppendInt32_MultipleAppends(t *testing.T) {
var buf []byte
values := []int32{10, -20, 300, -4000, math.MaxInt32, math.MinInt32}
for _, v := range values {
buf = pgio.AppendInt32(buf, v)
}
if len(buf) != len(values)*4 {
t.Fatalf("expected total length %d, got %d", len(values)*4, len(buf))
}
r := bytes.NewReader(buf)
for i, expected := range values {
var actual int32
if err := binary.Read(r, binary.BigEndian, &actual); err != nil {
t.Fatalf("failed reading index %d: %v", i, err)
}
if actual != expected {
t.Fatalf("at index %d: expected %d, got %d", i, expected, actual)
}
}
}
Origin Seeder
anonymous