Commit 2a23f4a
authored
fix: create StatelessGeneratingSessionIdManager to fix multi-instance deployments (#641)
* fix: restore StatelessSessionIdManager as default to fix multi-instance deployments
Fixes #636
In commit da6f722, the default session ID manager was changed from
StatelessSessionIdManager to InsecureStatefulSessionIdManager, which broke
multi-instance deployments without sticky sessions by causing Invalid
session ID errors when requests were routed to different server instances.
This change restores the previous default behavior:
- Default session manager is now StatelessSessionIdManager (no session validation)
- Multi-instance deployments work without requiring sticky sessions
- Added WithStateful() option for explicit stateful session management
- Updated all nil fallbacks to use stateless manager
- Updated tests to verify new default behavior
- Updated documentation to reflect the change
Backward compatibility is maintained while fixing the production deployment issue.
* fix: create StatelessGeneratingSessionIdManager to fix multi-instance deployments
Fixes #636
The original fix was too aggressive - changing to completely stateless
broke existing functionality that expects session IDs to be generated.
New approach:
- Created StatelessGeneratingSessionIdManager that generates session IDs
but only validates format (not existence locally)
- This fixes multi-instance deployments while maintaining compatibility
- Updated tests to reflect new behavior
- Session termination now requires explicit stateful mode
This solves the production issue where requests routed to different
instances failed with 'Invalid session ID' errors while preserving
the expected session ID generation behavior.
* fix: update NewDefaultSessionIdManagerResolver fallback to StatelessSessionIdManager
As requested, updated NewDefaultSessionIdManagerResolver to fall back to
StatelessSessionIdManager instead of StatelessGeneratingSessionIdManager
when manager is nil.
This change affects:
- NewDefaultSessionIdManagerResolver(nil) fallback
- WithSessionIdManager(nil) fallback
- WithSessionIdManagerResolver(nil) fallback
Updated corresponding tests to expect stateless behavior:
- Generate() returns empty string ("")
- Validate() accepts any session ID without error
The server default still uses StatelessGeneratingSessionIdManager for
backward compatibility, but nil fallbacks now use truly stateless behavior.
* fix: update tests to use WithStateful(true) for stateful behavior
As requested in the CodeRabbit review, updated tests that expect
stateful behavior to explicitly use WithStateful(true) instead of
relying on the old default behavior.
Updated tests:
- TestStreamableHTTP_POST_SendAndReceive: expects session IDs in headers and 400 for invalid IDs
- TestStreamableHttpResourceGet: expects session ID in header
- TestStreamableHTTP_SessionWithLogging: expects session ID in header
- TestStreamableHTTP_SendNotificationToSpecificClient: both subtests expect session IDs in headers
This ensures tests explicitly opt into stateful mode when needed,
while the default remains stateless for multi-instance deployments.
* fix: enable coverage on main branch and add artifact retention
- Updated coverage job condition to run on push to main branch in addition to PRs
- Added 30-day artifact retention to ensure coverage artifacts are available for comparison
- This fixes the coverage triggers that were failing due to missing baseline artifacts
Now coverage will:
1. Run on main branch pushes to create baseline artifacts
2. Run on PRs to compare against baseline and ensure coverage doesn't decrease
3. Keep artifacts available for 30 days for proper comparison1 parent ecc6d8f commit 2a23f4a
File tree
3 files changed
+142
-45
lines changed- .github/workflows
- server
3 files changed
+142
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
82 | 92 | | |
83 | 93 | | |
84 | 94 | | |
| |||
187 | 197 | | |
188 | 198 | | |
189 | 199 | | |
190 | | - | |
| 200 | + | |
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
| |||
1244 | 1254 | | |
1245 | 1255 | | |
1246 | 1256 | | |
1247 | | - | |
| 1257 | + | |
1248 | 1258 | | |
1249 | 1259 | | |
1250 | 1260 | | |
| |||
1270 | 1280 | | |
1271 | 1281 | | |
1272 | 1282 | | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1273 | 1307 | | |
1274 | 1308 | | |
1275 | 1309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| 598 | + | |
598 | 599 | | |
599 | 600 | | |
600 | 601 | | |
| |||
1014 | 1015 | | |
1015 | 1016 | | |
1016 | 1017 | | |
1017 | | - | |
| 1018 | + | |
1018 | 1019 | | |
1019 | 1020 | | |
1020 | 1021 | | |
| |||
1404 | 1405 | | |
1405 | 1406 | | |
1406 | 1407 | | |
1407 | | - | |
| 1408 | + | |
1408 | 1409 | | |
1409 | 1410 | | |
1410 | 1411 | | |
| |||
1425 | 1426 | | |
1426 | 1427 | | |
1427 | 1428 | | |
1428 | | - | |
1429 | | - | |
| 1429 | + | |
| 1430 | + | |
1430 | 1431 | | |
1431 | 1432 | | |
1432 | 1433 | | |
1433 | | - | |
1434 | | - | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1435 | 1452 | | |
1436 | 1453 | | |
1437 | 1454 | | |
| |||
1508 | 1525 | | |
1509 | 1526 | | |
1510 | 1527 | | |
1511 | | - | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
1512 | 1551 | | |
1513 | 1552 | | |
1514 | 1553 | | |
1515 | 1554 | | |
1516 | 1555 | | |
1517 | 1556 | | |
1518 | | - | |
| 1557 | + | |
1519 | 1558 | | |
1520 | | - | |
1521 | 1559 | | |
1522 | 1560 | | |
1523 | 1561 | | |
1524 | 1562 | | |
1525 | 1563 | | |
| 1564 | + | |
1526 | 1565 | | |
| 1566 | + | |
1527 | 1567 | | |
1528 | 1568 | | |
1529 | 1569 | | |
| |||
1780 | 1820 | | |
1781 | 1821 | | |
1782 | 1822 | | |
1783 | | - | |
| 1823 | + | |
1784 | 1824 | | |
1785 | | - | |
1786 | | - | |
| 1825 | + | |
| 1826 | + | |
1787 | 1827 | | |
1788 | | - | |
1789 | | - | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1790 | 1836 | | |
1791 | 1837 | | |
1792 | 1838 | | |
| |||
1865 | 1911 | | |
1866 | 1912 | | |
1867 | 1913 | | |
1868 | | - | |
| 1914 | + | |
1869 | 1915 | | |
1870 | 1916 | | |
1871 | 1917 | | |
1872 | | - | |
| 1918 | + | |
1873 | 1919 | | |
1874 | 1920 | | |
1875 | | - | |
| 1921 | + | |
1876 | 1922 | | |
1877 | 1923 | | |
1878 | | - | |
| 1924 | + | |
1879 | 1925 | | |
1880 | 1926 | | |
1881 | 1927 | | |
| |||
1929 | 1975 | | |
1930 | 1976 | | |
1931 | 1977 | | |
1932 | | - | |
| 1978 | + | |
1933 | 1979 | | |
1934 | 1980 | | |
1935 | 1981 | | |
| |||
1938 | 1984 | | |
1939 | 1985 | | |
1940 | 1986 | | |
1941 | | - | |
| 1987 | + | |
1942 | 1988 | | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
| 1989 | + | |
| 1990 | + | |
1948 | 1991 | | |
1949 | 1992 | | |
1950 | 1993 | | |
1951 | 1994 | | |
1952 | 1995 | | |
1953 | 1996 | | |
1954 | | - | |
| 1997 | + | |
1955 | 1998 | | |
1956 | 1999 | | |
1957 | 2000 | | |
| |||
1960 | 2003 | | |
1961 | 2004 | | |
1962 | 2005 | | |
1963 | | - | |
| 2006 | + | |
1964 | 2007 | | |
1965 | | - | |
1966 | | - | |
1967 | | - | |
1968 | | - | |
1969 | | - | |
| 2008 | + | |
| 2009 | + | |
1970 | 2010 | | |
1971 | 2011 | | |
1972 | 2012 | | |
1973 | 2013 | | |
1974 | 2014 | | |
1975 | 2015 | | |
1976 | | - | |
| 2016 | + | |
1977 | 2017 | | |
1978 | 2018 | | |
1979 | 2019 | | |
| |||
1985 | 2025 | | |
1986 | 2026 | | |
1987 | 2027 | | |
1988 | | - | |
| 2028 | + | |
1989 | 2029 | | |
1990 | | - | |
1991 | | - | |
| 2030 | + | |
| 2031 | + | |
1992 | 2032 | | |
1993 | 2033 | | |
1994 | 2034 | | |
| |||
2021 | 2061 | | |
2022 | 2062 | | |
2023 | 2063 | | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
2024 | 2086 | | |
2025 | 2087 | | |
2026 | 2088 | | |
| |||
2039 | 2101 | | |
2040 | 2102 | | |
2041 | 2103 | | |
2042 | | - | |
| 2104 | + | |
2043 | 2105 | | |
2044 | 2106 | | |
2045 | 2107 | | |
| |||
2110 | 2172 | | |
2111 | 2173 | | |
2112 | 2174 | | |
2113 | | - | |
| 2175 | + | |
2114 | 2176 | | |
2115 | 2177 | | |
2116 | 2178 | | |
| |||
0 commit comments