Skip to content

custom phrase paging#384

Merged
eagleoflqj merged 3 commits into
masterfrom
customphrase
Jun 21, 2026
Merged

custom phrase paging#384
eagleoflqj merged 3 commits into
masterfrom
customphrase

Conversation

@eagleoflqj

@eagleoflqj eagleoflqj commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Custom Phrase editor now supports pagination, including page navigation controls and adjustable page size.
    • Sheet UI improvements: context-aware “Close” behavior, added accessibility identifiers, and increased Custom Phrase sheet height.
  • Bug Fixes

    • Custom Phrase list now refreshes correctly on presentation and edits affect only the active page.
  • Tests

    • Expanded automated custom-phrase UI coverage (pagination, add/edit/remove, save/reload).
    • Updated input and toggle state checks to use shared helpers for more consistent verification.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 04ac3fed-f8a8-4fb9-a734-a16950602187

📥 Commits

Reviewing files that changed from the base of the PR and between 960232d and d67343b.

📒 Files selected for processing (1)
  • appium/test_custom_phrase.py

📝 Walkthrough

Walkthrough

Adds pagination support to CustomPhraseView with page-size controls and accessibility identifiers. Introduces an isSheet flag to FooterView to switch the Close button's accessibility identifier between CloseSheet and Close. Renames get_switch_state to get_boolean_value, adds double_click and close_sheet Appium utilities, and adds a full test_custom_phrase Appium test. The fcitx5 submodule reference is bumped.

Changes

CustomPhrase Pagination, FooterView isSheet, and Appium Tests

Layer / File(s) Summary
FooterView isSheet property and call-site updates
src/config/FooterView.swift, src/config/Advanced.swift, src/config/InputMethod.swift, src/config/SplitConfig.swift, src/config/ExternalView.swift
FooterView gains isSheet: Bool; the Close button's accessibilityIdentifier is conditionally CloseSheet or Close. All non-sheet call sites pass isSheet: false; ExternalView's dialog sheet passes isSheet: true.
CustomPhraseView pagination implementation
src/config/CustomPhrase.swift, src/config/ExternalView.swift
CustomPhraseView gains pageSize/currentPage state, totalPages/currentPageSlice computed helpers, paginated list rendering, prev/next buttons, and an editable page number field. Add-item moves to the last page; Remove-items clamps currentPage. Accessibility identifiers added to Reload, Save, Close, and Remove controls. refreshItems() is called in .onAppear. ExternalView removes the manual refreshItems() call and tags the sheet.
Appium utility rename and new helpers
appium/util/boolean.py, appium/util/button.py, appium/util/window.py, appium/test_boolean.py, appium/test_group.py, appium/test_add_input_methods.py, appium/test_entry.py
get_switch_state renamed to get_boolean_value. double_click helper added using execute_script. close_sheet helper added using find_element_by_id. Existing tests updated to use the new names.
Test fixture setup and CustomPhrase Appium test
appium/conftest.py, appium/test_custom_phrase.py
conftest.py adds a test_custom_phrase data initialization branch (21 custom phrase mappings) and inserts pkill -9 FcitxTestApp before Appium server start. test_custom_phrase.py covers the full CustomPhraseView flow: initial state, pagination, page-size editing, CRUD, field editing with double-click, save persistence, reload-from-disk, and sheet close.

fcitx5 Submodule Update

Layer / File(s) Summary
fcitx5 submodule bump
fcitx5
The fcitx5 subproject commit pointer is updated to a new hash.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Hop, hop, through pages we go,
Custom phrases lined up in a row.
isSheet flips the button's name,
double_click and close_sheet join the game.
The rabbit tests each page with care—
Reload, save, and poof! The sheet's bare. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.75% 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 'custom phrase paging' clearly and directly describes the main change: adding pagination functionality to the CustomPhrase feature, which is the primary focus of the changeset as evidenced by the extensive modifications to CustomPhrase.swift, the new test_custom_phrase.py test, and supporting utility changes.
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 customphrase

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
appium/test_custom_phrase.py (1)

107-108: ⚡ Quick win

Stabilize sheet-close verification with an explicit wait and helper reuse.

Lines 107-108 assert immediately after click; sheet dismissal is asynchronous and may intermittently fail. Reuse close_sheet and wait until Keyword fields disappear.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@appium/test_custom_phrase.py` around lines 107 - 108, Replace the direct
click on the CloseSheet element with a call to the close_sheet helper function
to properly handle sheet dismissal. Instead of immediately asserting that
Keyword elements count is zero after the click, add an explicit wait that polls
until all Keyword elements disappear before performing the assertion. This
ensures the asynchronous sheet dismissal completes before verification,
eliminating intermittent failures.
appium/conftest.py (1)

81-81: ⚡ Quick win

Use graceful pre-cleanup instead of unconditional SIGKILL.

Line 81 force-kills all FcitxTestApp processes, which is brittle in shared/parallel test environments. Prefer graceful termination and non-fatal execution.

Proposed change
-    subprocess.run(["pkill", "-9", "FcitxTestApp"])
+    subprocess.run(
+        ["pkill", "-TERM", "-x", "FcitxTestApp"],
+        check=False,
+        stdout=subprocess.DEVNULL,
+        stderr=subprocess.DEVNULL,
+    )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@appium/conftest.py` at line 81, The subprocess.run call that kills
FcitxTestApp processes uses the -9 flag (SIGKILL) which force-terminates without
cleanup. Replace this with graceful termination by removing the -9 flag (which
defaults to SIGTERM) and wrap the subprocess.run call in a try-except block to
catch any exceptions and pass silently, making the cleanup non-fatal so that
test failures in pkill do not cause the test suite to fail. This ensures
processes are terminated gracefully in parallel test environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/config/CustomPhrase.swift`:
- Around line 67-75: The currentPageSlice computed property's set closure
recomputes currentPageItems at write time, which can change if currentPage is
modified between the get and set operations, causing edits to land in wrong
rows. Stabilize the page range by capturing currentPageItems once when the
binding is created and use that captured value in both the get and set closures
instead of re-evaluating currentPageItems inside the set closure.

---

Nitpick comments:
In `@appium/conftest.py`:
- Line 81: The subprocess.run call that kills FcitxTestApp processes uses the -9
flag (SIGKILL) which force-terminates without cleanup. Replace this with
graceful termination by removing the -9 flag (which defaults to SIGTERM) and
wrap the subprocess.run call in a try-except block to catch any exceptions and
pass silently, making the cleanup non-fatal so that test failures in pkill do
not cause the test suite to fail. This ensures processes are terminated
gracefully in parallel test environments.

In `@appium/test_custom_phrase.py`:
- Around line 107-108: Replace the direct click on the CloseSheet element with a
call to the close_sheet helper function to properly handle sheet dismissal.
Instead of immediately asserting that Keyword elements count is zero after the
click, add an explicit wait that polls until all Keyword elements disappear
before performing the assertion. This ensures the asynchronous sheet dismissal
completes before verification, eliminating intermittent failures.
🪄 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 Plus

Run ID: b9eff8c2-5ede-4a62-8c13-8c30732896b8

📥 Commits

Reviewing files that changed from the base of the PR and between 012bcef and a4084b1.

📒 Files selected for processing (18)
  • appium/conftest.py
  • appium/test_add_input_methods.py
  • appium/test_boolean.py
  • appium/test_custom_phrase.py
  • appium/test_entry.py
  • appium/test_group.py
  • appium/util/boolean.py
  • appium/util/button.py
  • appium/util/window.py
  • assets/zh-Hans.lproj/Localizable.strings
  • assets/zh-Hant.lproj/Localizable.strings
  • fcitx5
  • src/config/Advanced.swift
  • src/config/CustomPhrase.swift
  • src/config/ExternalView.swift
  • src/config/FooterView.swift
  • src/config/InputMethod.swift
  • src/config/SplitConfig.swift

Comment thread src/config/CustomPhrase.swift
@github-actions

Copy link
Copy Markdown

arm64 comparison

No difference.

x86_64 comparison

No difference.

@eagleoflqj eagleoflqj merged commit b8c52e6 into master Jun 21, 2026
1 check was pending
@eagleoflqj eagleoflqj deleted the customphrase branch June 21, 2026 02:24
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