Ejemplo
github.com/jackc/pgx/v5 v5.10.0: pgproto3.Terminate
Muestra verificada para golang github.com/jackc/pgx/v5 v5.10.0: pgproto3.Terminate. El contrato se ejecutó en go 1.26 · linux alpine/x64 · docker y pasó.
sha256:8369479741287d868253b74368759ae1b84c988320c198660cbeb283ca4c4b82
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 alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-28 |
Caso
HOW- Objetivo
- verify github.com/jackc/pgx/v5/pgproto3.Terminate in pkg:golang/github.com/jackc/pgx/v5@v5.10.0
- Paquetes
- Símbolos
-
- github.com/jackc/pgx/v5/pgproto3.Terminate
- Creado
- 2026-08-28T01:54:26Z
Contrato
- pgproto3.Terminate implements pgproto3.FrontendMessage
- Terminate.Encode appends the 5-byte frontend message frame ('X' followed by int32 length 4)
- Terminate.Decode succeeds on empty payload
- Terminate.Decode returns error on non-empty payload
- Terminate.MarshalJSON serializes to JSON with Type 'Terminate'
Archivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- spec.json
- terminate.go
- 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 github.com/jackc/pgx/v5/pgproto3.Terminate in pkg:golang/github.com/jackc/pgx/v5@v5.10.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/jackc/pgx/v5@v5.10.0
Demonstrate these symbols/APIs:
- github.com/jackc/pgx/v5/pgproto3.Terminate
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:c1e051f408f90e1fd42835e65f320e8dae6566c87fcb50c3e378f1fc951b396c","contract":["pgproto3.Terminate implements pgproto3.FrontendMessage","Terminate.Encode appends the 5-byte frontend message frame ('X' followed by int32 length 4)","Terminate.Decode succeeds on empty payload","Terminate.Decode returns error on non-empty payload","Terminate.MarshalJSON serializes to JSON with Type 'Terminate'"],"goal":"verify github.com/jackc/pgx/v5/pgproto3.Terminate in pkg:golang/github.com/jackc/pgx/v5@v5.10.0","kind":"HOW","packages":["pkg:golang/github.com/jackc/pgx/v5@v5.10.0"],"schemaVersion":1,"symbols":["github.com/jackc/pgx/v5/pgproto3.Terminate"]},"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/jackc/pgx/v5@v5.10.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/jackc/pgx/v5@v5.10.0","symbols":["github.com/jackc/pgx/v5/pgproto3.Terminate"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/jackc/pgx/v5 v5.10.0
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.10.0 h1:VhSvgU2jSli8o3AqIEOTJr7rZwAEUVo4E4XhR94Zfr0=
github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
{
"schemaVersion": 1,
"goal": "verify github.com/jackc/pgx/v5/pgproto3.Terminate in pkg:golang/github.com/jackc/pgx/v5@v5.10.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/jackc/pgx/v5@v5.10.0"
],
"symbols": [
"github.com/jackc/pgx/v5/pgproto3.Terminate"
]
}
package sample
import (
"encoding/json"
"fmt"
"github.com/jackc/pgx/v5/pgproto3"
)
// EncodeTerminate encodes a Terminate message onto the provided buffer.
func EncodeTerminate(dst []byte) ([]byte, error) {
var msg pgproto3.Terminate
return msg.Encode(dst)
}
// DecodeTerminate decodes the payload into a Terminate message.
// The payload should be empty because Terminate has a zero-length message body.
func DecodeTerminate(src []byte) (*pgproto3.Terminate, error) {
var msg pgproto3.Terminate
if err := msg.Decode(src); err != nil {
return nil, fmt.Errorf("decode terminate failed: %w", err)
}
return &msg, nil
}
// MarshalTerminateJSON serializes a Terminate message to JSON.
func MarshalTerminateJSON() ([]byte, error) {
var msg pgproto3.Terminate
return json.Marshal(msg)
}
// IsFrontendMessage verifies that the message satisfies the pgproto3.FrontendMessage interface.
func IsFrontendMessage(msg pgproto3.FrontendMessage) bool {
return msg != nil
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"os"
"github.com/jackc/pgx/v5/pgproto3"
"sample"
)
func main() {
// Assertion 1: pgproto3.Terminate implements pgproto3.FrontendMessage
var term pgproto3.Terminate
var frontendMsg pgproto3.FrontendMessage = &term
if frontendMsg == nil || !sample.IsFrontendMessage(&term) {
fmt.Fprintf(os.Stderr, "expected Terminate to implement pgproto3.FrontendMessage\n")
os.Exit(1)
}
// Assertion 2: Terminate.Encode appends the 5-byte frontend message frame ('X' followed by int32 length 4)
encoded, err := sample.EncodeTerminate(nil)
if err != nil {
fmt.Fprintf(os.Stderr, "expected Encode to succeed, got error: %v\n", err)
os.Exit(1)
}
expectedFrame := []byte{'X', 0, 0, 0, 4}
if !bytes.Equal(encoded, expectedFrame) {
fmt.Fprintf(os.Stderr, "expected encoded frame %v, got %v\n", expectedFrame, encoded)
os.Exit(1)
}
initialBuf := []byte{1, 2, 3}
encodedWithBuf, err := sample.EncodeTerminate(initialBuf)
if err != nil {
fmt.Fprintf(os.Stderr, "expected Encode with buffer to succeed, got error: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(encodedWithBuf[:3], initialBuf) || !bytes.Equal(encodedWithBuf[3:], expectedFrame) {
fmt.Fprintf(os.Stderr, "expected buffer append, got %v\n", encodedWithBuf)
os.Exit(1)
}
// Assertion 3: Terminate.Decode succeeds on empty payload
decoded, err := sample.DecodeTerminate(nil)
if err != nil || decoded == nil {
fmt.Fprintf(os.Stderr, "expected Decode(nil) to succeed, got error: %v\n", err)
os.Exit(1)
}
decodedEmpty, err := sample.DecodeTerminate([]byte{})
if err != nil || decodedEmpty == nil {
fmt.Fprintf(os.Stderr, "expected Decode([]byte{}) to succeed, got error: %v\n", err)
os.Exit(1)
}
// Assertion 4: Terminate.Decode returns error on non-empty payload
_, err = sample.DecodeTerminate([]byte{0x01})
if err == nil {
fmt.Fprintf(os.Stderr, "expected Decode to fail on non-empty payload, but got nil\n")
os.Exit(1)
}
// Assertion 5: Terminate.MarshalJSON serializes to JSON with Type 'Terminate'
jsonBytes, err := sample.MarshalTerminateJSON()
if err != nil {
fmt.Fprintf(os.Stderr, "expected MarshalJSON to succeed, got error: %v\n", err)
os.Exit(1)
}
var parsed struct {
Type string `json:"Type"`
}
if err := json.Unmarshal(jsonBytes, &parsed); err != nil || parsed.Type != "Terminate" {
fmt.Fprintf(os.Stderr, "expected JSON with Type 'Terminate', got %s\n", string(jsonBytes))
os.Exit(1)
}
fmt.Println("All pgproto3.Terminate contract assertions passed.")
}
Seeder de origen
anónimo