Skip to content

i18n CI: diff a push against the tip before it, not against itself - #2329

Merged
ryanbr merged 1 commit into
mainfrom
docs/i18n-workflow-comment
Sep 19, 2026
Merged

ryanbr merged 1 commit into
mainfrom
docs/i18n-workflow-comment

Conversation

@ryanbr

@ryanbr ryanbr commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #524, which made --ci exempt any violation already present at the base ref. That is what stops a regression on main red-flagging every open PR, and it also made the base ref decide the verdict. The push path was still resolving it the old way.

The problem

On a push, github.base_ref is empty and the fallback resolved to origin/main, which is the pushed commit. That run compared the tree against itself and could never fail.

Not abstract. Per this file's own header, the push trigger exists because a release pushes straight to main with no PR, and appchangelog-gen.py emits the What's New title as a raw Kotlin literal that has to be localized by hand. Auditing the push is how that gets caught the moment it lands.

I simulated exactly that, planting the real 11.8.0 What's New title as the literal:

base = origin/main (the pushed commit)   exit 0   slips through
base = github.event.before               exit 1   FAIL 1 new hardcoded literal(s)
    android/.../SleepScreen.kt:1631: 'A gym log book on your wrist, a Coach you can switch off'

The change

A push now diffs against github.event.before, the tip before the push, which spans every commit the push carried rather than only the last one. A pull request is unchanged: it still diffs against the branch it targets.

event.before is all zeros on a branch's first push and absent on a manual run. Neither can be diffed, so both fall back to HEAD~1: narrower, but still a real comparison rather than a self-comparison. All three paths were exercised locally.

On the comment

This started as a comment-only PR saying the push run was inert. Merging that and fixing the behaviour separately would have left main carrying a comment that was false the moment the fix landed, which is the exact failure this PR set out to correct. So the fix and its description travel together, and the comment now describes the behaviour as it is.

It also records that fetch-depth: 0 is load-bearing: the audit reads the base through git show, so a shallow clone misses every lookup. Verified that direction fails safe, by committing a violation and running with a deliberately broken ref: nothing is exempt, so the gate fails loudly rather than passing.

@ryanbr
ryanbr force-pushed the docs/i18n-workflow-comment branch from c528da2 to 5b0aded Compare September 19, 2026 01:16
#524 made `--ci` exempt any violation already present at the base ref, which is what
stops a regression on main red-flagging every open PR. It also made the base ref
decide the verdict, and the push path was still resolving it the old way.

On a push, `github.base_ref` is empty and the fallback resolved to `origin/main`,
which IS the pushed commit. That run compared the tree against itself and could
never fail.

This is not abstract. The push trigger exists, per this file's own header, because a
RELEASE pushes straight to main with no PR and `appchangelog-gen.py` emits the
What's New title as a raw Kotlin literal that has to be localized by hand. Auditing
the push is how that gets caught the moment it lands. Simulated exactly that, using
the real 11.8.0 title as the planted literal:

    base = origin/main (the pushed commit)   exit 0   slips through
    base = github.event.before               exit 1   FAIL 1 new hardcoded literal
      android/.../SleepScreen.kt: 'A gym log book on your wrist, a Coach you can
      switch off'

So a push now diffs against `github.event.before`, the tip before the push, which
spans every commit the push carried rather than only the last one. A pull request is
unchanged: it still diffs against the branch it targets.

`event.before` is all zeros on a branch's first push and absent on a manual run.
Neither can be diffed, so both fall back to `HEAD~1`: narrower, but still a real
comparison rather than a self-comparison. All three paths exercised locally.

The comment now describes the behaviour as fixed rather than as broken, so main
never carries a note saying this run is inert.
@ryanbr
ryanbr force-pushed the docs/i18n-workflow-comment branch from 5b0aded to b4f454d Compare September 19, 2026 01:18
@ryanbr ryanbr changed the title CI: say that the i18n gate's base ref now decides the verdict i18n CI: diff a push against the tip before it, not against itself Sep 19, 2026
@ryanbr
ryanbr merged commit b817102 into main Sep 19, 2026
2 checks passed
@ryanbr
ryanbr deleted the docs/i18n-workflow-comment branch September 19, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant