Exemple
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f: code.Code_DEADLINE_EXCEEDED
Échantillon vérifié pour golang google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f: code.Code_DEADLINE_EXCEEDED. Le contrat s'est…
sha256:b613f4d1a6277ceff3aabf805bd527ffcd06f26bfb4a48ab14b939f83289e742
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 go
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f
- Symboles
-
- google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED
- Créé
- 2026-10-15T02:07:17Z
Contrat
- code.Code_DEADLINE_EXCEEDED equals 4
- code.Code_DEADLINE_EXCEEDED is a code.Code enum value
- code.Code_DEADLINE_EXCEEDED String() returns "DEADLINE_EXCEEDED"
- code.Code_name maps 4 to "DEADLINE_EXCEEDED"
- code.Code_value maps "DEADLINE_EXCEEDED" to 4
- IsDeadlineExceeded returns true for Code_DEADLINE_EXCEEDED and false for Code_OK
- GetDeadlineExceededCode returns Code_DEADLINE_EXCEEDED
Fichiers
- PROMPT.md
- csx.json
- deadline_exceeded.go
- go.mod
- go.sum
- spec.json
- test/contract.go
Code 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 google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED in 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
Demonstrate these symbols/APIs:
- google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED
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:20d19d7c5040da0e2de138c03000a310ae34a5ba4b2fc3a7ea8b40c371243de3","contract":["code.Code_DEADLINE_EXCEEDED equals 4","code.Code_DEADLINE_EXCEEDED is a code.Code enum value","code.Code_DEADLINE_EXCEEDED String() returns \"DEADLINE_EXCEEDED\"","code.Code_name maps 4 to \"DEADLINE_EXCEEDED\"","code.Code_value maps \"DEADLINE_EXCEEDED\" to 4","IsDeadlineExceeded returns true for Code_DEADLINE_EXCEEDED and false for Code_OK","GetDeadlineExceededCode returns Code_DEADLINE_EXCEEDED"],"goal":"verify google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED in 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,"symbols":["google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED"]},"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-20260401001100-f93e5f3e9f0f"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260401001100-f93e5f3e9f0f","symbols":["google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED"],"verifierAdapter":"golang@1"}
package sample
import (
"google.golang.org/genproto/googleapis/rpc/code"
)
// IsDeadlineExceeded returns true if the given code is Code_DEADLINE_EXCEEDED.
func IsDeadlineExceeded(c code.Code) bool {
return c == code.Code_DEADLINE_EXCEEDED
}
// GetDeadlineExceededCode returns the Code_DEADLINE_EXCEEDED enum value.
func GetDeadlineExceededCode() code.Code {
return code.Code_DEADLINE_EXCEEDED
}
// GetDeadlineExceededName returns the string representation of Code_DEADLINE_EXCEEDED.
func GetDeadlineExceededName() string {
return code.Code_DEADLINE_EXCEEDED.String()
}
// GetDeadlineExceededNumber returns the integer value of Code_DEADLINE_EXCEEDED.
func GetDeadlineExceededNumber() int32 {
return int32(code.Code_DEADLINE_EXCEEDED)
}
module sample
go 1.25.0
require google.golang.org/genproto/googleapis/rpc v0.0.0-20260401001100-f93e5f3e9f0f
require google.golang.org/protobuf v1.36.11 // indirect
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=
{
"schemaVersion": 1,
"goal": "verify google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED in 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"
],
"symbols": [
"google.golang.org/genproto/googleapis/rpc/code.Code_DEADLINE_EXCEEDED"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/rpc/code"
"sample"
)
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 {
// Assertion 1: Code_DEADLINE_EXCEEDED has enum integer value 4
if code.Code_DEADLINE_EXCEEDED != 4 {
return fmt.Errorf("expected code.Code_DEADLINE_EXCEEDED to equal 4, got %d", int32(code.Code_DEADLINE_EXCEEDED))
}
// Assertion 2: Code_DEADLINE_EXCEEDED is of type code.Code
var c code.Code = code.Code_DEADLINE_EXCEEDED
if c != code.Code_DEADLINE_EXCEEDED {
return fmt.Errorf("type mismatch for code.Code")
}
// Assertion 3: Code_DEADLINE_EXCEEDED String() returns "DEADLINE_EXCEEDED"
if code.Code_DEADLINE_EXCEEDED.String() != "DEADLINE_EXCEEDED" {
return fmt.Errorf("expected String() to return \"DEADLINE_EXCEEDED\", got %q", code.Code_DEADLINE_EXCEEDED.String())
}
// Assertion 4: Code_name mapping contains "DEADLINE_EXCEEDED" for value 4
if name, ok := code.Code_name[int32(code.Code_DEADLINE_EXCEEDED)]; !ok || name != "DEADLINE_EXCEEDED" {
return fmt.Errorf("expected Code_name[4] to be \"DEADLINE_EXCEEDED\", got %q", name)
}
// Assertion 5: Code_value mapping maps "DEADLINE_EXCEEDED" to 4
if val, ok := code.Code_value["DEADLINE_EXCEEDED"]; !ok || val != int32(code.Code_DEADLINE_EXCEEDED) {
return fmt.Errorf("expected Code_value[\"DEADLINE_EXCEEDED\"] to be 4, got %d", val)
}
// Assertion 6: IsDeadlineExceeded helper returns true for Code_DEADLINE_EXCEEDED and false for Code_OK
if !sample.IsDeadlineExceeded(code.Code_DEADLINE_EXCEEDED) {
return fmt.Errorf("expected IsDeadlineExceeded(Code_DEADLINE_EXCEEDED) to be true")
}
if sample.IsDeadlineExceeded(code.Code_OK) {
return fmt.Errorf("expected IsDeadlineExceeded(Code_OK) to be false")
}
// Assertion 7: GetDeadlineExceededCode helper returns Code_DEADLINE_EXCEEDED
if sample.GetDeadlineExceededCode() != code.Code_DEADLINE_EXCEEDED {
return fmt.Errorf("expected GetDeadlineExceededCode() to return Code_DEADLINE_EXCEEDED")
}
return nil
}
Seeder d'origine
anonyme