Skip to content

fix(for-each-ref): upstream/push strip modifiers + strip signature for trailers (#86) - #94

Merged
mizchi merged 4 commits into
mainfrom
claude/bold-mendel-2d7ygx
Jun 22, 2026
Merged

fix(for-each-ref): upstream/push strip modifiers + strip signature for trailers (#86)#94
mizchi merged 4 commits into
mainfrom
claude/bold-mendel-2d7ygx

Conversation

@mizchi

@mizchi mizchi commented Jun 22, 2026

Copy link
Copy Markdown
Member

A. for-each-ref 修正 (#86)

t6300-for-each-ref.sh を実ビルド(git 2.53 + bit native + strict shim)で検証し、失敗 28 → 13(15件修正・リグレッション0、合格 400 → 415)

  • %(upstream:...)/%(push:...) の引数バリデーション: lstrip=/strip=/rstrip=nobrackettrack,nobracket 等のカンマ結合トークンを、レンダラは対応済みなのにバリデーションが弾いていた。カンマ分割して各トークンを検証(→ t6300 20–25, 28–33, 238, 239)。
  • %(trailers)/%(contents:trailers): 署名付きタグで PGP/SSH 署名ブロックを含む全文を trailer 解析していたため署名本文が偽 trailer として出力されていた。署名 armor より前のメッセージで解析(→ t6300 411)。

残り13件は別機能(GPG %(signature) 検証 420–428、describe atom 252/255/256、GPG署名body/CRLF 317/409)。

B. bleeding-edge ツールチェーン起因のCI破損対策

最新 MoonBit ツールチェーンによる破損が連続したため対応(いずれも本PRと無関係の上流変更で main にも影響)。

  1. $|/#| 混在 lint [0063]: upload_pack_process.mbt の partial-clone config テンプレを全行 $| に統一(静的行に \/\{ 無し→出力バイト一致、native build で確認)。
  2. moon test の作業ディレクトリ変更 (0.1.20260618): bit_pack の repo-root 相対 fixture (fixtures/*.pack) が読めず 6/72 失敗。read_fixture_bytes を親ディレクトリ上方探索で解決するよう変更し、test CWD に非依存化。

ツールチェーン固定は不採用(調査結果)

固定も検討したが断念:

  • MoonBit の installer は latest/nightly しか取得不可(CDN はバージョン指定で 403)。
  • nix overlay 経由の固定(rev 96727d9 = moon 0.1.20260608)は build/CWD は良好だが、overlay の native runtime が不完全tcc: undefined symbol __mzerodf)で bitx_hub 等の native test がリンク失敗。curl 版 June-08 では同テスト 113/113 通過するため overlay packaging 固有の欠陥。

→ CI は素の curl install(latest) に戻し、唯一壊れていた bit_pack を CWD 非依存化することで上流退行を吸収。

検証

  • bit_pack native test を moon 0.1.20260618(現 latest)で 72/72 passed(修正後)
  • t6300-for-each-ref.sh 28 → 13 failures(新規失敗なし)
  • ワークフローは固定前(curl install)へ復元(差分は実質 lint + テスト修正のみ)

🤖 Generated with Claude Code

https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM

claude added 4 commits June 22, 2026 13:14
…nature for trailers (#86)

t6300-for-each-ref.sh progress: 28 -> 13 failures (15 fixed, no regressions).

Two fixes:

1. %(upstream:...) / %(push:...) argument validation rejected the ref-strip
   modifiers (lstrip=/strip=/rstrip=), the `nobracket` token, and
   comma-combined tokens like `track,nobracket`, even though the renderer
   already handled them. Validation now splits the argument on commas and
   accepts each token, matching git. Fixes t6300 cases 20-25, 28-33, 238, 239.

2. The %(trailers) / %(contents:trailers) atoms parsed trailers from the full
   message including the PGP/SSH signature block, so signed tags emitted the
   signature body as bogus trailers. Trailer parsing now runs on the message
   with the signature stripped (lines before the signature armor), matching
   git. Fixes t6300 case 411.

Remaining t6300 failures are separate features: GPG %(signature) verification
(420-428), the describe atom algorithm (252, 255, 256), and GPG-signed
body/CRLF edge cases (317, 409).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM
Second bleeding-edge toolchain break after the async [3002] one: the newest
MoonBit compiler added syntax_lint [0063], which errors under `moon check
--deny-warn` when a multi-line string literal mixes `$|` and `#|` prefixes.
CI installs the toolchain via `curl ... | bash` (always latest), so this broke
the `test` job on main and every PR.

Two changes:

1. upload_pack_process.mbt: the partial-clone config template mixed `#|`
   (static) and `$|` (interpolated) lines in one literal. Converted all lines
   to `$|`; the static lines contain no backslash/`\{`, so the emitted config
   is byte-identical. Verified with `moon build --target native`.

2. Pin the toolchain. MoonBit's installer only fetches `latest`/`nightly`
   (cli.moonbitlang.com returns 403 for version strings — no real pinning), so
   a new composite action `.github/actions/setup-moon` caches ~/.moon
   (toolchain only; `moon update` still refreshes the registry) keyed by a
   `pin` marker. The toolchain is frozen to whatever was current when `pin`
   was last bumped; bump it to upgrade intentionally. Wired into every Unix
   install across ci/js-build/pages-demo/git-compat-random/copilot-setup/
   release. The Windows install and nix-build (already overlay-pinned) are
   unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM
The curl-installer + actions/cache approach could only freeze "latest at
first run", which captured 0.1.20260618 — a build whose `moon test` changed
the working directory and broke bit_pack's repo-root-relative fixtures
(6/72 failures). MoonBit's installer cannot fetch a specific version
(cli.moonbitlang.com serves only latest/nightly).

Switch setup-moon to install the toolchain from moonbit-overlay pinned to
rev 96727d9, which provides moon 0.1.20260608 — the last build before the
CWD regression. Verified locally (via nix profile install of that rev):
`moon build --target native` is clean and `moon test -p mizchi/bit_pack`
passes 72/72. The action reuses the existing setup-nix (Nix install + store
cache) and adds ~/.nix-profile/bin to PATH. Bump `overlay-rev` to upgrade
the toolchain deliberately after re-validation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM
…toolchain pin

moon 0.1.20260618 changed the working directory `moon test` runs the native
test binary from, so bit_pack's repo-root-relative "fixtures/*.pack" reads
failed (6/72). Make read_fixture_bytes walk up parent directories until the
fixture path resolves, so it works regardless of the test CWD (verified with
moon 0.1.20260618: bit_pack 72/72).

This removes the need to pin the toolchain (the nix-overlay pin was reverted:
the overlay's native runtime is incomplete — `tcc: undefined symbol __mzerodf`
breaks native tests like bitx_hub — and MoonBit's installer cannot fetch a
specific known-good version). CI returns to the plain curl install of latest;
the only remaining toolchain-compat change kept is the $|/#| lint fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM
@mizchi
mizchi merged commit b8b3e0d into main Jun 22, 2026
16 of 17 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.

2 participants