Freshness gates: regenerate-and-diff for TS, Ruby, and Go generated output
What
Adds non-mutating regenerate-and-diff freshness gates for the three SDKs whose make check entry was coverage/typecheck-only, mirroring the existing check-swift-service-drift.sh / check-python-service-drift.sh:
scripts/check-typescript-service-drift.sh— the wholesrc/generated/tree (stripped OpenAPI, schema, metadata, path-mapping, generated services)scripts/check-ruby-service-drift.sh—metadata.json,types.rb, generated services (base_service.rbexcluded as hand-written)scripts/check-go-generated-drift.sh—client.gen.goafter thenormalize-go-deprecation-godoc.shpass; distinct fromcheck-service-drift.sh(operation-level coverage) andcheck-wrapper-drift(field-level)
Wired into root make check (Go standalone in the drift cluster; TS/Ruby as deps of ts-check/rb-check, like py-check-drift) plus each SDK's CI job. The Ruby CI step runs only on the canonical 3.3 matrix entry since generated output is Ruby-version independent.
Why
Each of these make check entries was coverage/typecheck-only, so a committed generated artifact could silently drift from the current generator/spec without failing make check. These gates close that hole for TS, Ruby, and Go, matching what Swift/Python already had.
Design notes
All three are fully non-mutative — they regenerate entirely into temp locations and never touch the committed working tree. That gives both make -j race-safety (a gate can't rewrite a tree while a sibling check target reads it) and correct extra-file detection (regenerating into an empty tree makes stale committed files surface as drift). How each redirects generation out-of-tree:
- Ruby generators accept
--output/stdout → emit straight to a temp dir. - Go's oapi-codegen honors its config
output:and ignores-o, so the gate writes a throwaway config whoseoutput:points at a temp file. - TS's pipeline resolves output paths from the generator scripts' own location (
import.meta__dirname), so the gate assembles a throwaway project outside the repo — the real scripts, a symlinkednode_modules, and a copy ofopenapi.jsonplaced where the pipeline's../openapi.jsonresolves — and runs the committednpm run generate+generate-servicesverbatim there (robust to pipeline changes).
Timestamps: Ruby metadata.json/types.rb and TS metadata.ts embed a wall-clock generated stamp; those single lines are canonicalized before diffing so a re-run isn't mistaken for drift. Go and the other TS artifacts are deterministic and compared verbatim. Generator stderr is preserved and printed on failure.
Kotlin stays a CI-only exception: kt-check-drift remains an operation-level coverage check at root, while its authoritative regenerate-and-diff runs in the test-kotlin CI job. Documented in the Makefile; promoting it to a root-invocable non-mutating gate is a follow-up.
No SDK-source changes.
Verification
- 3 gates exit 0 on clean
main; non-mutative (working tree untouched after every run) - Negative proofs: content drift, extra file at
services/and at the generated-tree root, timestamp-only change ignored, failure-path (brokenopenapi.json) exits 1 with diagnostics and leaves the tree untouched make check→ green;make -j check→ green (full 5-language conformance)shellcheckclean;actionlintclean
Context
Part of the post-0.9.0 retry-contract follow-up program — the ship-now item, independent of the held retry-behavior work.
Summary by cubic
Adds non-mutating regenerate-and-diff freshness gates for TypeScript, Ruby, and Go generated code to prevent drift. Runs in temp dirs, detects missing and extra files (including non-.rb artifacts in Ruby services), is safe under parallel make, and now guards missing Ruby artifacts and asserts Go output redirection.
-
New Features
- TypeScript:
scripts/check-typescript-service-drift.shregenerates the entiresrc/generated/tree and diffs; normalizes thegeneratedstamp inmetadata.ts. - Ruby:
scripts/check-ruby-service-drift.shregeneratesmetadata.json,types.rb, and snapshots the wholegenerated/services/tree for diffing (excludes hand-writtenbase_service.rb); normalizes timestamps; detects missing files cleanly. - Go:
scripts/check-go-generated-drift.shregeneratesclient.gen.govia a tempoapi-codegenconfig, asserts theoutput:redirect before running, appliesnormalize-go-deprecation-godoc.sh, and uses separate logs per phase.
- TypeScript:
-
CI and Makefile
- New targets:
ts-check-drift,rb-check-drift,go-check-generated-drift; wired intots-check,rb-check, and rootmake check. - CI runs the new gates for TS, Ruby (only on 3.3), and Go; Kotlin unchanged (regen-and-diff remains CI-only).
- New targets: