CodeSampleX

Sample

github.com/envoyproxy/go-control-plane/ratelimit v0.1.0: v3.RateLimitReplace

Verified sample for golang github.com/envoyproxy/go-control-plane/ratelimit v0.1.0: v3.RateLimitReplace. The contract ran on go 1.26 · linux debian/x64 …

sha256:a289896955fce45d9f5342bb9e9c36f68d7395448c0f0fd40a59c6ffbd3ac99b

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

Case

HOW
Goal
verify github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace in pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0
Packages
Symbols
  • github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace
Created
2026-10-15T05:15:33Z

Contract

  1. RateLimitReplace.GetName() returns empty string on a nil receiver and returns the configured policy name on a populated struct
  2. RateLimitReplace.ProtoReflect().Descriptor().FullName() resolves to ratelimit.config.ratelimit.v3.RateLimitReplace
  3. RateLimitPolicy.Replaces accepts []*RateLimitReplace entries and RateLimitReplace.Reset() clears the Name field

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • 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 github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace in pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0
Demonstrate these symbols/APIs:
  - github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace

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:70115ca18bf852d1f6ec14469565a9c73953cd51bb608c49e3faa2b474b18684","contract":["RateLimitReplace.GetName() returns empty string on a nil receiver and returns the configured policy name on a populated struct","RateLimitReplace.ProtoReflect().Descriptor().FullName() resolves to ratelimit.config.ratelimit.v3.RateLimitReplace","RateLimitPolicy.Replaces accepts []*RateLimitReplace entries and RateLimitReplace.Reset() clears the Name field"],"goal":"verify github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace in pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0","kind":"HOW","packages":["pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0"],"schemaVersion":1,"symbols":["github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace"]},"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/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0","symbols":["github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.21

require github.com/envoyproxy/go-control-plane/ratelimit v0.1.0

require google.golang.org/protobuf v1.35.2 // indirect
go.sum
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
spec.json
{
  "schemaVersion": 1,
  "goal": "verify github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace in pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/envoyproxy/go-control-plane/ratelimit@v0.1.0"
  ],
  "symbols": [
    "github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3.RateLimitReplace"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"
	"strings"

	ratelimitv3 "github.com/envoyproxy/go-control-plane/ratelimit/config/ratelimit/v3"
)

func main() {
	var nilReplace *ratelimitv3.RateLimitReplace
	if nilReplace.GetName() != "" {
		fmt.Fprintf(os.Stderr, "expected empty name on nil RateLimitReplace, got %q\n", nilReplace.GetName())
		os.Exit(1)
	}

	replace := &ratelimitv3.RateLimitReplace{
		Name: "default_tier_policy",
	}
	if replace.GetName() != "default_tier_policy" {
		fmt.Fprintf(os.Stderr, "expected name %q, got %q\n", "default_tier_policy", replace.GetName())
		os.Exit(1)
	}

	if !strings.Contains(replace.String(), "default_tier_policy") {
		fmt.Fprintf(os.Stderr, "expected String() to contain policy name, got %q\n", replace.String())
		os.Exit(1)
	}

	msg := replace.ProtoReflect()
	if string(msg.Descriptor().FullName()) != "ratelimit.config.ratelimit.v3.RateLimitReplace" {
		fmt.Fprintf(os.Stderr, "unexpected proto full name: %s\n", msg.Descriptor().FullName())
		os.Exit(1)
	}

	policy := &ratelimitv3.RateLimitPolicy{
		Name:            "premium_tier_policy",
		Unit:            ratelimitv3.RateLimitUnit_MINUTE,
		RequestsPerUnit: 100,
		Replaces:        []*ratelimitv3.RateLimitReplace{replace},
	}
	if len(policy.GetReplaces()) != 1 || policy.GetReplaces()[0].GetName() != "default_tier_policy" {
		fmt.Fprintf(os.Stderr, "unexpected Replaces in RateLimitPolicy: %v\n", policy.GetReplaces())
		os.Exit(1)
	}

	replace.Reset()
	if replace.GetName() != "" {
		fmt.Fprintf(os.Stderr, "expected empty name after Reset(), got %q\n", replace.GetName())
		os.Exit(1)
	}
}

Origin Seeder

anonymous