Skip to content

fix(hooks): upgrade clang-format to 15.0.6 - #322

Merged
SigureMo merged 1 commit into
redai-studio:mainfrom
ShigureNyako:session/sess_dev_neko_upgrade_relax_clang_format_pre_commit_hook_to_15
Sep 17, 2026
Merged

SigureMo merged 1 commit into
redai-studio:mainfrom
ShigureNyako:session/sess_dev_neko_upgrade_relax_clang_format_pre_commit_hook_to_15

Conversation

@ShigureNyako

@ShigureNyako ShigureNyako commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

What

Bump pre-commit/mirrors-clang-format from v14.0.6 to v15.0.6. This is a one-line hook revision change; no source files, other hooks, dependencies of Relax, or CI workflows change.

Why

Remove the hook's Rosetta dependency on Apple Silicon:

  • The 14.0.6 PyPI wheel is named clang_format-14.0.6-py2.py3-none-macosx_10_9_universal2.whl, but its bundled executable is x86_64 only. Forcing native execution with arch -arm64 …/clang_format/data/bin/clang-format --version fails with Bad CPU type in executable.
  • The 15.0.6 PyPI wheel, also tagged macosx_10_9_universal2, contains both x86_64 and arm64. The same native execution check succeeds. Inspecting the actual executable matters: the wheel tag alone is insufficient evidence.
  • 15.0.6 includes the packager's missing-arm64 fix (#59) and libzstd linkage fix (#58). The maintainer confirmed their PyPI 15.0.6 release after successful Apple Silicon testing in issue #56. This is a bounded upgrade to a verified fix, not an unrelated jump to the latest formatter.
  • The LLVM 15.0.6 release independently provides an arm64-apple-darwin21.0 archive. The hook uses ssciwr's published PyPI wheel, not an LLVM-published Python wheel or that release archive.

This addresses the architecture mismatch relevant to macOS 27 machines without usable Rosetta. Local execution was tested on macOS 26.6.2 arm64, not macOS 27; this PR does not claim an OS-specific macOS 27 validation or that every Apple Silicon machine fails with 14.0.6. The old hook works on this host through Rosetta.

How

The v15.0.6 mirror pins clang-format==15.0.6. Its hook manifest is identical to v14.0.6: Python environment, clang-format -i, -style=file, the same file types and minimum pre-commit version. The existing transfer_queue/ exclusion is unchanged. There is no repository .clang-format/_clang-format, so the LLVM fallback style remains in use.

LLVM 15 changes some C++ concepts/requires formatting defaults, so this is not a promise that versions 14 and 15 format all future code identically. For all 10 currently hook-selected tracked files (eight JSON, one JavaScript, one CUDA), both versions' formatted output is byte-identical to the checked-in file. Formatting delta: zero files; no bulk reformatting.

Testing

  • pre-commit run --all-files --show-diff-on-failure passes: all 15 hooks, before and after the upgrade, using uv run --no-project --python 3.10 --with pre-commit … (matching CI's Python minor version).
  • prek run --all-files --show-diff-on-failure passes: all 15 hooks with prek 0.5.2.
  • Both runners' config validation passes; git diff --check passes.
  • Native arm64 executable/version smoke test; 14-versus-15 byte comparisons for all 10 selected files; native --dry-run --Werror -style=file passes for the JavaScript and CUDA files.
  • PR CI Pre-commit Checks passes on Ubuntu / Python 3.10.
  • PR CI Python 3.10/3.11/3.12 tests pass: 1,833 passed, 426 skipped on each version. Python 3.10 passed on rerun at the unchanged head; the first attempt hit a captured-log assertion in test_streaming_dataset_missing_media_skip_refills_batch[prefetch]. No unrelated test changes were made. Not run locally for this configuration-only change. Multi-node GPU integration tests are not run: no GPU cluster is available.
  • New tests / documentation: not applicable; existing hook execution and direct binary/format comparisons validate the change.

Validation caveats, intentionally not mixed into this PR:

  • Both 14.0.6 and 15.0.6 report a no-op JSON replacement (offset=0, length=0, empty text) under --dry-run --Werror, despite identical formatted bytes. JSON validation therefore uses output comparison and the actual -i hook; this is not a new regression.
  • A separate default-Python-3.14 pre-commit environment setup fails while building existing docformatter==1.3.1 (ast.Constant.s). Running pre-commit with Python 3.10 passes; prek also passes (its docformatter environment uses Python 3.10). No unrelated docformatter changes are included.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • CI/CD or build changes

Screenshots / Logs

14.0.6: Mach-O 64-bit executable x86_64
arch -arm64: Bad CPU type in executable

15.0.6: Mach-O universal binary with 2 architectures: x86_64, arm64
arch -arm64: clang-format version 15.0.6

Full pre-commit: 15 passed
Full prek:       15 passed
Format delta:   0 / 10 hook-selected files
PR diff:        .pre-commit-config.yaml | 2 +-

@Yangruipis Please review this hook-only upgrade.

# 🐛 Bug Fix

- Use the 15.0.6 macOS wheel with native arm64 support instead of the
  x86_64-only binary shipped in the 14.0.6 universal2 wheel.
- Preserve the hook manifest, file selection and formatting defaults.
- Verify full pre-commit/prek runs and zero format delta on all ten
  currently matched files; leave unrelated formatters unchanged.
@rai-studio-bot

rai-studio-bot commented Sep 17, 2026

Copy link
Copy Markdown

Nyanpasu 审查看板

审查状态: ✅ 已通过

审查版本: eb1a9a19650538a4928f1a3afaa637f93fc39e67

已完成审查:仅将 clang-format hook 从 v14.0.6 升级到 v15.0.6。两版 manifest 行为一致,受选中的 10 个文件格式零差异,未发现阻塞或需修改的问题。CI 结果:Pre-commit 检查通过;Python 3.10 测试套件有 1 例失败(tests/engine/sft/dataset/test_streaming.py::test_streaming_dataset_missing_media_skip_refills_batch[prefetch],日志显示告警实际已输出但 prefetch 后台线程下未被 captured_warnings 捕获),与本仅配置变更无关,属该测试的日志捕获时序问题。

没有未解决的审查问题。

Powered by Nyanpasu with claude-opus-5-google[1m] medium, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

仅将 pre-commit/mirrors-clang-format 的 rev 从 v14.0.6 升到 v15.0.6,无其他改动。

已核验:

  • v14.0.6 与 v15.0.6 的 hook manifest 行为一致(entrytypes_orargs: -style=fileminimum_pre_commit_version 均相同),仅 clang-format 版本不同。
  • 当前受该 hook 选中的 10 个已跟踪文件(8 JSON、1 JS、1 CUDA)与 PR 描述一致;仓库无 .clang-format,沿用 LLVM fallback 风格。
  • 变更符合最小改动原则,PR 描述对格式零差异、原生 arm64 分发等已给出充分证据。

未见阻塞性或需修改的问题。Python 测试 CI 仍在运行中,与本配置变更无直接关系。

Powered by Nyanpasu with claude-opus-5-google[1m] medium, please check the suggestions carefully.

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@SigureMo
SigureMo enabled auto-merge (squash) September 17, 2026 07:59
@SigureMo
SigureMo merged commit de21921 into redai-studio:main Sep 17, 2026
7 of 8 checks passed
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.

3 participants