CodeSampleX

Sample

github.com/Masterminds/semver/v3 v3.2.0: semver.IncMajor

Verified sample for golang github.com/Masterminds/semver/v3 v3.2.0: semver.IncMajor. The contract ran on go 1.26 · linux debian/x64 · docker and passed.

sha256:72b37f3d6158b15d79ee76ae522d3e0710cd88e85bd1c0e9d0bf9643dae054d4

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-09-01

Case

HOW
Goal
verify semver.IncMajor in pkg:golang/github.com/Masterminds/semver/v3@v3.2.0
Packages
Symbols
  • semver.IncMajor
Created
2026-09-01T01:22:03Z

Contract

  1. semver.Version.IncMajor increments the major version number by one and resets minor and patch numbers to zero
  2. semver.Version.IncMajor removes any prerelease and build metadata from the resulting version
  3. semver.Version.IncMajor returns a new Version instance without mutating the original Version

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • 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 semver.IncMajor in pkg:golang/github.com/Masterminds/semver/v3@v3.2.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/Masterminds/semver/v3@v3.2.0
Demonstrate these symbols/APIs:
  - semver.IncMajor

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:df9f557b5c7c928f9f40f4e116f3caf8ab2e596ca5cddecb0d1028351829ad1a","contract":["semver.Version.IncMajor increments the major version number by one and resets minor and patch numbers to zero","semver.Version.IncMajor removes any prerelease and build metadata from the resulting version","semver.Version.IncMajor returns a new Version instance without mutating the original Version"],"goal":"verify semver.IncMajor in pkg:golang/github.com/Masterminds/semver/v3@v3.2.0","kind":"HOW","packages":["pkg:golang/github.com/Masterminds/semver/v3@v3.2.0"],"schemaVersion":1,"symbols":["semver.IncMajor"]},"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/Masterminds/semver/v3@v3.2.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/Masterminds/semver/v3@v3.2.0","symbols":["semver.IncMajor"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.26

require github.com/Masterminds/semver/v3 v3.2.0
go.sum
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
main.go
package main

import (
	"fmt"
	"os"

	"github.com/Masterminds/semver/v3"
)

func main() {
	v, err := semver.NewVersion("1.4.2-beta.1+exp.sha.5114f85")
	if err != nil {
		fmt.Fprintf(os.Stderr, "failed to parse version: %v\n", err)
		os.Exit(1)
	}

	nextMajor := v.IncMajor()
	fmt.Printf("Original version:   %s\n", v.String())
	fmt.Printf("Next major version: %s\n", nextMajor.String())
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify semver.IncMajor in pkg:golang/github.com/Masterminds/semver/v3@v3.2.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/Masterminds/semver/v3@v3.2.0"
  ],
  "symbols": [
    "semver.IncMajor"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"github.com/Masterminds/semver/v3"
)

func main() {
	// Assertion 1: semver.Version.IncMajor increments the major version number by one and resets minor and patch numbers to zero
	v1, err := semver.NewVersion("1.4.2")
	if err != nil {
		fmt.Fprintf(os.Stderr, "assertion 1 failed to parse: %v\n", err)
		os.Exit(1)
	}
	inc1 := v1.IncMajor()
	if inc1.Major() != 2 || inc1.Minor() != 0 || inc1.Patch() != 0 {
		fmt.Fprintf(os.Stderr, "assertion 1 failed: expected 2.0.0, got %s\n", inc1.String())
		os.Exit(1)
	}
	if inc1.String() != "2.0.0" {
		fmt.Fprintf(os.Stderr, "assertion 1 failed: expected string '2.0.0', got %q\n", inc1.String())
		os.Exit(1)
	}

	// Assertion 2: semver.Version.IncMajor removes any prerelease and build metadata from the resulting version
	v2, err := semver.NewVersion("1.2.3-alpha.1+build.10")
	if err != nil {
		fmt.Fprintf(os.Stderr, "assertion 2 failed to parse: %v\n", err)
		os.Exit(1)
	}
	inc2 := v2.IncMajor()
	if inc2.Prerelease() != "" {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected empty prerelease, got %q\n", inc2.Prerelease())
		os.Exit(1)
	}
	if inc2.Metadata() != "" {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected empty metadata, got %q\n", inc2.Metadata())
		os.Exit(1)
	}
	if inc2.String() != "2.0.0" {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected string '2.0.0', got %q\n", inc2.String())
		os.Exit(1)
	}

	// Assertion 3: semver.Version.IncMajor returns a new Version instance without mutating the original Version
	v3, err := semver.NewVersion("3.5.7-rc.2+sha.abcdef")
	if err != nil {
		fmt.Fprintf(os.Stderr, "assertion 3 failed to parse: %v\n", err)
		os.Exit(1)
	}
	_ = v3.IncMajor()
	if v3.Major() != 3 || v3.Minor() != 5 || v3.Patch() != 7 || v3.Prerelease() != "rc.2" || v3.Metadata() != "sha.abcdef" {
		fmt.Fprintf(os.Stderr, "assertion 3 failed: original version was mutated: %s\n", v3.String())
		os.Exit(1)
	}
	if v3.String() != "3.5.7-rc.2+sha.abcdef" {
		fmt.Fprintf(os.Stderr, "assertion 3 failed: original version string changed: %s\n", v3.String())
		os.Exit(1)
	}

	fmt.Println("All contract assertions passed.")
}

Origin Seeder

anonymous