Commit e7cf714
exampleData: Reserve some message, stream, and user IDs for snapshot tests
In generateInboundEventEditSequence-test.js, when we build state
objects from eg.plusReduxState, the data we add includes some
constant message, stream, and user IDs. Constant because they end up
appearing in test snapshots, and we want those snapshots to be
stable.
This is a problem when the data we're building from already claims
those IDs, for example, by saying that a stream with ID 1 exists and
that we have a subscription for it. Since eg.plusReduxState uses
random IDs, this has been happening some small fraction of the time,
resulting in flakes where the snapshot says a stream is *not*
subscribed, but the input data says it *is*. That's #5415.
So, to fix, reserve a small section of stream IDs, including 1 and
2, which we use in the mentioned snapshot tests, so that
eg.plusReduxState never chooses them. And similarly reserve a range
of message and user IDs, too. As suggested by Greg:
#5415 (comment)
In another approach to fix those flakes, we might have instead built
on eg.plusReduxState by erasing some of it first, removing spreads
like the one in
streams: [...eg.plusReduxState.streams, stream1, stream2],
But as we mentioned in 371e9b4, that'd risk corrupting the state
we get from eg.plusReduxState. That's the only example state that
claims to offer a realistic uncorrupted state with server data, and
it's good not to interfere with that guarantee if we can avoid it.
(For example, if eg.plusReduxState grows a reference to a stream in
`muteModel`, it'd be corrupt if that stream is absent in the
`streams` state.) It's too bad that the easy, natural thing to do is
to omit the spreads.
Fixes: #54151 parent 89de470 commit e7cf714
1 file changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | | - | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
291 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
| |||
418 | 422 | | |
419 | 423 | | |
420 | 424 | | |
421 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
422 | 428 | | |
423 | 429 | | |
424 | 430 | | |
| |||
0 commit comments