core, python: fix refused renames, extend the client API - #7379
Open
shumvgolove wants to merge 8 commits into
Open
core, python: fix refused renames, extend the client API#7379shumvgolove wants to merge 8 commits into
shumvgolove wants to merge 8 commits into
Conversation
shumvgolove
force-pushed
the
sh/core-fixes
branch
from
August 15, 2026 09:34
3c541bd to
8266ca1
Compare
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.
Core
1: Rejecting a duplicate name corrupts the database
Display names are unique. When a rename hits an existing name, the core reports the error but keeps part of the write: the user row ends up holding a name that belongs to another contact, while that contact and the group member rows keep the old one. Nothing can repair it through the API. Creating a user with a taken name has the same problem and leaves the database with no active user.
Both now write the name first, so a rejected change writes nothing at all. Query plans are regenerated for the new statement.
2: The message batch limit does not compile on GHC 8.10
The helper added in #7364 (
lengthLEinSimplex.Chat.Protocol) is defined in infix form with a bang pattern, which GHC 9.0 and later accept but GHC 8.10 rejects with a parse error. The library therefore builds on the current compiler but not on the oldest supported one.Python library
1: Starting a client crashes
start_chatdid not setserviceRequests, a field the generated command string reads, so every start raisedKeyError.api_reject_contact_requestdid not setnotify.2: Ctrl+C during startup is ignored
Startup runs database migrations and creates the address, which takes a few seconds. A signal in that window was dropped and the client started serving anyway. The stop is now remembered,
Client.stop_requestedreports it, andClient.install_signal_handlers()lets a caller install the handlers before startup rather than after.3: The profile cannot be changed after start
The profile was applied while the client started, so it could not contain anything that depends on reading the database first.
Client.profileandClient.sync_profile()apply it once the client is running.4: The avatar can be set to a format no app displays
The core stores any value starting with
data:, but every client decodes onlydata:image/png;base64,anddata:image/jpg;base64,(
Images.android.kt,Images.desktop.kt,ImageUtils.swift). They strip those two prefixes rather than check them, so an image in any other format is passed to the base64 decoder unchanged, fails to decode, and shows as an empty avatar to every contact.The profile is now checked before it is sent, and
util.check_profile_imageexposes the same check to callers that build the data URI themselves.5: Common operations have no API
ChatError: one base class for the two exceptions raised for the same kind of failure.ChatAPIError.error_type,.store_error_type,.command_error: the error tags and the message, until now read out of the rawchat_errordictionary by every caller.ChatApi.api_accept_member_contact,api_merge_{contact,group}_custom_data,util.merged_custom_data,util.conn_status.