fix(codegen): parse recapitalised Array-of return sentence

Telegram rewrote the forwardMessages and copyMessages return sentence from
"an array of MessageId" to "an Array of MessageId". The pattern that handles
the "... of the sent messages is returned" shape matched lowercase only, so
both methods fell back to bool and the weekly regen job failed at the audit
step.

Add approved_any_locations to overrides.json so a union that renders as `any`
by design can be approved as data instead of a code change. Approve
InputRichMessageMedia.Media, a five-variant InputMedia union added in Bot
API 10.2 that has no declared parent type.

Make the drift test compare HEAD against itself. It compared the working tree
against HEAD, so it failed whenever a regen run added a method.
This commit is contained in:
2026-07-21 22:52:06 +01:00
parent cd05e6a426
commit 5aabbe6151
7 changed files with 75 additions and 17 deletions
+20
View File
@@ -22,6 +22,12 @@ type Overrides struct {
// ApprovedBoolMethods lists methods whose returns are genuinely bool.
// The audit tool ignores these.
ApprovedBoolMethods []string `json:"approved_bool_methods,omitempty"`
// ApprovedAnyLocations lists IR locations whose union renders as `any` by
// design, keyed "<TypeName>.<FieldName>" for struct fields,
// "<methodName>.<ParamName>" for params and "<methodName>" for returns.
// The audit tool ignores these.
ApprovedAnyLocations []string `json:"approved_any_locations,omitempty"`
}
// LoadOverrides reads and parses overrides.json. Returns an empty Overrides
@@ -73,3 +79,17 @@ func (o *Overrides) IsBoolApproved(methodName string) bool {
}
return false
}
// IsAnyApproved reports whether location is on the approved `any` list.
// See ApprovedAnyLocations for the key format.
func (o *Overrides) IsAnyApproved(location string) bool {
if o == nil {
return false
}
for _, n := range o.ApprovedAnyLocations {
if n == location {
return true
}
}
return false
}
+3
View File
@@ -1,6 +1,9 @@
{
"method_returns": {},
"field_types": {},
"approved_any_locations": [
"InputRichMessageMedia.Media"
],
"approved_bool_methods": [
"setWebhook",
"deleteWebhook",