Repository navigation
Conversation
…e truth (EasyIME#393 EasyIME#417 EasyIME#456) The POST handler printed the request's phrase data to the console before its loops; on a Windows console with a legacy code page that print raised UnicodeEncodeError, so the delete loop never ran (EasyIME#393, EasyIME#456) — while the reported result came from a success default, corrected only by whichever library call ran last (EasyIME#417). Drop both debug prints (the enumerate path's too) and consult every userphrase_add/userphrase_remove return: 0.5.1 gives add 1 on success and remove rows-deleted, so anything below 1 now reports failure, and a failing item is no longer masked by a later success. Architecture and design by asdf80730. Implementation generated with AI assistance from omp (tensorfold/Qwen3.8-Flash-Next).
…syIME#417) onRemovePhrase's complete callback fired the success alert regardless of the response, so a delete the server reported as failed still claimed 刪除詞彙成功. Read {"result": ...} the way the add dialog does, treat a non-200 as failure too, and reload the table either way: a batch that partially deleted kept showing the removed rows until a manual refresh. Architecture and design by asdf80730. Implementation generated with AI assistance from omp (tensorfold/Qwen3.8-Flash-Next).
Contributor
Author
|
The first workflow run from this fork branch is queued awaiting maintainer approval ( Everything verifiable without a build has been run on this exact tree ( (Comment generated with assistance from omp (tensorfold/Qwen3.8-Flash-Next)) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #393
Fixes #417
Fixes #456
Deleting a phrase that holds a character the Windows console cannot encode — 髙, 㩐, 栞, 湾 — did nothing at all in the 詞庫編輯 page, while the dialog kept reporting 刪除詞彙成功.
UserPhraseHandler.post()printed the request's own phrase data to the console before its two loops (print("add", added, "remove", removed)); on a console using a legacy code page thatprintraisesUnicodeEncodeError, so tornado answered 500 and the delete loop never ran — #456 posts the traceback for exactly that line, and #393's reporter found the same by commenting it out. Two further layers hid the failure:resultstarted from a success default of 1 and was then only overwritten by whichever library call happened to run last, so an item that failed was masked by a later item that succeeded (#417), andonRemovePhrase'scomplete:callback ignored the response entirely and alerted success unconditionally.python/input_methods/chewing/config_tool.py: both debug prints are gone — the POST handler's along with the GET handler'sprint(chewing_ctx, ret)— so phrase data never reaches the console.userphrase_add/userphrase_removereturn is now consulted. In the libchewing this tree pins (libchewing/@452f622),chewing_userphrase_addreturns 1 on success and 0/-1 on failure, andchewing_userphrase_removereturns the rows it actually deleted (sqlite3_changes, 0 when the phrase is not found), so anything below 1 is reported as a failure, and a failure latches: it can no longer be masked by a later success. The old comment# 0: error, 1: success, default to successdescribes neither contract and is replaced.python/input_methods/chewing/js/user_phrase.js:onRemovePhrasereads{"result": ...}the wayonAddPhrasealready does, treats a non-200 as a failure too, and reloads the table either way — a batch that deleted only some rows no longer keeps showing the deleted ones until a manual refresh.在「編輯使用者詞庫」刪除含罕用字(髙、㩐、栞、湾)的詞彙其實完全沒生效,對話框卻一直顯示成功。原因不在輸入法,而在詞庫編輯伺服端:
config_tool.py在刪除迴圈之前把整包詞彙資料print到 Windows console,舊式 code page 遇到編碼不進去的字就拋UnicodeEncodeError,該次 POST 直接 500、刪除動作一步都沒跑(#456 的 traceback 正是該行;#393 的 reporter 把它註解掉後就刪得掉)。回傳給前端的result又是以成功為預設值、只被最後一個呼叫覆寫,前端也完全不檢視回應就彈成功訊息,所以三張單其實是同一個 root cause。本 PR 拿掉那些 debug print、逐一檢查每個 libchewing 回傳值,並讓刪除對話框顯示真實結果;#417 另要求的「自動產生詞彙」開關屬另一功能,未一併處理。煩請回報者在下一個 beta 版重測這三組詞。Validation:
tests/verify_windows.shagainst an integration tree carrying these identical product files: 21 layers passed, 0 failed (bundledpython.exebackend suite 153 tests OK with 4 platform skips; Node, Go plus the Windows/386 cross-build, Rust fmt/clippy, C++ helper tests).tests/test_chewing_user_phrase_editor.py(the project's internal suite) replays that return table against a stubbedChewingContextand an ASCII-hostile stdout: 5 tests OK against this branch's exact tree — rare characters 髙/㩐/栞 through add and remove, a failing removal followed by a succeeding one,-1from remove, a failing add beside succeeding removals, and an enumerate that reports its rows without printing them.Architecture and design by asdf80730. Implementation generated with AI assistance from omp (tensorfold/Qwen3.8-Flash-Next).