CodeSampleX

Sample

golang.org/x/net v0.61.0: atom.H5

Verified sample for golang golang.org/x/net v0.61.0: atom.H5. The contract ran on go 1.26 · linux debian/x64 · docker and passed.

sha256:e0d6be6a3f29049426d1eb4b867c188f9ed3f71dec2238d8e5a4e46b0fd5b09a

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 debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a…
2026-10-12

Case

HOW
Goal
verify golang.org/x/net/html/atom.H5 in pkg:golang/golang.org/x/net@v0.61.0
Packages
Symbols
  • golang.org/x/net/html/atom.H5
Created
2026-10-12T05:28:02Z

Contract

  1. atom.H5 is a non-zero Atom constant whose String() method returns "h5"
  2. atom.Lookup on byte slice "h5" returns atom.H5
  3. atom.String on byte slice "h5" returns "h5"
  4. atom.H5 is distinct from other heading atoms such as atom.H1, atom.H2, atom.H3, atom.H4, and atom.H6
  5. html.Parse on HTML containing <h5> tag yields an ElementNode with DataAtom equal to atom.H5
  6. explicitly created html.Node with DataAtom atom.H5 and Data "h5" renders as an <h5> element

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 golang.org/x/net/html/atom.H5 in pkg:golang/golang.org/x/net@v0.61.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/net@v0.61.0
Demonstrate these symbols/APIs:
  - golang.org/x/net/html/atom.H5

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:da7b10180063c911dde10786e8cef197c0810040e49ccdd9b2dc55694152d745","contract":["atom.H5 is a non-zero Atom constant whose String() method returns \"h5\"","atom.Lookup on byte slice \"h5\" returns atom.H5","atom.String on byte slice \"h5\" returns \"h5\"","atom.H5 is distinct from other heading atoms such as atom.H1, atom.H2, atom.H3, atom.H4, and atom.H6","html.Parse on HTML containing \u003ch5\u003e tag yields an ElementNode with DataAtom equal to atom.H5","explicitly created html.Node with DataAtom atom.H5 and Data \"h5\" renders as an \u003ch5\u003e element"],"goal":"verify golang.org/x/net/html/atom.H5 in pkg:golang/golang.org/x/net@v0.61.0","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.61.0"],"schemaVersion":1,"symbols":["golang.org/x/net/html/atom.H5"]},"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/net@v0.61.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.61.0","symbols":["golang.org/x/net/html/atom.H5"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.26.0

require golang.org/x/net v0.61.0
go.sum
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
main.go
package main

import (
	"bytes"
	"fmt"
	"strings"

	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
)

func main() {
	fmt.Printf("atom: %s (value: %d)\n", atom.H5, atom.H5)

	lookup := atom.Lookup([]byte("h5"))
	fmt.Printf("atom.Lookup(\"h5\") == atom.H5: %t\n", lookup == atom.H5)

	doc, err := html.Parse(strings.NewReader("<h5>Heading</h5>"))
	if err != nil {
		panic(err)
	}

	var found bool
	var walk func(*html.Node)
	walk = func(n *html.Node) {
		if n.Type == html.ElementNode && n.DataAtom == atom.H5 {
			found = true
			return
		}
		for c := n.FirstChild; c != nil; c = c.NextSibling {
			walk(c)
		}
	}
	walk(doc)
	fmt.Printf("Found atom.H5 in parsed HTML: %t\n", found)

	node := &html.Node{
		Type:     html.ElementNode,
		DataAtom: atom.H5,
		Data:     atom.H5.String(),
	}
	var buf bytes.Buffer
	if err := html.Render(&buf, node); err != nil {
		panic(err)
	}
	fmt.Printf("Rendered element: %s\n", buf.String())
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/net/html/atom.H5 in pkg:golang/golang.org/x/net@v0.61.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/net@v0.61.0"
  ],
  "symbols": [
    "golang.org/x/net/html/atom.H5"
  ]
}
test/contract.go
package main

import (
	"bytes"
	"fmt"
	"os"
	"strings"

	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
)

func main() {
	// 1. atom.H5 is a non-zero Atom constant whose String() method returns "h5"
	if atom.H5 == 0 {
		fmt.Fprintf(os.Stderr, "assertion failed: atom.H5 should not be 0\n")
		os.Exit(1)
	}
	if atom.H5.String() != "h5" {
		fmt.Fprintf(os.Stderr, "assertion failed: atom.H5.String() = %q, want %q\n", atom.H5.String(), "h5")
		os.Exit(1)
	}

	// 2. atom.Lookup on byte slice "h5" returns atom.H5
	if got := atom.Lookup([]byte("h5")); got != atom.H5 {
		fmt.Fprintf(os.Stderr, "assertion failed: atom.Lookup(\"h5\") = %v, want %v\n", got, atom.H5)
		os.Exit(1)
	}

	// 3. atom.String on byte slice "h5" returns "h5"
	if got := atom.String([]byte("h5")); got != "h5" {
		fmt.Fprintf(os.Stderr, "assertion failed: atom.String(\"h5\") = %q, want %q\n", got, "h5")
		os.Exit(1)
	}

	// 4. atom.H5 is distinct from other heading atoms such as atom.H1, atom.H2, atom.H3, atom.H4, and atom.H6
	headings := []struct {
		name string
		a    atom.Atom
	}{
		{"H1", atom.H1},
		{"H2", atom.H2},
		{"H3", atom.H3},
		{"H4", atom.H4},
		{"H6", atom.H6},
	}
	for _, h := range headings {
		if atom.H5 == h.a {
			fmt.Fprintf(os.Stderr, "assertion failed: atom.H5 unexpectedly equals atom.%s\n", h.name)
			os.Exit(1)
		}
	}

	// 5. html.Parse on HTML containing <h5> tag yields an ElementNode with DataAtom equal to atom.H5
	doc, err := html.Parse(strings.NewReader("<!DOCTYPE html><html><body><h5>Heading 5</h5></body></html>"))
	if err != nil {
		fmt.Fprintf(os.Stderr, "assertion failed: html.Parse error: %v\n", err)
		os.Exit(1)
	}
	var h5Found bool
	var walk func(*html.Node)
	walk = func(n *html.Node) {
		if n.Type == html.ElementNode && n.DataAtom == atom.H5 {
			if n.Data != "h5" {
				fmt.Fprintf(os.Stderr, "assertion failed: expected element Data to be \"h5\", got %q\n", n.Data)
				os.Exit(1)
			}
			h5Found = true
			return
		}
		for c := n.FirstChild; c != nil; c = c.NextSibling {
			walk(c)
		}
	}
	walk(doc)
	if !h5Found {
		fmt.Fprintf(os.Stderr, "assertion failed: <h5> tag with DataAtom == atom.H5 not found\n")
		os.Exit(1)
	}

	// 6. explicitly created html.Node with DataAtom atom.H5 and Data "h5" renders as an <h5> element
	node := &html.Node{
		Type:     html.ElementNode,
		DataAtom: atom.H5,
		Data:     atom.H5.String(),
	}
	node.AppendChild(&html.Node{
		Type: html.TextNode,
		Data: "Test Content",
	})
	var buf bytes.Buffer
	if err := html.Render(&buf, node); err != nil {
		fmt.Fprintf(os.Stderr, "assertion failed: html.Render error: %v\n", err)
		os.Exit(1)
	}
	expectedHTML := "<h5>Test Content</h5>"
	if buf.String() != expectedHTML {
		fmt.Fprintf(os.Stderr, "assertion failed: html.Render output = %q, want %q\n", buf.String(), expectedHTML)
		os.Exit(1)
	}

	fmt.Println("All contract assertions passed successfully.")
}

Origin Seeder

anonymous