Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions _schema/layers/LAYER233_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ decision below).
| Canonical `channels.toggleForum` encoded for 225–232 (canonical→profile) | The required-field projection mechanically drops `sidebar` and emits the historical `#3ff75734` body. Server obligation: a canonical `#a2952b54` request carries the client's explicit `sidebar`; a historical request arrives with `sidebar=false`. A server that wants to keep a sidebar layout chosen by a Layer 233 client may preserve it for historical sessions. |
| `channel.forum_sidebar`, `user.bot_forum_sidebar` encoded for 225–232 | Drop (generic optional-field default). Layout metadata only: no permission, consent, credential or PTS meaning, and the historical constructor keeps its field set. Wire IDs are unchanged, so the flags are canonical-only for 225–232. |
| Six new updates (`updateEditForumTopic`, `updateBotWidgetQuery`, `updateInlineBotWidgetQuery`, `updateBotWidgetCopyQuery`, `updateMessageWidgetData`, `updateTranscribedAudioFile`) projected to 225–232 | Drop. Every prior non-wallet update added in Layers 225–229 was dropped (`updateJoinChatWebViewDecision`, `updateNewBotConnection`, `updateWebBrowserException`, `updateWebBrowserSettings`, the four ephemeral updates, and `updateEphemeralBotCallbackQuery`); only the Layer 230 wallet/TON-session updates were rejected. The widget, transcription and forum-UI features are unavailable to old profiles, and a dropped interactive widget query cannot authorize a wallet transaction. `updateMessageWidgetData` is the first dropped update with `pts`/`pts_count`: a 225–232 session sees a pts gap when it is emitted and recovers through `updates.getDifference`/`updates.getChannelDifference`, where the update is dropped again from `other_updates` while the returned state still covers its pts. A server emitting it must account for that gap. |
| New widget methods, results and `WidgetQueryType`/`UserWallet` types in historical profiles | Unavailable (generic canonical-only default). No alias and no byte bridge. `messageMediaWidget` in the optional `message.media` falls under the generic optional-field drop: 225–232 receive the message without media, so a widget-only message arrives empty. A server that wants an "unsupported message" placeholder must substitute `messageMediaUnsupported` itself. |
| New widget methods, results and `WidgetQueryType`/`UserWallet` types in historical profiles | Unavailable (generic canonical-only default). No alias and no byte bridge. `messageMediaWidget` in the optional `message.media` is projected to `messageMediaUnsupported#9f84f49e` for 225–232 (new-only project hook `layerProjectLegacyWidgetMedia`): a widget-only message reaches an older client as an explicit unsupported-media placeholder instead of an empty text message. |
| Legacy `payments.getStarGiftWithdrawalUrlLegacy#d06e93a8` | Still owned by the canonical Go model. Exact profile 232 defines the temporary-password method `#c8ca817b`, not `#d06e93a8`, so unlike the Layer 232 record it no longer admits the promoted legacy wire; the SRP constructor remains available in exact profiles 225–231. |

The policy has 305 entries: the 249 reviewed decisions are retained unchanged,
and 56 new obligations are explicit (eight `channels.toggleForum` request
defaults and 48 update drops, six constructors × eight historical profiles).
No obligation uses a hook; no stale key remains.
The policy has 313 entries: the 249 reviewed decisions are retained unchanged,
and 64 new obligations are explicit (eight `channels.toggleForum` request
defaults, 48 update drops and eight `messageMediaWidget` new-only projections,
six constructors × eight historical profiles). One obligation uses a typed hook
(`layerProjectLegacyWidgetMedia`); no stale key remains.

## Verification matrix

Expand All @@ -81,8 +82,8 @@ On Windows/amd64, Go 1.27.3:
- Schema import verified against the locked Git blob and normalized SHA-256;
`canonical_layer` moved to 233 and `layer-233.tl` was written with its
provenance.
- Policy audit: 249 retained entries, zero stale, 56 new obligations, all
reviewed above. The reviewed policy document now holds 305 entries.
- Policy audit: 249 retained entries, zero stale, 64 new obligations, all
reviewed above. The reviewed policy document now holds 313 entries.
- `go generate .` reproduced the canonical `tg` model plus the `tlprofile`
sidecar with `Profile233` and `ProfileCanonical = 233`; the execution-plan
audit was regenerated.
Expand Down
8 changes: 6 additions & 2 deletions _schema/layers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ and `user` gain optional forum-sidebar layout flags (wire IDs unchanged), while
`sidebar=false`, the layout an old client chose, instead of being rejected; the
six new update constructors drop for 225–232 like every prior non-wallet
update. `updateMessageWidgetData` is the first dropped update with `pts`, so a
historical session recovers its gap through difference. The policy has 305
entries (249 existing plus eight request defaults and 48 update drops). No
historical session recovers its gap through difference. `messageMediaWidget`
projects to `messageMediaUnsupported#9f84f49e` for 225–232 instead of dropping
the media, so a widget-only message reaches an older client as an unsupported
placeholder rather than an empty text message. The policy has 313 entries (249
existing plus eight `channels.toggleForum` request defaults, 48 update drops and
eight `messageMediaWidget` new-only projections). No
existing update's `pts`/`pts_count` field changes and the MTProto transport
schema is unchanged.

Expand Down
64 changes: 64 additions & 0 deletions _schema/layers/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,70 @@
"note": "kind=incompatible; layer=228; direction=profile-to-canonical; semantic=function:bots.setCustomVerification; wire=0x8b89dfbd-\u003e0xf4946757; field=custom_description-\u003ecustom_description; type=string-\u003eTextWithEntities; source_shape=8dbe65bea4ee0abe7e83c53b83e58674057a353efa71ec3d06ccf28a79ccca3b; target_shape=f2fe0042bab21d6203bd57cd9c82038f1737278bc13e0e0609da5c7a08d293ce"
}
},
{
"key": "layer-obligation/v1/new-only/48cf1592bab384c078771998d489fd9e793d536cf038587ce7c98c558dcb94fc",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=225; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/5606c517427cdae430ba950680fa47f2c7969ab7a16e7b476db0db433278fe7c",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=232; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/62167c1a5cbd08e9220253c04cf408092e68326bec59ab1f47af3a65506201b8",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=230; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/7b7f67152e9d1b4811593bff8fa890e4768f6ef246a9d397f883959ccfe70921",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=231; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/975aaacb8e74e37b13a8eb886bd60f92be50b425b5837e14ceda975a8a4b301d",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=228; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/bda0208ba344039e3a0e01be032cc2964e242f2f97fda50b63a1f5604a81f8e2",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=226; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/bdd0c4d27164fe069302a61dbc4d54c168f9aea1032d064e365e9a055c26fe45",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=229; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/new-only/d50e1746fc7b411accacaf1c57dae5eec66fe14e5dda255f008197cda8cc8a43",
"resolution": {
"action": "project",
"hook": "layerProjectLegacyWidgetMedia",
"note": "kind=new-only; layer=227; direction=canonical-to-profile; semantic=type:messageMediaWidget; wire=0x2238f214-\u003e0x00000000; type=MessageMedia-\u003e; source_shape=390976d23b5ffc231eeb226c4fecdc33fb72f315126c195823b0980db0478536; target_shape=0000000000000000000000000000000000000000000000000000000000000000"
}
},
{
"key": "layer-obligation/v1/old-only/04095a246f363f365768d27cfea9ed4d959a1cff28664178e227bddfa5d2f9e5",
"resolution": {
Expand Down
11 changes: 9 additions & 2 deletions gen/layer_codec_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -2332,8 +2332,15 @@ func (e *layerCodecEmitter) buildFamilies() error {
return err
}
current.project = fmt.Sprintf("return %s(profile, value)\n", hook)
current.preflight = fmt.Sprintf("projected, keep, err := %s(profile, value); if err != nil { return 0, err }; if !keep { return 0, nil }; return layerPreflightDynamicObject(profile, projected, state)\n", hook)
current.encode = fmt.Sprintf("projected, keep, err := %s(profile, value); if err != nil { return err }; if !keep { return &LayerProjectionError{Profile: profile, Semantic: %s, Dropped: true, Reason: \"policy drops projected value\"} }; return layerEncodeObjectBody(profile, projected, b, state)\n", hook, semanticID)
// A class/object dispatcher applies the projection and then
// re-enters the family body of the *projected* constructor, so a
// projected value never reaches this body for an unavailable
// profile. Emitting a generic object encoder here would require
// runtime dynamic dispatch (the sparse codec forbids it). Keep the
// drop behavior: a value that reaches a family body directly for an
// unavailable profile has no encodable wire identity.
current.preflight = "return 0, nil\n"
current.encode = fmt.Sprintf("return &LayerProjectionError{Profile: profile, Semantic: %s, Dropped: true, Reason: \"policy drops projected value\"}\n", semanticID)
default:
reason := "semantic family is unavailable in exact profile"
current.project = fmt.Sprintf("return nil, false, &LayerCodecError{Operation: \"project\", Profile: profile, Semantic: %s, Reason: %q}\n", semanticID, reason)
Expand Down
10 changes: 9 additions & 1 deletion gen/layer_real_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestRealLayerPolicy(t *testing.T) {
if unresolved := resolved.LayerConversionPlan().Report.Unresolved(); len(unresolved) != 0 {
t.Fatalf("real policy leaves %d unresolved obligations; first=%+v", len(unresolved), unresolved[0])
}
if got, want := len(document.Entries), 305; got != want {
if got, want := len(document.Entries), 313; got != want {
t.Fatalf("reviewed policy entry count = %d, want %d", got, want)
}
codec, err := resolved.buildLayerCodecModel("tg")
Expand Down Expand Up @@ -125,6 +125,7 @@ func assertRealLayerHookContracts(t *testing.T, codec, sparse []layerCodecHookCo
"layerDefaultLegacyKeyboardButtonTypeDecode": "func(LayerProfile, *KeyboardButton) (ButtonTypeClass, error)",
"layerProjectEphemeralBotCommandProject": "func(LayerProfile, *BotCommand, bool) (*BotCommand, bool, error)",
"layerProjectLegacyDefaultKeyboardButtonProject": "func(LayerProfile, *KeyboardButton, ButtonTypeClass) (*KeyboardButton, bool, error)",
"layerProjectLegacyWidgetMediaProject": "func(LayerProfile, *MessageMediaWidget) (bin.Object, bool, error)",
"layerRequireCapturedChatInviteJoinQueryIDDecode": "func(LayerProfile, *MessagesChatInviteJoinResultWebView) (int64, error)",
"layerRequireLegacyEphemeralDeletePeerEncode": "func(LayerProfile, *EphemeralDeleteMessageRequest, bool, InputPeerClass) (InputPeerClass, error)",
"layerRequireLegacyEphemeralMessagePeerEncode": "func(LayerProfile, *EphemeralMessage, bool, PeerClass) (PeerClass, error)",
Expand Down Expand Up @@ -246,6 +247,13 @@ func realLayerResolution(obligation LayerObligation) (LayerObligationResolution,
}
return LayerObligationResolution{}, false, nil
}
// A Layer 233 bot web widget has no wire identity before Layer 233. Dropping
// it would leave a text message with no media, so project it to
// messageMediaUnsupported for 225-232: the client then renders an explicit
// unsupported-media placeholder instead of a silently media-less message.
if obligation.Kind == LayerObligationNewOnly && obligation.Semantic.QName == "messageMediaWidget" {
return LayerObligationResolution{Action: LayerResolveProject, Hook: "layerProjectLegacyWidgetMedia"}, true, nil
}
if obligation.Resolution.resolved() {
return LayerObligationResolution{}, false, nil
}
Expand Down
19 changes: 19 additions & 0 deletions telegram/message/entity/options.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions telegram/message/styling/options.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions telegram/message/typing.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading