Fix wire-usage filtering for TL parameter extraction - #2
Draft
null-nick wants to merge 5 commits into
Draft
Conversation
Hardens extractParams against dropping genuine protocol fields: filter out client-only fields not present on the wire, broaden the wire-usage regex to cover assignment-first reads, typed Vector variants, and hasFlag assignment targets, normalize field names before matching against the filter, and fix legacy-suffix/bool-flag type detection.
…apes The Vector alternative in compileWireUsage stopped at the first closing paren, so it missed this.X when a nested call sat between the buffer arg and the field (e.g. the lambda-based writer Vector.serialize(outputSerializedData, new Vector$$ExternalSyntheticLambda7(...), this.blocks)). Extend the match to the trailing ");" instead. Also add the assignment-first shape this.X = Vector.deserialize*(...), the dominant read-side pattern (634 occurrences in TLRPC.java) that the regex never covered. Caught via regression: updateGroupCallChainBlocks lost its `blocks` field and stories.report lost `id` (no readParams counterpart, so no other qualifying usage). Verified against the full corpus: 2 fields recovered, 0 dropped, no other method affected.
null-nick
marked this pull request as draft
August 8, 2026 13:37
…hies ParseClass split parent refs only on "$" (same-file nesting). Dotted cross-file refs like TLRPC.TL_messages_editMessage fell through unsplit, never matched tempList's "prefix$name" key, left ParentLink nil, and hid inherited field declarations from extractParams. extractObject also required deserializeResponse(T) in the class's own body to classify it as an RPC method. A class inheriting that method from a concrete parent (not just TLObject/TLMethod stubs) was misclassified as a TLConstructor and lost its namespace prefix. Fixes TL_ephemeral's TL_editMessage, which previously failed extraction outright.
- FormatType now resolves dotted Java references (TLRPC.TL_authorization) - SplitClasses guards field-name collisions against class-name rewrites - extractParams recovers wire fields nested one level under this.X.Y
- Removed filterNonWireParams/findTwoLevelWireFields/compileWireUsage:
these were dropping genuine wire fields (e.g. forumTopic.peer)
- compileVars: make $ optional in TLdeserialize pattern so it matches
Peer.TLdeserialize, DraftMessage.TLdeserialize, etc.
- Skip captured field names containing '(' or '$' (method call artifacts)
- Skip 'this.X !=' comparison matches outside setFlag/hasFlag contexts
(e.g. ephemeralReceiverBotId)
- MergeParameters: preserve non-flagged params from deserialized path
when missing from serialized, not just flagged ones
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.
No description provided.