feat: teach the public v1 beta

Resolve the immutable Beta 1 runtime first, verify the exact compiler identity on Linux and Windows, and commit generated outputs from the released ABI.

Material implementation and review were assisted by OpenAI Codex. Cole Speelman reviewed the public tutorial and accepts human responsibility.

Signed-off-by: Cole Speelman <crspeelman@gmail.com>
This commit is contained in:
2026-08-12 15:20:49 -04:00
parent ddd91c7e7c
commit 3eee0b542c
10 changed files with 149 additions and 37 deletions
+89
View File
@@ -0,0 +1,89 @@
# SPDX-License-Identifier: 0BSD
[CmdletBinding()]
param()
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$repoRoot = Split-Path -Parent $PSScriptRoot
Set-Location $repoRoot
$env:GOWORK = "off"
$himesan = if ($env:HIMESAN_BIN) { $env:HIMESAN_BIN } else { "himesan" }
$expectedVersion = "v1.0.0-beta.1"
if (-not (Get-Command $himesan -ErrorAction SilentlyContinue)) {
throw "himesan was not found; install v1.0.0-beta.1 or set HIMESAN_BIN"
}
function Assert-LastExitCode([string]$Step) {
if ($LASTEXITCODE -ne 0) {
throw "$Step failed with exit code $LASTEXITCODE"
}
}
function Get-GeneratedDigest {
$lines = Get-ChildItem internal/views -Recurse -File -Filter *.sando.go |
Sort-Object FullName |
ForEach-Object {
$hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLowerInvariant()
"$($_.FullName):$hash"
}
return ($lines -join "`n")
}
$versionLine = (& $himesan version | Select-Object -First 1)
Assert-LastExitCode "himesan version"
if ($versionLine -notmatch '^himesan ([^ ]+) ') {
throw "could not parse himesan version output: $versionLine"
}
if ($Matches[1] -ne $expectedVersion) {
throw "himesan version is $($Matches[1]); expected $expectedVersion"
}
$runtimeVersion = (go list -m -f '{{.Version}}' gamertan.com/sandwich-hime/sando | Select-Object -First 1)
Assert-LastExitCode "sando runtime version"
if ($runtimeVersion -ne $expectedVersion) {
throw "sando runtime version is $runtimeVersion; expected $expectedVersion"
}
& $himesan check internal/views
Assert-LastExitCode "himesan check"
$before = Get-GeneratedDigest
& $himesan generate internal/views
Assert-LastExitCode "first himesan generate"
$afterFirst = Get-GeneratedDigest
& $himesan generate internal/views
Assert-LastExitCode "second himesan generate"
$afterSecond = Get-GeneratedDigest
& $himesan check internal/views
Assert-LastExitCode "final himesan check"
if ($before -ne $afterFirst -or $afterFirst -ne $afterSecond) {
throw "generated output was stale or nondeterministic"
}
go test ./...
Assert-LastExitCode "go test"
go vet ./...
Assert-LastExitCode "go vet"
$buildDir = Join-Path ([System.IO.Path]::GetTempPath()) ("sandwich-hime-tutorial-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $buildDir | Out-Null
try {
go build -trimpath -o (Join-Path $buildDir "site.exe") ./cmd/site
Assert-LastExitCode "go build"
} finally {
Remove-Item -LiteralPath $buildDir -Recurse -Force -ErrorAction SilentlyContinue
}
$dependencies = @(go list -deps ./cmd/site)
Assert-LastExitCode "go list -deps"
if ($dependencies -notcontains "gamertan.com/sandwich-hime/sando") {
throw "production dependency graph does not contain the sando runtime"
}
if ($dependencies | Where-Object { $_ -match '^gamertan\.com/sandwich-hime$|^gamertan\.com/sandwich-hime/(cmd|internal)(/|$)' }) {
throw "production dependency graph contains the Sandwich Hime compiler"
}
Write-Output "verified Beta 1 identity, deterministic generation, tests, vet, build, and runtime-only production dependencies"
+15 -4
View File
@@ -7,12 +7,23 @@ repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
cd "$repo_root"
himesan_bin=${HIMESAN_BIN:-himesan}
expected_version=v1.0.0-beta.1
if ! command -v "$himesan_bin" >/dev/null 2>&1; then
echo "himesan was not found; install it from the neighboring Sandwich Hime checkout or set HIMESAN_BIN" >&2
echo "himesan was not found; install v1.0.0-beta.1 or set HIMESAN_BIN" >&2
exit 1
fi
if [[ ! -f go.work ]]; then
echo "go.work is missing; follow the README preview bridge commands first" >&2
export GOWORK=off
actual_version=$("$himesan_bin" version | awk 'NR == 1 { print $2 }')
if [[ "$actual_version" != "$expected_version" ]]; then
echo "himesan version is $actual_version; expected $expected_version" >&2
exit 1
fi
runtime_version=$(go list -m -f '{{.Version}}' gamertan.com/sandwich-hime/sando)
if [[ "$runtime_version" != "$expected_version" ]]; then
echo "sando runtime version is $runtime_version; expected $expected_version" >&2
exit 1
fi
@@ -53,4 +64,4 @@ if grep -Eq '^gamertan\.com/sandwich-hime$|^gamertan\.com/sandwich-hime/(cmd|int
exit 1
fi
echo "verified deterministic generation, tests, vet, build, and runtime-only production dependencies"
echo "verified Beta 1 identity, deterministic generation, tests, vet, build, and runtime-only production dependencies"