Sample
github.com/jackc/chunkreader/v2 v2.0.1: chunkreader.New
Verified sample for golang github.com/jackc/chunkreader/v2 v2.0.1: chunkreader.New. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.
sha256:c315c4a7f2f2122d9afc5a047f4963e48761efe72db8ebd7c07271868df21156
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 chunkreader.New in pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1
- Symbols
-
- chunkreader.New
- Environment
- go 1.26.6
- Created
- 2026-08-26T05:10:15Z
Contract
- chunkreader.New initializes a ChunkReader wrapping an io.Reader
- ChunkReader.Next returns consecutive byte slices of requested lengths from stream
- ChunkReader.Next returns io.ErrUnexpectedEOF or io.EOF when stream has fewer bytes than requested
- ChunkReader.Next dynamically expands internal buffer when requested chunk exceeds default buffer
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 chunkreader.New in pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1
Demonstrate these symbols/APIs:
- chunkreader.New
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:8352ef6353c33fe30f28b37884a81c95a6066d3b1fff13cbdd09b3203b74105b","contract":["chunkreader.New initializes a ChunkReader wrapping an io.Reader","ChunkReader.Next returns consecutive byte slices of requested lengths from stream","ChunkReader.Next returns io.ErrUnexpectedEOF or io.EOF when stream has fewer bytes than requested","ChunkReader.Next dynamically expands internal buffer when requested chunk exceeds default buffer"],"goal":"verify chunkreader.New in pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1","kind":"HOW","packages":["pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1"],"schemaVersion":1,"symbols":["chunkreader.New"]},"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/chunkreader/v2@v2.0.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1","symbols":["chunkreader.New"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.22
require github.com/jackc/chunkreader/v2 v2.0.1
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
package main
import (
"bytes"
"fmt"
"github.com/jackc/chunkreader/v2"
)
func main() {
data := []byte("Hello, ChunkReader!")
cr := chunkreader.New(bytes.NewReader(data))
chunk, err := cr.Next(5)
if err != nil {
panic(err)
}
fmt.Printf("Read chunk: %s\n", string(chunk))
}
{
"schemaVersion": 1,
"goal": "verify chunkreader.New in pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/jackc/chunkreader/v2@v2.0.1"
],
"symbols": [
"chunkreader.New"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
package test
import (
"bytes"
"errors"
"io"
"testing"
"github.com/jackc/chunkreader/v2"
)
func TestChunkReaderNew(t *testing.T) {
// 1. chunkreader.New initializes a ChunkReader wrapping an io.Reader
payload := []byte("first chunk; second chunk; third chunk")
r := bytes.NewReader(payload)
cr := chunkreader.New(r)
if cr == nil {
t.Fatalf("expected non-nil ChunkReader")
}
// 2. ChunkReader.Next returns consecutive byte slices of requested lengths from stream
c1, err := cr.Next(11)
if err != nil {
t.Fatalf("unexpected error reading chunk 1: %v", err)
}
if !bytes.Equal(c1, []byte("first chunk")) {
t.Fatalf("expected 'first chunk', got %q", string(c1))
}
c2, err := cr.Next(2)
if err != nil {
t.Fatalf("unexpected error reading separator: %v", err)
}
if !bytes.Equal(c2, []byte("; ")) {
t.Fatalf("expected '; ', got %q", string(c2))
}
c3, err := cr.Next(12)
if err != nil {
t.Fatalf("unexpected error reading chunk 2: %v", err)
}
if !bytes.Equal(c3, []byte("second chunk")) {
t.Fatalf("expected 'second chunk', got %q", string(c3))
}
// 3. ChunkReader.Next returns io.ErrUnexpectedEOF or io.EOF when stream has fewer bytes than requested
shortReader := bytes.NewReader([]byte("short"))
crShort := chunkreader.New(shortReader)
chunk, err := crShort.Next(100)
if err == nil {
t.Fatalf("expected error when requesting 100 bytes from 5-byte reader, got nil error and chunk %v", chunk)
}
if chunk != nil {
t.Fatalf("expected nil chunk on error, got %v", chunk)
}
if !errors.Is(err, io.ErrUnexpectedEOF) && !errors.Is(err, io.EOF) {
t.Fatalf("expected io.ErrUnexpectedEOF or io.EOF, got %v", err)
}
// 4. ChunkReader.Next dynamically expands internal buffer when requested chunk exceeds default buffer
largeData := make([]byte, 16384)
for i := range largeData {
largeData[i] = byte('A' + (i % 26))
}
largeReader := bytes.NewReader(largeData)
crLarge := chunkreader.New(largeReader)
largeChunk, err := crLarge.Next(10000)
if err != nil {
t.Fatalf("failed reading large chunk: %v", err)
}
if !bytes.Equal(largeChunk, largeData[:10000]) {
t.Fatalf("large chunk content mismatch")
}
}
Origin Seeder
anonymous