4桁の数字にMM/DD形式の日付候補を追加する - #366
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
変更範囲が限定的で、仕様(全角対応・不正除外・0229許容・元数字保持)をカバーするテストが追加されており、候補注入の重複抑止も実装されています。
Pull request overview
4桁の数字入力(MMDD)から MM/DD 形式の月日候補を生成し、変換候補として提示できるようにするPRです。Core の変換候補生成(SegmentsManager)に月日候補の注入を追加し、全角/半角混在の数字入力や不正な月日の除外、年なしの 0229 許容をテストで担保しています。
Changes:
- 4桁数字(半角/全角/混在)を
MM/DDに変換するNumericDateShortcuts.monthDay(matching:)を追加 SegmentsManagerの候補生成後に、月日候補を重複なしでmainResultsに追加- 変換候補への反映・不正値除外・重複抑止・編集による出し入れをテスト追加(加えて README 記載)
File summaries
| File | Description |
|---|---|
| README.md | 4桁数字→月日候補(MM/DD)変換機能の説明を追記 |
| Core/Tests/CoreTests/InputUtilsTests/SegmentsManagerNumericDateTests.swift | SegmentsManager 経由で月日候補が提示・確定されること/不正除外/重複抑止を検証 |
| Core/Tests/CoreTests/InputUtilsTests/NumericDateShortcutsTests.swift | 数字正規化(全角・混在)と月日妥当性(0229 許容含む)を単体検証 |
| Core/Sources/Core/InputUtils/SegmentsManager.swift | 変換候補取得後に月日候補を注入(重複チェック付き) |
| Core/Sources/Core/InputUtils/NumericDateShortcuts.swift | 4桁の数字(ASCII/全角のみ)を MM/DD に変換するユーティリティを追加 |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bde291232
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let monthDay = NumericDateShortcuts.monthDay(matching: self.composingText.convertTarget), | ||
| !result.mainResults.contains(where: { $0.text == monthDay }) { | ||
| let candidate = Candidate( | ||
| text: monthDay, | ||
| value: -18, | ||
| composingCount: .surfaceCount(self.composingText.convertTarget.count), |
There was a problem hiding this comment.
Limit the date shortcut to the active conversion segment
When the user invokes segment editing on a four-digit composition, editSegment moves convertTargetCursorPosition to delimit the active prefix while convertTarget still contains all four digits. This condition therefore continues to add an MM/DD candidate, and its .surfaceCount(convertTarget.count) consumes the entire composition when selected instead of only the edited segment. Derive the shortcut reading and composing count from the active conversion prefix, or suppress this whole-input shortcut while segment editing is active.
Useful? React with 👍 / 👎.
|
これもAzooKeyKanaKanjiConverterのレイヤーで処理するのが適切なので、そのようにしたいです。 |
1111→11/11、0102→01/02の候補を追加します。全角数字にも対応し、元の数字を保持します。不正な月日は除外し、年を指定しない0229は許容します。
検証
月日境界・全角混在・候補選択と確定をテスト。
このブランチ単独で
swift test --package-path Core --jobs 4を実行し、Coreの78テストが成功しました。git diff --checkも成功しています。変換範囲と処理負荷
文節の変換範囲を縮めている間は全入力向けのMM/DD候補を追加しません。