Ejemplo
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7: serviceconfig.Service
Muestra verificada para golang google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7: serviceconfig.Service. El contrato se ejecutó en…
sha256:e8acf53eecd350d0aed42ea2723a806861d7fdc8478230ab3a508c34bee2c9fd
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux 24 · ubuntu · glibc 2.39 x64 go
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-09-01 |
Caso
HOW- Objetivo
- verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
- Símbolos
-
- google.golang.org/genproto/googleapis/api/serviceconfig.Service
- Creado
- 2026-09-01T11:32:24Z
Contrato
- serviceconfig.Service can be instantiated with Name, Title, Id, and ProducerProjectId
- Service.GetName returns the configured service name
- Service.GetTitle returns the configured service title
- Service.GetId returns the configured service ID
- Service.GetProducerProjectId returns the configured producer project ID
- NewService helper creates a configured serviceconfig.Service
- GetServiceName, GetServiceTitle, GetServiceId, and GetProducerProjectId return the respective field values
- GetServiceName returns empty string on nil service
Archivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- service.go
- spec.json
- test/contract.go
Código fuente
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/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
Demonstrate these symbols/APIs:
- google.golang.org/genproto/googleapis/api/serviceconfig.Service
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:c975b0f430bdffcfc2e2e41ca03289c26283265e4216cb3acd857d822ec40008","contract":["serviceconfig.Service can be instantiated with Name, Title, Id, and ProducerProjectId","Service.GetName returns the configured service name","Service.GetTitle returns the configured service title","Service.GetId returns the configured service ID","Service.GetProducerProjectId returns the configured producer project ID","NewService helper creates a configured serviceconfig.Service","GetServiceName, GetServiceTitle, GetServiceId, and GetProducerProjectId return the respective field values","GetServiceName returns empty string on nil service"],"goal":"verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"symbols":["google.golang.org/genproto/googleapis/api/serviceconfig.Service"]},"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/api@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7","symbols":["google.golang.org/genproto/googleapis/api/serviceconfig.Service"],"verifierAdapter":"golang@1"}
module sample
go 1.22
require google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7
require google.golang.org/protobuf v1.34.2 // indirect
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/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw=
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
package sample
import (
"google.golang.org/genproto/googleapis/api/serviceconfig"
)
// NewService creates a new serviceconfig.Service instance with provided metadata.
func NewService(name, title, id, producerProjectId string) *serviceconfig.Service {
return &serviceconfig.Service{
Name: name,
Title: title,
Id: id,
ProducerProjectId: producerProjectId,
}
}
// GetServiceName returns the name of the service using GetName().
func GetServiceName(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetName()
}
// GetServiceTitle returns the title of the service using GetTitle().
func GetServiceTitle(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetTitle()
}
// GetServiceId returns the ID of the service using GetId().
func GetServiceId(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetId()
}
// GetProducerProjectId returns the producer project ID of the service using GetProducerProjectId().
func GetProducerProjectId(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetProducerProjectId()
}
{
"schemaVersion": 1,
"goal": "verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7"
],
"symbols": [
"google.golang.org/genproto/googleapis/api/serviceconfig.Service"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/api/serviceconfig"
"sample"
)
func main() {
// Assertion 1: instantiate serviceconfig.Service directly
svc := &serviceconfig.Service{
Name: "endpoints.example.com",
Title: "Example API",
Id: "2024-08-26r0",
ProducerProjectId: "example-project-123",
}
// Assertion 2: GetName returns the service name
if got := svc.GetName(); got != "endpoints.example.com" {
fmt.Fprintf(os.Stderr, "expected GetName() to return %q, got %q\n", "endpoints.example.com", got)
os.Exit(1)
}
// Assertion 3: GetTitle returns the service title
if got := svc.GetTitle(); got != "Example API" {
fmt.Fprintf(os.Stderr, "expected GetTitle() to return %q, got %q\n", "Example API", got)
os.Exit(1)
}
// Assertion 4: GetId returns the service ID
if got := svc.GetId(); got != "2024-08-26r0" {
fmt.Fprintf(os.Stderr, "expected GetId() to return %q, got %q\n", "2024-08-26r0", got)
os.Exit(1)
}
// Assertion 5: GetProducerProjectId returns the producer project ID
if got := svc.GetProducerProjectId(); got != "example-project-123" {
fmt.Fprintf(os.Stderr, "expected GetProducerProjectId() to return %q, got %q\n", "example-project-123", got)
os.Exit(1)
}
// Assertion 6: Helper NewService initializes fields properly
helperSvc := sample.NewService("endpoints.example.com", "Example API", "2024-08-26r0", "example-project-123")
if helperSvc == nil {
fmt.Fprintf(os.Stderr, "expected NewService to return non-nil\n")
os.Exit(1)
}
// Assertion 7: Helper functions extract correct field values
if got := sample.GetServiceName(helperSvc); got != "endpoints.example.com" {
fmt.Fprintf(os.Stderr, "expected GetServiceName() to return %q, got %q\n", "endpoints.example.com", got)
os.Exit(1)
}
if got := sample.GetServiceTitle(helperSvc); got != "Example API" {
fmt.Fprintf(os.Stderr, "expected GetServiceTitle() to return %q, got %q\n", "Example API", got)
os.Exit(1)
}
if got := sample.GetServiceId(helperSvc); got != "2024-08-26r0" {
fmt.Fprintf(os.Stderr, "expected GetServiceId() to return %q, got %q\n", "2024-08-26r0", got)
os.Exit(1)
}
if got := sample.GetProducerProjectId(helperSvc); got != "example-project-123" {
fmt.Fprintf(os.Stderr, "expected GetProducerProjectId() to return %q, got %q\n", "example-project-123", got)
os.Exit(1)
}
// Assertion 8: Nil safety in helper functions
if got := sample.GetServiceName(nil); got != "" {
fmt.Fprintf(os.Stderr, "expected GetServiceName(nil) to return empty string, got %q\n", got)
os.Exit(1)
}
fmt.Println("All google.golang.org/genproto/googleapis/api/serviceconfig.Service contract assertions passed.")
}
Seeder de origen
anónimo