Sample
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914: html.DoctypeNode
Verified sample for golang golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914: html.DoctypeNode. The contract ran on go 1.26 · linux debian/x64 · docker and…
sha256:8ffd9413d9c89d398621c94653c3c67b7681e61209dfafbb8c63252d062d20e0
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-27 |
Case
HOW- Goal
- verify golang.org/x/net/html.DoctypeNode in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
- Symbols
-
- golang.org/x/net/html.DoctypeNode
- Created
- 2026-10-27T21:51:20Z
Contract
- html.DoctypeNode is a distinct html.NodeType constant
- html.Parse parses <!DOCTYPE html> into a child node with Type == html.DoctypeNode and Data == "html"
- html.Parse extracts the system identifier into Attr on an html.DoctypeNode
- html.Render serializes an html.DoctypeNode into valid <!DOCTYPE ...> markup
Files
- PROMPT.md
- csx.json
- doctype.go
- go.mod
- go.sum
- spec.json
- test/contract.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 golang.org/x/net/html.DoctypeNode in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
Demonstrate these symbols/APIs:
- golang.org/x/net/html.DoctypeNode
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:e8da1a01402022d63ea816b7d6d869d64659661487f55cfc2f71738a515ceda1","contract":["html.DoctypeNode is a distinct html.NodeType constant","html.Parse parses \u003c!DOCTYPE html\u003e into a child node with Type == html.DoctypeNode and Data == \"html\"","html.Parse extracts the system identifier into Attr on an html.DoctypeNode","html.Render serializes an html.DoctypeNode into valid \u003c!DOCTYPE ...\u003e markup"],"goal":"verify golang.org/x/net/html.DoctypeNode in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914"],"schemaVersion":1,"symbols":["golang.org/x/net/html.DoctypeNode"]},"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.0.0-20191119073136-fc4aabc6c914"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914","symbols":["golang.org/x/net/html.DoctypeNode"],"verifierAdapter":"golang@1"}
package sample
import (
"bytes"
"golang.org/x/net/html"
)
// ExtractDoctype scans direct children of the root node and returns the first html.DoctypeNode.
func ExtractDoctype(root *html.Node) *html.Node {
if root == nil {
return nil
}
for n := root.FirstChild; n != nil; n = n.NextSibling {
if n.Type == html.DoctypeNode {
return n
}
}
return nil
}
// IsDoctypeNode checks whether the provided node is non-nil and has Type html.DoctypeNode.
func IsDoctypeNode(n *html.Node) bool {
return n != nil && n.Type == html.DoctypeNode
}
// CreateDoctypeNode constructs an html.Node with Type html.DoctypeNode and optional public/system identifiers.
func CreateDoctypeNode(name, publicID, systemID string) *html.Node {
node := &html.Node{
Type: html.DoctypeNode,
Data: name,
}
if publicID != "" {
node.Attr = append(node.Attr, html.Attribute{Key: "public", Val: publicID})
}
if systemID != "" {
node.Attr = append(node.Attr, html.Attribute{Key: "system", Val: systemID})
}
return node
}
// FormatDoctype renders an html.Node into its serialized HTML string.
func FormatDoctype(n *html.Node) (string, error) {
var buf bytes.Buffer
if err := html.Render(&buf, n); err != nil {
return "", err
}
return buf.String(), nil
}
module sample
go 1.26
require golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 h1:MlY3mEfbnWGmUi4rtHOtNnnnN4UJRGSyLPx+DXA5Sq4=
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
{
"schemaVersion": 1,
"goal": "verify golang.org/x/net/html.DoctypeNode in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914"
],
"symbols": [
"golang.org/x/net/html.DoctypeNode"
]
}
package main
import (
"fmt"
"os"
"strings"
"golang.org/x/net/html"
"sample"
)
func main() {
// 1. Verify html.DoctypeNode is a valid html.NodeType constant and distinct from other node types.
var dtType html.NodeType = html.DoctypeNode
if dtType == html.ErrorNode ||
dtType == html.TextNode ||
dtType == html.DocumentNode ||
dtType == html.ElementNode ||
dtType == html.CommentNode {
fmt.Fprintf(os.Stderr, "expected html.DoctypeNode to be distinct from other NodeType constants\n")
os.Exit(1)
}
// 2. Verify html.Parse produces an html.DoctypeNode for standard HTML5 DOCTYPE.
doc, err := html.Parse(strings.NewReader("<!DOCTYPE html><html><head><title>T</title></head><body></body></html>"))
if err != nil {
fmt.Fprintf(os.Stderr, "unexpected parse error: %v\n", err)
os.Exit(1)
}
dt := sample.ExtractDoctype(doc)
if dt == nil {
fmt.Fprintf(os.Stderr, "expected a DoctypeNode child in parsed document\n")
os.Exit(1)
}
if dt.Type != html.DoctypeNode || !sample.IsDoctypeNode(dt) {
fmt.Fprintf(os.Stderr, "expected node Type to be html.DoctypeNode, got %v\n", dt.Type)
os.Exit(1)
}
if dt.Data != "html" {
fmt.Fprintf(os.Stderr, "expected DoctypeNode Data to be 'html', got %q\n", dt.Data)
os.Exit(1)
}
// 3. Verify html.Parse populates public and system attributes on html.DoctypeNode.
docSys, err := html.Parse(strings.NewReader(`<!DOCTYPE html SYSTEM "about:legacy-compat"><html><body></body></html>`))
if err != nil {
fmt.Fprintf(os.Stderr, "unexpected parse error for system doctype: %v\n", err)
os.Exit(1)
}
dtSys := sample.ExtractDoctype(docSys)
if dtSys == nil || dtSys.Type != html.DoctypeNode {
fmt.Fprintf(os.Stderr, "expected DoctypeNode for system doctype\n")
os.Exit(1)
}
hasSystemAttr := false
for _, a := range dtSys.Attr {
if a.Key == "system" && a.Val == "about:legacy-compat" {
hasSystemAttr = true
}
}
if !hasSystemAttr {
fmt.Fprintf(os.Stderr, "expected system attribute 'about:legacy-compat' on DoctypeNode\n")
os.Exit(1)
}
// 4. Verify html.Render serializes a manually constructed html.DoctypeNode accurately.
node := sample.CreateDoctypeNode("html", "", "")
rendered, err := sample.FormatDoctype(node)
if err != nil {
fmt.Fprintf(os.Stderr, "unexpected render error: %v\n", err)
os.Exit(1)
}
if rendered != "<!DOCTYPE html>" {
fmt.Fprintf(os.Stderr, "expected '<!DOCTYPE html>', got %q\n", rendered)
os.Exit(1)
}
nodeSys := sample.CreateDoctypeNode("html", "", "about:legacy-compat")
renderedSys, err := sample.FormatDoctype(nodeSys)
if err != nil {
fmt.Fprintf(os.Stderr, "unexpected render error with system ID: %v\n", err)
os.Exit(1)
}
if renderedSys != `<!DOCTYPE html SYSTEM "about:legacy-compat">` {
fmt.Fprintf(os.Stderr, "expected system doctype output, got %q\n", renderedSys)
os.Exit(1)
}
fmt.Println("contract ok")
}
Origin Seeder
anonymous