Skip to content

Fix wire-usage filtering for TL parameter extraction - #2

Draft
null-nick wants to merge 5 commits into
TGScheme:mainfrom
null-nick:main
Draft

Fix wire-usage filtering for TL parameter extraction#2
null-nick wants to merge 5 commits into
TGScheme:mainfrom
null-nick:main

Conversation

@null-nick

Copy link
Copy Markdown
Contributor

No description provided.

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
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
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