kt drift gate: land the relative-path Gradle --args fix (post-#460 hotfix)
Post-merge hotfix for #460.
What went wrong
#460's final commit message described switching scripts/check-kotlin-generated-drift.sh to clean relative Gradle --args paths (the fix for the literal-double-quote review finding), but a staging slip meant the script change was never git added before the amend. So #460 merged (c541afe9) with the earlier double-quote-wrapping version — the merged code and its own commit message (and the resolved review reply) disagree. This PR lands the intended fix.
The fix
- Generate into a unique gitignored
kotlin/build/subdir and pass only fixed relative paths to the generator (../openapi.json,../behavior-model.json,build/kt-drift-check.XXXXXX), exactly likemake kt-generate-services. This sidesteps Gradle's--argsstring tokenizer entirely: no repo/TMPDIRpath character (space, apostrophe, double quote, backslash) ever appears in the argument string, so no quoting is needed and no path can be mis-split — whatever the checkout location. Writing underbuild/(gitignored) keeps the check non-mutating; the temp subdir is removed on exit. - Exit-code contract fix: map any generator/Gradle failure to exit 2 (the reserved "cannot run" code) instead of letting Gradle's exit 1 masquerade as drift. Restores
0 = clean, 1 = drift, 2 = cannot run.
Verification
- shellcheck clean
- normal → exit 0
- a
TMPDIRcontaining a space, apostrophe, and double quote (now unused) → exit 0 - extra-file drift and a missing committed tree → exit 1
- a broken Java home that makes Gradle fail → exit 2; a missing JVM toolchain → exit 2
- no tracked-file changes, no leftover
build/subdir
Note: this PR's GitHub Actions audit shows the same exogenous zizmor ref-version-mismatch failure carried by current main's #463 seed (release-go.yml comment # v6.9.9 for a v7.0.0 SHA) — unrelated to this diff; repaired by #466.
Summary by cubic
Fixes the Kotlin drift check by regenerating into kotlin/build and passing only relative Gradle --args, removing path tokenization issues and restoring exit codes (0 clean, 1 drift, 2 cannot run). Follow-up to #460.
- Bug Fixes
- Generate into unique
kotlin/build/kt-drift-check.XXXXXXand pass only relative paths (../openapi.json,../behavior-model.json,build/...) fromkotlin/to Gradle--args. - Avoid
--argsre-tokenization; spaces, quotes, and backslashes no longer break paths. Committed tree stays untouched; temp dir and log are removed on exit. Build-dir/temp-dir creation errors map to exit 2. - Capture Gradle output to a log and print it only on failure; map generator/Gradle failures to exit 2. Drift remains exit 1.
- Generate into unique