CodeSampleX

Sample

google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f

Verified sample for golang google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f. The contract ran on go 1.26 · linux debian/x64 …

sha256:43051e722c986054966432cd753abc0ea63dae57705a86de56a8fa9e729d53c5

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 go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1

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-14

Case

HOW
Goal
verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f
Packages
Environment
go 1.26.6
Created
2026-10-14T01:58:54Z

Contract

  1. code.Code_value and code.Code_name map all 17 canonical gRPC status codes bijectively
  2. status.Status stores Code and Message fields accessible via GetCode and GetMessage, and returns zero values on nil receiver
  3. errdetails.ErrorInfo stores Reason, Domain, and Metadata accessible via getters and clears on Reset
  4. errdetails.BadRequest stores FieldViolations with Field and Description getters

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 pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f

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:a12a102f42100564ce21786b79516eb89cbb94e3a6a9658ac874fd8f20f49f06","contract":["code.Code_value and code.Code_name map all 17 canonical gRPC status codes bijectively","status.Status stores Code and Message fields accessible via GetCode and GetMessage, and returns zero values on nil receiver","errdetails.ErrorInfo stores Reason, Domain, and Metadata accessible via getters and clears on Reset","errdetails.BadRequest stores FieldViolations with Field and Description getters"],"goal":"verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f","verifierAdapter":"golang@1"}
go.mod
module sample

go 1.26.6

require google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f

require google.golang.org/protobuf v1.36.11 // indirect
go.sum
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f h1:Rka45QInERYknkHYfJEPBQaoobXl+YpxTMjAKgWUq2A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
main.go
package main

import (
	"fmt"

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

func main() {
	st := &status.Status{
		Code:    int32(code.Code_INVALID_ARGUMENT),
		Message: "invalid request field",
	}
	br := &errdetails.BadRequest{
		FieldViolations: []*errdetails.BadRequest_FieldViolation{
			{
				Field:       "username",
				Description: "must not be empty",
			},
		},
	}
	fmt.Printf("Status: code=%d (%s) message=%q violations=%d\n",
		st.GetCode(), code.Code(st.GetCode()).String(), st.GetMessage(), len(br.GetFieldViolations()))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f",
  "kind": "HOW",
  "packages": [
    "pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

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

func main() {
	if err := runContract(); err != nil {
		fmt.Fprintf(os.Stderr, "FAIL: %v\n", err)
		os.Exit(1)
	}
	fmt.Println("PASS: all contract assertions satisfied")
}

func runContract() error {
	// 1. code.Code_value and code.Code_name map all 17 canonical gRPC status codes bijectively
	if len(code.Code_value) != 17 || len(code.Code_name) != 17 {
		return fmt.Errorf("expected 17 entries in Code_value and Code_name, got %d and %d", len(code.Code_value), len(code.Code_name))
	}
	for name, val := range code.Code_value {
		if mapped, ok := code.Code_name[val]; !ok || mapped != name {
			return fmt.Errorf("Code_name[%d] = %q (ok=%v); want %q", val, mapped, ok, name)
		}
		if code.Code(val).String() != name {
			return fmt.Errorf("Code(%d).String() = %q; want %q", val, code.Code(val).String(), name)
		}
	}

	// 2. status.Status stores Code and Message fields accessible via GetCode and GetMessage, and returns zero values on nil receiver
	var nilStatus *status.Status
	if nilStatus.GetCode() != 0 || nilStatus.GetMessage() != "" || nilStatus.GetDetails() != nil {
		return fmt.Errorf("nil Status getters did not return zero values")
	}
	st := &status.Status{
		Code:    int32(code.Code_PERMISSION_DENIED),
		Message: "access denied",
	}
	if st.GetCode() != 7 || st.GetMessage() != "access denied" {
		return fmt.Errorf("Status getters returned code=%d message=%q; want 7, \"access denied\"", st.GetCode(), st.GetMessage())
	}
	st.Reset()
	if st.GetCode() != 0 || st.GetMessage() != "" {
		return fmt.Errorf("Status.Reset did not clear fields")
	}

	// 3. errdetails.ErrorInfo stores Reason, Domain, and Metadata accessible via getters and clears on Reset
	ei := &errdetails.ErrorInfo{
		Reason:   "QUOTA_EXCEEDED",
		Domain:   "example.com",
		Metadata: map[string]string{"limit": "100"},
	}
	if ei.GetReason() != "QUOTA_EXCEEDED" || ei.GetDomain() != "example.com" || ei.GetMetadata()["limit"] != "100" {
		return fmt.Errorf("ErrorInfo getters mismatch: reason=%q domain=%q metadata=%v", ei.GetReason(), ei.GetDomain(), ei.GetMetadata())
	}
	ei.Reset()
	if ei.GetReason() != "" || ei.GetDomain() != "" || ei.GetMetadata() != nil {
		return fmt.Errorf("ErrorInfo.Reset did not clear fields")
	}

	// 4. errdetails.BadRequest stores FieldViolations with Field and Description getters
	br := &errdetails.BadRequest{
		FieldViolations: []*errdetails.BadRequest_FieldViolation{
			{
				Field:       "email",
				Description: "invalid format",
			},
		},
	}
	if len(br.GetFieldViolations()) != 1 {
		return fmt.Errorf("expected 1 field violation, got %d", len(br.GetFieldViolations()))
	}
	fv := br.GetFieldViolations()[0]
	if fv.GetField() != "email" || fv.GetDescription() != "invalid format" {
		return fmt.Errorf("FieldViolation getters returned field=%q desc=%q", fv.GetField(), fv.GetDescription())
	}

	return nil
}

Origin Seeder

anonymous