示例
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda
已验证示例 — golang google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda. contract 在 go 1.26 · linux debian/x64 · docker 上运行并通过.
sha256:ce1b78205e8018aa177148010312892b137e000562a3a5710f9fcc3a37b1fb80
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
linux 24 · ubuntu · glibc 2.39 x64 go
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| 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-11 |
案例
HOW- 目标
- verify pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda
- 创建时间
- 2026-10-11T06:17:25Z
契约
- LaunchStage enum constants map to defined numeric values from UNSPECIFIED (0) through PRELAUNCH (7)
- LaunchStage.String() returns canonical string representations matching enum names
- LaunchStage.Number() returns protoreflect.EnumNumber matching the underlying int32 value
- LaunchStage.Enum() returns a typed pointer referencing the current LaunchStage value
- LaunchStage.Descriptor() provides valid protoreflect.EnumDescriptor with name 'LaunchStage' containing 8 defined values
- GetLaunchStageName and IsGA helper functions correctly evaluate LaunchStage values
文件
- NOTES.md
- PROMPT.md
- csx.json
- go.mod
- go.sum
- launch_stage.go
- spec.json
- test/contract.go
源代码
# Google APIs LaunchStage Enum Verification
This sample verifies the enum values, reflection behavior, and descriptor properties of `google.golang.org/genproto/googleapis/api.LaunchStage` in `google.golang.org/genproto/googleapis/api` at version `v0.0.0-20251029180050-ab9386a59fda`.
## Observed Behavior
1. **Enum Value Mapping**:
- `LaunchStage_LAUNCH_STAGE_UNSPECIFIED` = 0
- `LaunchStage_EARLY_ACCESS` = 1
- `LaunchStage_ALPHA` = 2
- `LaunchStage_BETA` = 3
- `LaunchStage_GA` = 4
- `LaunchStage_DEPRECATED` = 5
- `LaunchStage_UNIMPLEMENTED` = 6
- `LaunchStage_PRELAUNCH` = 7
2. **String and Protoreflect Integration**:
- `LaunchStage.String()` returns canonical string representations matching the protobuf enum value names without the `LaunchStage_` prefix.
- `LaunchStage.Number()` returns a `protoreflect.EnumNumber` equal to the underlying integer value.
- `LaunchStage.Enum()` returns a typed pointer referencing the current `LaunchStage` value.
3. **Descriptor Inspection**:
- `LaunchStage.Descriptor()` returns the protobuf enum descriptor with name `LaunchStage` containing all 8 defined value descriptors.
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/api@v0.0.0-20251029180050-ab9386a59fda
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda
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:164d7fea06785fca459db8f4f08a439ba5d64083935b2826054fda560ae4f047","contract":["LaunchStage enum constants map to defined numeric values from UNSPECIFIED (0) through PRELAUNCH (7)","LaunchStage.String() returns canonical string representations matching enum names","LaunchStage.Number() returns protoreflect.EnumNumber matching the underlying int32 value","LaunchStage.Enum() returns a typed pointer referencing the current LaunchStage value","LaunchStage.Descriptor() provides valid protoreflect.EnumDescriptor with name 'LaunchStage' containing 8 defined values","GetLaunchStageName and IsGA helper functions correctly evaluate LaunchStage values"],"goal":"verify pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda"],"schemaVersion":1},"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-20251029180050-ab9386a59fda"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda","verifierAdapter":"golang@1"}
module sample
go 1.24.0
require (
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda
google.golang.org/protobuf v1.36.10
)
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/api v0.0.0-20251029180050-ab9386a59fda h1:+2XxjfsAu6vqFxwGBRcHiMaDCuZiqXGDUDVWVtrFAnE=
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo=
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
package sample
import (
"google.golang.org/genproto/googleapis/api"
)
// GetLaunchStageName returns the canonical string name of a LaunchStage.
func GetLaunchStageName(stage api.LaunchStage) string {
return stage.String()
}
// IsGA returns true if the launch stage is GA.
func IsGA(stage api.LaunchStage) bool {
return stage == api.LaunchStage_GA
}
// IsEarlyAccess returns true if the launch stage is EARLY_ACCESS.
func IsEarlyAccess(stage api.LaunchStage) bool {
return stage == api.LaunchStage_EARLY_ACCESS
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20251029180050-ab9386a59fda"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/api"
"google.golang.org/protobuf/reflect/protoreflect"
"sample"
)
func main() {
// Assertion 1: LaunchStage enum constants map to defined numeric values from UNSPECIFIED (0) through PRELAUNCH (7)
testCases := []struct {
stage api.LaunchStage
expected int32
strName string
}{
{api.LaunchStage_LAUNCH_STAGE_UNSPECIFIED, 0, "LAUNCH_STAGE_UNSPECIFIED"},
{api.LaunchStage_EARLY_ACCESS, 1, "EARLY_ACCESS"},
{api.LaunchStage_ALPHA, 2, "ALPHA"},
{api.LaunchStage_BETA, 3, "BETA"},
{api.LaunchStage_GA, 4, "GA"},
{api.LaunchStage_DEPRECATED, 5, "DEPRECATED"},
{api.LaunchStage_UNIMPLEMENTED, 6, "UNIMPLEMENTED"},
{api.LaunchStage_PRELAUNCH, 7, "PRELAUNCH"},
}
for _, tc := range testCases {
if int32(tc.stage) != tc.expected {
fmt.Fprintf(os.Stderr, "expected int32 value %d for %s, got %d\n", tc.expected, tc.strName, int32(tc.stage))
os.Exit(1)
}
// Assertion 2: LaunchStage.String() returns canonical string representations matching enum names
if tc.stage.String() != tc.strName {
fmt.Fprintf(os.Stderr, "expected String() %q for stage %d, got %q\n", tc.strName, tc.expected, tc.stage.String())
os.Exit(1)
}
// Assertion 3: LaunchStage.Number() returns protoreflect.EnumNumber matching the underlying int32 value
if tc.stage.Number() != protoreflect.EnumNumber(tc.expected) {
fmt.Fprintf(os.Stderr, "expected Number() %d for %s, got %d\n", tc.expected, tc.strName, tc.stage.Number())
os.Exit(1)
}
// Assertion 4: LaunchStage.Enum() returns a typed pointer referencing the current LaunchStage value
enumPtr := tc.stage.Enum()
if enumPtr == nil || *enumPtr != tc.stage {
fmt.Fprintf(os.Stderr, "expected Enum() pointer to hold %v, got %v\n", tc.stage, enumPtr)
os.Exit(1)
}
}
// Assertion 5: LaunchStage.Descriptor() provides valid protoreflect.EnumDescriptor with name 'LaunchStage' containing 8 defined values
desc := api.LaunchStage_GA.Descriptor()
if desc == nil {
fmt.Fprintf(os.Stderr, "expected non-nil EnumDescriptor from LaunchStage.Descriptor()\n")
os.Exit(1)
}
if desc.Name() != "LaunchStage" {
fmt.Fprintf(os.Stderr, "expected EnumDescriptor name 'LaunchStage', got %q\n", desc.Name())
os.Exit(1)
}
values := desc.Values()
if values.Len() != 8 {
fmt.Fprintf(os.Stderr, "expected 8 enum values in descriptor, got %d\n", values.Len())
os.Exit(1)
}
// Assertion 6: GetLaunchStageName and IsGA helper functions correctly evaluate LaunchStage values
if name := sample.GetLaunchStageName(api.LaunchStage_GA); name != "GA" {
fmt.Fprintf(os.Stderr, "expected 'GA', got %q\n", name)
os.Exit(1)
}
if !sample.IsGA(api.LaunchStage_GA) {
fmt.Fprintf(os.Stderr, "expected IsGA to be true for LaunchStage_GA\n")
os.Exit(1)
}
if sample.IsGA(api.LaunchStage_BETA) {
fmt.Fprintf(os.Stderr, "expected IsGA to be false for LaunchStage_BETA\n")
os.Exit(1)
}
fmt.Println("All LaunchStage contract assertions passed.")
}
原始种子者
匿名