Skip to content

fix(core-app): restore localized app display name indexing on macOS#254

Merged
TalexDreamSoul merged 2 commits intomasterfrom
codex/chinese-app-indexing-replacement
Apr 22, 2026
Merged

fix(core-app): restore localized app display name indexing on macOS#254
TalexDreamSoul merged 2 commits intomasterfrom
codex/chinese-app-indexing-replacement

Conversation

@TalexDreamSoul
Copy link
Copy Markdown
Contributor

@TalexDreamSoul TalexDreamSoul commented Apr 21, 2026

Summary

  • replace the old Fix: Improve Chinese app name indexing and search #226 branch with a scoped apps-search fix only
  • prefer Spotlight localized display names during fresh macOS app scans
  • normalize Chinese displayName pinyin keywords to lowercase for stable matching
  • sync the related plan docs for the replacement PR

Validation

  • pnpm -C "apps/core-app" exec vitest run "src/main/modules/box-tool/addon/apps/darwin.test.ts"
  • pnpm -C "apps/core-app" exec vitest run "src/main/modules/box-tool/addon/apps/app-provider.test.ts"
  • pnpm -C "apps/core-app" run typecheck:node (currently blocked by unrelated local AI module changes already present in the worktree, not by this diff)

Notes

Summary by CodeRabbit

  • Bug Fixes

    • Prioritize Spotlight display name when detecting macOS apps for more accurate results
    • Normalize Chinese pinyin keywords to consistent lowercase and dedupe/trim source names before keyword generation
    • Refined macOS app name fallback order (Spotlight > localized strings > plist > bundle)
  • Tests

    • Added tests covering macOS app info extraction and Chinese keyword generation behavior
  • Documentation

    • Updated changelog and docs to reflect the above fixes and test coverage

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 261f003c-b473-498c-a9cd-ce639fc9bbee

📥 Commits

Reviewing files that changed from the base of the PR and between 02c3483 and c6d0503.

📒 Files selected for processing (4)
  • apps/core-app/src/main/modules/box-tool/addon/apps/darwin.ts
  • docs/INDEX.md
  • docs/plan-prd/01-project/CHANGES.md
  • docs/plan-prd/TODO.md

📝 Walkthrough

Walkthrough

Adds Spotlight-based display name reading for macOS apps (via mdls), normalizes and reorders display-name selection to prefer Spotlight → localized → plist → bundle, trims/deduplicates name candidates for keyword generation, and lowercases pinyin transliterations; includes tests and documentation updates (timestamps advanced to 2026-04-21).

Changes

Cohort / File(s) Summary
App Provider Keyword Generation
apps/core-app/src/main/modules/box-tool/addon/apps/app-provider.ts, apps/core-app/src/main/modules/box-tool/addon/apps/app-provider.test.ts
Trim and deduplicate name candidates before generating keywords; pinyin outputs normalized to lowercase; added pinyin-pro mock and test asserting keyword set contains original Chinese and lowercase transliterations.
macOS App Info Discovery
apps/core-app/src/main/modules/box-tool/addon/apps/darwin.ts, apps/core-app/src/main/modules/box-tool/addon/apps/darwin.test.ts
Added normalizeDisplayNameCandidate() and getSpotlightDisplayName() (safe mdls read). Reordered display-name selection to prefer Spotlight, then localized, plist, bundle. Tests validate Spotlight precedence, command args, and cleanup of temp bundles.
Documentation & Metadata
docs/INDEX.md, docs/plan-prd/01-project/CHANGES.md, docs/plan-prd/TODO.md
Advanced timestamps to 2026-04-21; documented Spotlight-first display-name behavior, pinyin lowercase normalization, and added changelog/TODO entries referencing darwin.ts, app-provider.ts, and related tests.

Sequence Diagram

sequenceDiagram
    participant Test
    participant Darwin
    participant mdls as "mdls (System)"
    participant AppProvider
    participant Pinyin as "pinyin-pro"

    Test->>Darwin: getAppInfo(appPath)
    Darwin->>mdls: execFileSafe('mdls', ['-name','kMDItemDisplayName','-raw', appPath])
    mdls-->>Darwin: spotlight displayName (raw)
    Darwin->>Darwin: normalizeDisplayNameCandidate(spotlight)
    Darwin-->>Test: appInfo(displayName chosen by priority)

    Test->>AppProvider: _generateKeywordsForApp(appInfo)
    AppProvider->>AppProvider: trim & dedupe names
    AppProvider->>Pinyin: pinyin(displayName,{pattern:'full'}) / {pattern:'first'}
    Pinyin-->>AppProvider: pinyinFull / pinyinFirst
    AppProvider->>AppProvider: toLowerCase() pinyin results
    AppProvider-->>Test: returned Set<keywords>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Spotlight peeks where bundles hide,
Darwin trims the names with pride,
Pinyin hums in lowercase tune,
Keywords gather, soft as moon,
Tests hop in to keep things right. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: restoring localized app display name indexing on macOS through Spotlight integration and keyword normalization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/chinese-app-indexing-replacement

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/core-app/src/main/modules/box-tool/addon/apps/darwin.ts`:
- Around line 234-242: The localized fallback returned by
getLocalizedDisplayName is used raw in the displayName selection and can contain
malformed values like "(null)" or include ".app"; fix this by passing
localizedName through normalizeDisplayNameCandidate before using it in the
selection expression so the priority becomes spotlightName ||
normalizeDisplayNameCandidate(localizedName) ||
normalizeDisplayNameCandidate(plistDisplayName) ||
normalizeDisplayNameCandidate(bundleName); update the assignment that builds
displayName (and any related logic that consumes localizedName) to use the
normalized value instead of the raw localizedName.

In `@docs/INDEX.md`:
- Line 3: The index contains inconsistent future dates (lines referenced as 3,
26-28, 82-87) and a mismatched snapshot label; update all date occurrences and
the snapshot label in docs/INDEX.md to the correct, consistent publish date (use
2026-04-21) so every instance (header date, snapshot line, and any repeated
footer/meta dates) matches exactly; search for the string "2026-04-22" and the
snapshot "2026-04-20" and replace them with "2026-04-21" to align all entries.

In `@docs/plan-prd/01-project/CHANGES.md`:
- Around line 3-6: Update the future-dated changelog entries in CHANGES.md by
replacing the date string "2026-04-22" (both the metadata line "更新时间:
2026-04-22" and the section header "## 2026-04-22") with the correct current
date (e.g., "2026-04-21") or a date consistent with the repository's timezone
policy so the "近 30 天" window and section header are not set in the future.

In `@docs/plan-prd/TODO.md`:
- Line 4: The document's update timestamp ("更新时间: 2026-04-22") was changed but
the stats block still shows the old stats timestamp ("统计时间: 2026-04-20"), so
recalculate and update the stats metadata to match the new update date: locate
the stats section by searching for the "统计时间: 2026-04-20" string and replace it
with the correct recalculated date and any derived counts or percentages so the
stats block is consistent with the "更新时间: 2026-04-22" entry.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f91eff81-3c00-4ea2-9bf4-8c44b10aa6b9

📥 Commits

Reviewing files that changed from the base of the PR and between 451b321 and 02c3483.

📒 Files selected for processing (7)
  • apps/core-app/src/main/modules/box-tool/addon/apps/app-provider.test.ts
  • apps/core-app/src/main/modules/box-tool/addon/apps/app-provider.ts
  • apps/core-app/src/main/modules/box-tool/addon/apps/darwin.test.ts
  • apps/core-app/src/main/modules/box-tool/addon/apps/darwin.ts
  • docs/INDEX.md
  • docs/plan-prd/01-project/CHANGES.md
  • docs/plan-prd/TODO.md

Comment thread apps/core-app/src/main/modules/box-tool/addon/apps/darwin.ts
Comment thread docs/INDEX.md Outdated
Comment thread docs/plan-prd/01-project/CHANGES.md Outdated
Comment thread docs/plan-prd/TODO.md Outdated
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 21, 2026

Deploying tuff with  Cloudflare Pages  Cloudflare Pages

Latest commit: c6d0503
Status:⚡️  Build in progress...

View logs

@TalexDreamSoul TalexDreamSoul merged commit c5231a7 into master Apr 22, 2026
2 of 4 checks passed
@TalexDreamSoul TalexDreamSoul deleted the codex/chinese-app-indexing-replacement branch April 22, 2026 04:01
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.

1 participant