Commit cf42465
fix(outbounds): preserve stable subscription tags (#5)
A newly inserted subscription link could reuse the positional tag of an existing server before that server's own entry was processed later in the same refresh loop. The existing server was then bumped to a suffixed tag instead, silently repointing any routing or balancer rule that referenced the original stable tag at a different physical server.
Ported from upstream MHSanaei#6345. Reserves historical tags for identities still present in the current fetch before assigning tags to new/renamed links, so neither the positional-fallback path nor a fresh-tag collision suffix can steal a tag that rightfully belongs to another identity still in the batch.
Verified: all 8 TestAssignStableTags subtests pass with the fix; the 3 new ones confirmed to fail without it (reproduces the exact wrong-tag assignment). Reviewed by the repo's automated Claude Bot (verdict: Approve); one doc-comment suggestion applied, one pre-existing orthogonal bug (duplicate identities within a subscription) tracked separately per the bot's own recommendation not to bolt it onto this PR, one upgrade caveat noted in the PR description instead of a code change.
Upgrade note: this fix prevents the mis-assignment from recurring, it does not repair a subscription that already hit it -- see PR discussion for the recovery steps if a routing/balancer rule seems to be pointing at the wrong server on a subscription that predates this fix.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent e6e4d47 commit cf42465
2 files changed
Lines changed: 56 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
| 458 | + | |
| 459 | + | |
459 | 460 | | |
460 | 461 | | |
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
465 | 473 | | |
466 | 474 | | |
467 | 475 | | |
| |||
470 | 478 | | |
471 | 479 | | |
472 | 480 | | |
| 481 | + | |
473 | 482 | | |
474 | 483 | | |
| 484 | + | |
475 | 485 | | |
476 | 486 | | |
477 | 487 | | |
478 | | - | |
| 488 | + | |
479 | 489 | | |
480 | 490 | | |
481 | 491 | | |
| |||
493 | 503 | | |
494 | 504 | | |
495 | 505 | | |
496 | | - | |
| 506 | + | |
497 | 507 | | |
498 | 508 | | |
499 | 509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
169 | | - | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
175 | 217 | | |
176 | 218 | | |
177 | 219 | | |
| |||
0 commit comments