Skip to content

Audit fixes: only treat Apple input sources as Pinyin, bypass game sub-categories, keep key order; send keystrokes held during a source switch to the app they were typed in - #7

Merged
TW527E merged 3 commits into
mainfrom
audit/2026-11-15
Nov 16, 2026

Conversation

@TW527E

@TW527E TW527E commented Nov 16, 2026

Copy link
Copy Markdown
Owner

變更

fix: only treat Apple input sources as Pinyin, bypass game sub-categories, keep key order

  • Third-party Pinyin input methods are no longer mistaken for Apple
    Pinyin, so their own Shift+Space shortcut is passed through.
  • Apps in per-genre game categories (action-games, ...) are bypassed.
  • A shortcut typed right after held text is released behind that text
    instead of overtaking it.

fix: send keystrokes held during a source switch to the app they were typed in

If another app came to the front during the up-to-0.6 s confirmation
window, the held keys were posted to the session and landed in the new
app. The frontmost PID is recorded when holding starts; an app change
releases the held keys at once to that PID (dropped if it quit).

驗證

只做了 swiftc -parse 語法檢查;未在 macOS 編譯或實測。

🤖 Generated with Claude Code

TW527E and others added 2 commits November 15, 2026 10:39
…ries, keep key order

- Third-party Pinyin input methods are no longer mistaken for Apple
  Pinyin, so their own Shift+Space shortcut is passed through.
- Apps in per-genre game categories (action-games, ...) are bypassed.
- A shortcut typed right after held text is released behind that text
  instead of overtaking it.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
… typed in

If another app came to the front during the up-to-0.6 s confirmation
window, the held keys were posted to the session and landed in the new
app. The frontmost PID is recorded when holding starts; an app change
releases the held keys at once to that PID (dropped if it quit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 05:07

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T06:14:26.129726Z 408d00b Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b3663fe5e

ℹ️ 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".

Comment on lines +102 to +105
func frontmostApplicationDidChange() {
guard deferredEvents != nil else { return }
deferralGeneration += 1
finishDeferringInput()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve deferral during the internal focus hand-off

When switching to a CJKV source without a native indicator, InputSourceManager.refreshFocusedInputContext deliberately activates ShiftIME and then restores the original app, waiting for that app to regain focus before completing the switch. That internal activation now invokes this method through the workspace observer and flushes the buffered keys immediately, before the hand-off finishes. Consequently, typing during this fallback can replay text to the background app before its input context adopts the new source, defeating the existing protection against Latin output. Distinguish this internal activation from a user-initiated app change and retain the buffer until the switch completion.

Useful? React with 👍 / 👎.

public static func isApplePinyin(id: String, localizedName: String) -> Bool {
let normalizedID = id.lowercased()
let normalizedName = localizedName.lowercased()
guard normalizedID.hasPrefix("com.apple.inputmethod.") else { return false }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Align the existing classifier checks with the new restriction

Running make test fails with FAILED: Traditional Pinyin keyboard layout activation is recognized: Scripts/StateMachineChecks.swift still expects com.apple.keylayout.TraditionalPinyinKeyboard to be accepted, but this guard rejects it. The build job in .github/workflows/build-dmg.yml runs these checks before building the universal DMG, so this change blocks packaging. Update the check if rejecting that layout is intentional, or preserve its classification if it remains supported.

Useful? React with 👍 / 👎.

…hiftIME's own focus hand-off

- The Apple-only check also rejected com.apple.keylayout.* sources such
  as TraditionalPinyinKeyboard, failing the state machine checks in CI.
- Activating ShiftIME itself (and then the original app) to refresh the
  input context no longer counts as an app change, so held keys are not
  flushed before the switch completes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TW527E

TW527E commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 408d00b205

ℹ️ 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".

@TW527E
TW527E merged commit 15a147d into main Nov 16, 2026
3 checks passed
@TW527E
TW527E deleted the audit/2026-11-15 branch November 16, 2026 09:26
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