Repository navigation
Commit 063938e
committed
fix(feishu): fall back to post mode when markdown tables exceed card limit
Feishu rejects static interactive cards with more than 5 table components
(ErrCode 11310: card table number over limit), which silently drops the
reply into the delivery queue.
Tables are counted with the shared GFM markdown parser (the same parser
used for post-mode table conversion), so every parser-recognized table
form is caught — including pipe-less GFM tables and alignment-colon
delimiters — while fenced code, thematic breaks, and plain pipes in
prose are not counted. Feishu was verified to reject pipe-less tables
the same way as piped ones (ErrCode 11310 in both cases).
Guards are applied at every static-card decision point:
- presentation-card.ts: withinCardTableLimit (parser-backed) plus
feishuCardWithinTableLimit, which counts tables across every markdown
element of a built card
- outbound.ts: guard sendOutboundText and sendText payload routing;
buildFeishuPayloadCard returns undefined when the built card exceeds
the limit so generated presentation cards fall back to the text path
- channel.ts: the message-action presentation path rejects the generated
card when it exceeds the limit and routes delivery through the
existing presentationFellBack -> sendPayload text fallback
- reply-dispatcher.ts: guard useStaticCard only (useStreamingCard is
left unchanged), and route streaming recovery through post delivery
when the recovered content exceeds the limit, instead of retrying a
static card the API would reject again
Streaming CardKit cards are intentionally left unchanged: they push
content into a markdown element rather than table components, so the
5-table component limit does not apply there. Opaque native Feishu
cards supplied by the caller are not inspected.
Part of #436901 parent b8f6086 commit 063938e
4 files changed
Lines changed: 113 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
1085 | 1086 | | |
1086 | 1087 | | |
1087 | 1088 | | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
1088 | 1092 | | |
1089 | 1093 | | |
1090 | 1094 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
| 1095 | + | |
1094 | 1096 | | |
1095 | 1097 | | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1096 | 1102 | | |
1097 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1098 | 1106 | | |
1099 | 1107 | | |
1100 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
253 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
254 | 263 | | |
255 | 264 | | |
256 | 265 | | |
| |||
421 | 430 | | |
422 | 431 | | |
423 | 432 | | |
424 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
425 | 437 | | |
426 | 438 | | |
427 | 439 | | |
| |||
862 | 874 | | |
863 | 875 | | |
864 | 876 | | |
865 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
866 | 880 | | |
867 | 881 | | |
868 | 882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
60 | 113 | | |
61 | 114 | | |
62 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
957 | 958 | | |
958 | 959 | | |
959 | 960 | | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
960 | 965 | | |
961 | 966 | | |
962 | | - | |
| 967 | + | |
963 | 968 | | |
964 | 969 | | |
965 | 970 | | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
978 | 994 | | |
979 | 995 | | |
980 | 996 | | |
| |||
1289 | 1305 | | |
1290 | 1306 | | |
1291 | 1307 | | |
1292 | | - | |
| 1308 | + | |
| 1309 | + | |
1293 | 1310 | | |
1294 | 1311 | | |
1295 | 1312 | | |
| |||
0 commit comments