CodeSampleX

Sample

google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9: code.Code_UNKNOWN

Verified sample for golang google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9: code.Code_UNKNOWN. The contract ran on go 1.26 …

sha256:4b3dc43a26a00ca21c6cc2abe142ae63d981937580bf5744656b3fde02686525

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 google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9
Packages
Symbols
  • google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN
Created
2026-08-27T11:21:00Z

Contract

  1. code.Code_UNKNOWN evaluates to code.Code enum value 2
  2. code.Code_UNKNOWN String() returns UNKNOWN
  3. code.Code_name maps Code_UNKNOWN value 2 to UNKNOWN
  4. code.Code_value maps UNKNOWN to int32 value 2
  5. code.Code_UNKNOWN descriptor and enum number are consistent

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/main.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 google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9
Demonstrate these symbols/APIs:
  - google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN

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:253f0e47b0d192012015c5aa846a23bacb27fc3f0264263de73901120f50e021","contract":["code.Code_UNKNOWN evaluates to code.Code enum value 2","code.Code_UNKNOWN String() returns UNKNOWN","code.Code_name maps Code_UNKNOWN value 2 to UNKNOWN","code.Code_value maps UNKNOWN to int32 value 2","code.Code_UNKNOWN descriptor and enum number are consistent"],"goal":"verify google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9"],"schemaVersion":1,"symbols":["google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN"]},"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/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9","symbols":["google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.23.0

require google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9

require google.golang.org/protobuf v1.35.1 // indirect
go.sum
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
main.go
package main

import (
	"fmt"

	"google.golang.org/genproto/googleapis/rpc/code"
)

// GetUnknownCode returns the Code_UNKNOWN enum value.
func GetUnknownCode() code.Code {
	return code.Code_UNKNOWN
}

// FormatCodeName returns the string representation of a code.Code.
func FormatCodeName(c code.Code) string {
	return c.String()
}

func main() {
	c := GetUnknownCode()
	fmt.Printf("Code: %s (%d)\n", FormatCodeName(c), int32(c))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9",
  "kind": "HOW",
  "packages": [
    "pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20241007155032-5fefd90f89a9"
  ],
  "symbols": [
    "google.golang.org/genproto/googleapis/rpc/code.Code_UNKNOWN"
  ]
}
test/main.go
package main

import (
	"fmt"
	"os"

	"google.golang.org/genproto/googleapis/rpc/code"
)

func assertTrue(name string, condition bool) {
	if !condition {
		fmt.Fprintf(os.Stderr, "Assertion failed for %s: expected true, got false\n", name)
		os.Exit(1)
	}
}

func assertEqual[T comparable](name string, expected, actual T) {
	if expected != actual {
		fmt.Fprintf(os.Stderr, "Assertion failed for %s: expected %v, got %v\n", name, expected, actual)
		os.Exit(1)
	}
}

func main() {
	// Contract: code.Code_UNKNOWN evaluates to code.Code enum value 2
	unknownCode := code.Code_UNKNOWN
	assertEqual("Code_UNKNOWN int32 value", int32(2), int32(unknownCode))

	// Contract: code.Code_UNKNOWN String() returns "UNKNOWN"
	assertEqual("Code_UNKNOWN String()", "UNKNOWN", unknownCode.String())

	// Contract: code.Code_name maps Code_UNKNOWN value 2 to "UNKNOWN"
	name, exists := code.Code_name[int32(unknownCode)]
	assertTrue("Code_name exists for Code_UNKNOWN", exists)
	assertEqual("Code_name value for Code_UNKNOWN", "UNKNOWN", name)

	// Contract: code.Code_value maps "UNKNOWN" to int32 value 2
	val, exists := code.Code_value["UNKNOWN"]
	assertTrue("Code_value exists for UNKNOWN", exists)
	assertEqual("Code_value for UNKNOWN", int32(unknownCode), val)

	// Contract: code.Code_UNKNOWN descriptor and enum number are consistent
	assertEqual("Code_UNKNOWN Number", int32(2), int32(unknownCode.Number()))

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

Origin Seeder

anonymous