From e38fe8954d57203ce57d2f3033812a458c1f081e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 19:30:29 +0000 Subject: [PATCH 1/3] ADFA-7244: Keep flox files out of the Spotless apply commit `flox activate` on the runner rewrites the tracked flox/base/.flox/env manifest files, and `git commit -am` swept them into the "no functional change" commit (feature/ADFA-7237 ce38728, feature/ADFA-7238 367c455; both reverted by hand). Restore flox/ before committing, so a flox-only change counts as "already formatted", and commit only the file types Spotless formats (.java, .kt, .kts, res .xml, .gitignore). Any other modified file now fails the job instead of being committed. Checked by running the step's script in a scratch repo: a flox-only change commits nothing; a .kt change plus a flox change commits only the .kt file; a .kt change plus a README change fails without committing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw --- .github/workflows/spotless-apply.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spotless-apply.yml b/.github/workflows/spotless-apply.yml index 521d5aa528..196d330d35 100644 --- a/.github/workflows/spotless-apply.yml +++ b/.github/workflows/spotless-apply.yml @@ -60,14 +60,25 @@ jobs: run: | flox activate -d flox/base -- ./gradlew spotlessApply --no-daemon + # flox activate can rewrite the tracked environment files under flox/ (schema upgrade, + # relock), which do not belong in a formatting commit (ADFA-7244). Drop them, then commit + # only file types Spotless formats, and fail on anything else rather than sweep it in. - name: Commit and push run: | + git restore -- flox/ if git diff --quiet; then echo "::notice::Already formatted. Nothing to commit." exit 0 fi + unexpected=$(git diff --name-only | grep -vE '\.(java|kt|kts|xml)$|(^|/)\.gitignore$' || true) + if [ -n "$unexpected" ]; then + echo "::error::spotlessApply changed files Spotless does not format; not committing:" + echo "$unexpected" + exit 1 + fi git config user.name "ADFA" git config user.email "dev-team@appdevforall.org" - git commit -am "style: spotless reformat, no functional change" + git add -u + git commit -m "style: spotless reformat, no functional change" git push origin "HEAD:refs/heads/$BRANCH" echo "::notice::Pushed $(git rev-parse --short HEAD) to $BRANCH." From 4c94ed785c43ec11462c4d69a79d4b28efe7859e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 20:17:32 +0000 Subject: [PATCH 2/3] ADFA-7244: Allow the Spotless shell targets in the formatting commit The allowlist missed the spotless `shell` step, which formats .githooks/** and scripts/** (minus the debug keystore). A branch touching a hook or script would have failed the job and lost its other formatting too (CodeRabbit on #2299). Allow those paths; a change to the keystore still fails. Checked in a scratch repo with the step's own script: flox only -> no commit; kt + flox -> kt only; kt + hook + script + flox -> those three only; kt + README -> fails; kt + keystore -> fails. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw --- .github/workflows/spotless-apply.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spotless-apply.yml b/.github/workflows/spotless-apply.yml index 196d330d35..b374236b78 100644 --- a/.github/workflows/spotless-apply.yml +++ b/.github/workflows/spotless-apply.yml @@ -62,7 +62,9 @@ jobs: # flox activate can rewrite the tracked environment files under flox/ (schema upgrade, # relock), which do not belong in a formatting commit (ADFA-7244). Drop them, then commit - # only file types Spotless formats, and fail on anything else rather than sweep it in. + # only what Spotless formats, and fail on anything else rather than sweep it in. Keep the + # pattern in step with the spotless block in build.gradle.kts (java, kotlin, kotlinGradle, + # xml, misc .gitignore, shell .githooks/** and scripts/** minus the keystore). - name: Commit and push run: | git restore -- flox/ @@ -70,7 +72,9 @@ jobs: echo "::notice::Already formatted. Nothing to commit." exit 0 fi - unexpected=$(git diff --name-only | grep -vE '\.(java|kt|kts|xml)$|(^|/)\.gitignore$' || true) + unexpected=$(git diff --name-only | + grep -vE '\.(java|kt|kts|xml)$|(^|/)\.gitignore$|^(\.githooks|scripts)/' | + cat - <(git diff --name-only -- scripts/debug-keystore/adfa-keystore.jks) || true) if [ -n "$unexpected" ]; then echo "::error::spotlessApply changed files Spotless does not format; not committing:" echo "$unexpected" From 5d0fcf01f3daf7bb0fa6aec8dd0658458172776b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 20:26:07 +0000 Subject: [PATCH 3/3] ADFA-7244: Tighten the Spotless commit guard after review From an independent review of #2299: - List names with core.quotePath=false, so a non-ASCII file name Spotless formatted is not quoted and wrongly rejected. - Reject added, deleted, renamed or copied files and mode changes: Spotless only edits contents, and `git add -u` would otherwise commit them. - Each check ends in `|| true`, so the guard behaves the same with or without pipefail and inherit_errexit. - The comment now says the path pattern is a coarse guard by file type, looser than the spotless targets, instead of claiming to mirror them; it also says why the keystore line is there. Checked in a scratch repo under bash -e, -eo pipefail and inherit_errexit: flox only -> no commit; kt + flox -> kt only; kt + hook + script -> those three; kt + README, kt + keystore, a deleted kt, a mode change -> fail; a non-ASCII .kt -> committed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw --- .github/workflows/spotless-apply.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/spotless-apply.yml b/.github/workflows/spotless-apply.yml index b374236b78..09542d60cc 100644 --- a/.github/workflows/spotless-apply.yml +++ b/.github/workflows/spotless-apply.yml @@ -61,10 +61,11 @@ jobs: flox activate -d flox/base -- ./gradlew spotlessApply --no-daemon # flox activate can rewrite the tracked environment files under flox/ (schema upgrade, - # relock), which do not belong in a formatting commit (ADFA-7244). Drop them, then commit - # only what Spotless formats, and fail on anything else rather than sweep it in. Keep the - # pattern in step with the spotless block in build.gradle.kts (java, kotlin, kotlinGradle, - # xml, misc .gitignore, shell .githooks/** and scripts/** minus the keystore). + # relock), which do not belong in a formatting commit (ADFA-7244). Drop them, then fail + # rather than commit anything Spotless could not have done. The path pattern is a coarse + # guard by file type, looser than the targets in build.gradle.kts's spotless block; widen + # it if that block gains a new type. Spotless only edits file contents, so an added, + # deleted or renamed file, or a mode change, is never its own. - name: Commit and push run: | git restore -- flox/ @@ -72,9 +73,15 @@ jobs: echo "::notice::Already formatted. Nothing to commit." exit 0 fi - unexpected=$(git diff --name-only | - grep -vE '\.(java|kt|kts|xml)$|(^|/)\.gitignore$|^(\.githooks|scripts)/' | - cat - <(git diff --name-only -- scripts/debug-keystore/adfa-keystore.jks) || true) + # quotePath=false: a non-ASCII name would otherwise be listed quoted and miss the pattern. + names() { git -c core.quotePath=false diff --name-only "$@"; } + unexpected=$({ + names | grep -vE '\.(java|kt|kts|xml)$|(^|/)\.gitignore$|^(\.githooks|scripts)/' || true + # The shell step excludes the keystore, which the scripts/ pattern above would let through. + names -- scripts/debug-keystore/adfa-keystore.jks + names --diff-filter=ADRCTUXB + git -c core.quotePath=false diff --summary | grep -E '^ mode change' || true + } | sort -u) if [ -n "$unexpected" ]; then echo "::error::spotlessApply changed files Spotless does not format; not committing:" echo "$unexpected"