Skip to content

feat: 静的 const コンテナの値変更を情報提供へ分類する - #34

Merged
owayo merged 1 commit into
mainfrom
feat/issue-29-static-const-values
Oct 8, 2026
Merged

owayo merged 1 commit into
mainfrom
feat/issue-29-static-const-values

Conversation

@owayo

@owayo owayo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

型注釈のない export const の静的 object / array で葉の値だけを変えると、従来は api.mod と利用側の impact が hook を停止していました。同じ構造の値変更を既存の const_value_changes に分類し、通常モードでは情報提供、--strict-public-const-values では確認を求めて停止します。

  • 元ソースの AST でキー順序・配列の長さと添字・値の型・as const の位置を比較します。動的な値、spread、computed key、重複キー、型注釈、タグ付き JSDoc、曖昧な宣言や解析失敗は従来の判定を維持します。
  • 値トークンも同じ整形差は API 変更として報告せず、その証拠で hook の利用側 impact も通常・厳格の両モードで情報提供へ分類します。
  • 相談レビューで指摘された as const の派生リテラル型は変わり得るため、これはコンパイル互換性の保証ではなく値変更ポリシーです。派生型を含む回帰ケースとモデルの説明でこの境界を明示しました。

検証: 専用 unit 7 件、既存 hook unit 30 件、CLI 回帰 4 件、fmt、clippy、AST impact 検査。引用符だけを変える追加テストは修正前の失敗も確認しました。ローカルの全体検査は時間上限で途中終了したため、全体の最終判定はこの PR の GitHub Actions で行います。

Closes #29

型注釈のない const の object と array を元ソースの AST で比較し、
キー順序、配列構造、値型、as const の位置が同じ場合に既存の値変更へ分類する。
動的な値や曖昧な宣言は従来の判定を維持する。
通常モードと厳格モード、および危険な変更の回帰テストを追加する。
値トークンが同じ整形差は報告せず、as const の派生型について互換性を保証しないことを明記する。
@owayo owayo self-assigned this Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1250db8d-2e82-4b06-8469-baf21c98e40a
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@owayo
owayo merged commit 9b3d113 into main Oct 8, 2026
9 checks passed
@owayo
owayo deleted the feat/issue-29-static-const-values branch October 8, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant