Skip to content

Re-enable CodeQL once its Kotlin extractor supports Kotlin 2.4.20 #7

Closed

Description

@YangtseSu

Context

CodeQL static-analysis workflow (.github/workflows/codeql.yml) is paused (if: false, manual dispatch only).

The repo tracks latest-stable Kotlin (no-pin policy, AGENTS.md). CodeQL's Kotlin extractor rejects the current Kotlin with:

KotlinVersionTooRecentError: Kotlin version 2.4.20 is too recent.
CodeQL currently supports versions below 2.4.20

Verified against the latest codeql-action bundle v2.27.0 (2026-09-10). Downgrading Kotlin to satisfy CodeQL conflicts with the no-pin policy, so the workflow stays off until the extractor catches up.

Re-enable checklist

  • Confirm CodeQL supports Kotlin ≥ 2.4.20 (codeql-action release notes / a test run)
  • Restore on: triggers (push to main, pull_request, weekly schedule) in .github/workflows/codeql.yml
  • Remove the if: false guard
  • Verify a push run goes green (autobuild must not hit KotlinVersionTooRecentError)

Already covered independently

Secret scanning + push protection are enabled repo-wide and do not depend on CodeQL.

Activity

  1. YangtseSu commented on Sep 16, 2026

    @YangtseSu
    OwnerAuthor

    结论:今天还不行,等 CodeQL 2.27.1 稳定版(上游 ETA ≈ 2026-09-24)

    用本 issue 自己的 workflow 正文(只改 tools:)对同一个 Kotlin 2.4.20 的提交跑了两次 A/B:

    使用的 bundle Autobuild 结果
    codeql-bundle-v2.27.0(最新稳定,2026-09-09) ❌ KotlinInterceptor$KotlinVersionTooRecentError: Kotlin version 2.4.20 is too recent. CodeQL currently supports versions below 2.4.20
    codeql-bundle-20260915(nightly,CLI 2.27.1+20260914) ✅ 编译通过、database finalize 导入 TRAP、分析完成;全日志 KotlinVersionTooRecent 出现 0 次

    差异只在 bundle,Kotlin 版本相同,所以判定权完全在 CodeQL 一侧。

    根因:github/codeql#22404(Kotlin: support 2.4.20)2026-09-08 才合入,比 2.27.0 的发版切点晚一天,因此进了 2.27.1。上游维护者 @redsun82 在该 issue 下的回复:

    …missed the release cut for CodeQL 2.27.0. This unfortunately means support will only land in 2.27.1, approximately two weeks from now.

    (2.27.0 的 supported-versions-compilers.rst 仍写 Kotlin 1.8.0 to 2.4.1x;main 上已改为 2.4.20——即修复已进主线、未进稳定包。)

    检查清单更新

    • 确认上游支持状态 —— 已确认:修复已合入,随 2.27.1 发布(nightly 实测通过,稳定 2.27.0 实测失败)
    • 等 稳定 bundle ≥ 2.27.1 发布后:恢复 on: 触发器(push main / pull_request / 每周 schedule)
    • 删除 if: false
    • 跑一次确认绿(Autobuild 不再报 KotlinVersionTooRecentError)

    顺带修掉一个会让「重新启用」当场失败的坑

    该 workflow 的 Set up Android SDK 仍在用 setup-android 的默认 packages: tools platform-tools,而 tools 这个独立包已被 Google 下线(并入 cmdline-tools)——sdkmanager tools 会 Failed to find package 'tools' 并以 exit 1 在任何仓库代码运行之前挂掉。同一缺陷此前已分别修过 build.yml(8739504)与 release.yml(15c7e1f),只剩这一个文件没跟上。已在 5dcc93a 一并收窄为 packages: platform-tools,否则将来恢复触发器时会看到一个形似「CodeQL 又坏了」实则 SDK 安装失败的报错。

    当前不改触发器:为约 8 天把 nightly bundle 钉进 CI 不值得,保持「latest-stable Kotlin 优先于 CodeQL 覆盖」的既有决定;密钥扫描 + push protection 仍在独立生效。

    到 2026-09-24 前后我可以直接完成剩余三项并关掉本 issue。

  2. YangtseSu commented on Sep 16, 2026

    @YangtseSu
    OwnerAuthor

    补充:重新启用所需的其余改动已预先落地并演练通过

    在 09e7bb4 中把本 workflow 的三处 codeql-action 由 @v3 升到 @v4(v3 于 2026-12 弃用;本仓库 Renovate 只管 Gradle,action 版本需手工升)。

    演练方式(一次性分支,已删除):用本文件启用后的原样跑一遍——真实 push 触发器、无 if: false、@v4 action、以 nightly bundle 顶替尚未发布的稳定 2.27.1:

    ✅ Set up job / Checkout / Initialize CodeQL / Set up JDK 26
    ✅ Set up Android SDK
    ✅ Autobuild            (:app:compileDebugKotlin、:app:compileReleaseKotlin 正常抽取)
    ✅ Perform CodeQL Analysis(Importing TRAP files → Successfully uploaded results)
    

    全日志 KotlinVersionTooRecent 出现 0 次。

    因此 2.27.1 发布后的剩余动作只有两步、且已被证明可过:

    • 恢复 on: 触发器(push main / pull_request / 每周 schedule)
    • 删除 if: false 并跑一次确认绿

    Set up Android SDK 的 packages: platform-tools 与 @v4 已在 main 上就位,届时不必再改。

  3. YangtseSu commented on Sep 29, 2026

    @YangtseSu
    OwnerAuthor

    已完成:CodeQL 重新启用并跑绿

    稳定包 codeql-bundle-v2.27.1 于 2026-09-22 发布(早于上文预计的 2026-09-24),于是按本 issue 的两步清单收尾。

    改动

    • 19c0c85 —— 恢复 on: 触发器(push main / pull_request / 每周一 04:21 UTC schedule),删除 if: false;文件头注释从「currently PAUSED」改写为暂停窗口 + 本次重新启用的依据,两处 step 细节(SDK 的 packages: platform-tools、三个 step 的 @v4)原样保留。

    证据

    • @v4 当前解析到 v4.38.2,其发布说明即 Update default CodeQL bundle version to 2.27.1;本次运行日志确认实际使用的就是 codeql-bundle-v2.27.1。
    • Run 36578621419(push main,commit 19c0c85):Analyze (java-kotlin) 全部 step success —— Initialize CodeQL / Autobuild / Perform CodeQL Analysis(日志含 Successfully uploaded results)—— Autobuild 不再抛 KotlinVersionTooRecentError。
    • 全日志 KotlinVersionTooRecent 出现 0 次。
    • 同一次 push 的常规 CI(36578621540,含 API 33 模拟器上的 instrumentation 测试)同样 success。

    清单

    • 确认 CodeQL 支持 Kotlin ≥ 2.4.20(稳定包 2.27.1,实测通过)
    • 恢复 on: 触发器(push main / pull_request / 每周 schedule)
    • 删除 if: false
    • 跑一次确认绿(Autobuild 无 KotlinVersionTooRecentError)

    密钥扫描 + push protection 不受影响,照旧独立生效。日后 Kotlin 若再次跑到 extractor 之前,仍按同样方式暂停(if: false + workflow_dispatch),不要把 Kotlin 钉回去。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions