Repository navigation
Commit 6bd98a7
authored
read_group_chat: keep the room-wide discount when a room's booking list is shorter than its count (#3047)
Fixes #3046
Written-by: FlyBot Dev-1
Claim-Id: 19c62a2ad22441e8a041b2d48f5bc158
Owner: Dev-1
Reviewer: Birfy
Base: ab3604d
Pushed head: 8497122
Tree: 3120734
Verified commit: ca1d3ba0405f1384b1e3042960f0aebd51601fa0 (local, not on
the remote — the verifiable anchor is `Tree:`)
Tier: T2
## What changed
`read_group_chat`'s `newest N of TOTAL` discounted only the bookings
`room.reservedSeqs` names. A room that kept only its booking count (the
shape #3037 already fell back on) and recorded one number afterwards
carries a list shorter than `room.reserved`, so the read trusted a list
that cannot place the room: the recorded numbers below the reader's
floor were added back, the unrecorded bookings were counted as lines,
and a window holding 196 lines read `newest 30 of 206`.
A list shorter than the count now reads as unknown (`below = 0`) and
keeps the room-wide discount — the same fallback an older room with no
list at all already had. A room whose list covers its count keeps the
per-booking arithmetic #3039 introduced, and a room with no floor
booking is unchanged.
Six files, +51/−4:
- `core/src/host/groups.js` (+8/−1)
- `core/test/read-group-total-below-floor.test.js` (+17, one RED case,
alongside the #3039 cases)
- `docs/subsystems/core-host.md` (one sentence, plus
`core/test/read-group-total-below-floor.test.js` in the section's
"Covered by" list)
- `patches/ds-bot/0012-room-membership.patch` (regenerated)
- `patches/ds-bot/files/test/read-group-total-below-floor.test.js`
(mirror)
- `changelog.d/3046-room-short-booking-list.fixed.md`
### 0012 was regenerated on the new live main
`node scripts/ds-bot-patches.mjs generate` ran **on the new live main
`ab3604de`, not on `c5d96d38`**: this branch's base already contains
#3039, so regenerating on the old base would have carried that merge
into `0012` a second time. `patches/ds-bot/0012-room-membership.patch`
went 2713 → 2719 lines and
`patches/ds-bot/files/test/read-group-total-below-floor.test.js` 107 →
124 lines; the regenerated `0012` carries only this change. `git status`
after `generate` lists only the files above, `patch check` and
`canonical` are both green.
## Red first, twice, unchanged source
`core/test/read-group-total-below-floor.test.js` at base `ab3604de` with
only the new test case added (the source fix not applied), run twice;
after normalising `duration_ms` and the random
`/tmp/ds-bot-below-floor-*` path the two logs are byte-identical (`diff`
empty):
```
not ok 4 - P-800: a booking list shorter than its count keeps the room-wide discount
location: '.../core/test/read-group-total-below-floor.test.js:114:1'
failureType: 'testCodeFailure'
error: 'the list names ten bookings and the room counted fifteen, so its placements are unknown and the room-wide discount stays: Latest in "Ops" (newest 30 of 206, oldest first):'
# tests 4
# pass 3
# fail 1
```
The shape: `seq: 510`, `reserved: 15`, `reservedSeqs` = ten numbers at
31..40 (all below the reader's floor of 300), log keeps 50 lines at
451..500. The window 300..510 holds 196 lines; base answers 206.
## Ran
```
git rev-list --count ab3604d..HEAD # 1
TZ=UTC npm test (core suite) # 3230/3230
node --import ./test/harness-resolve.mjs --test \
test/read-group-total-below-floor.test.js # 4/4
# the eight room/group suites 108/108
node scripts/ds-bot-patches.mjs generate / check / canonical # green, no-op
ARCH_DOCS_BASE=ab3604de938db1c4519a05b197a1349010dc38a8 npm run arch-docs # OK (6 changed file(s))
TZ=UTC npm run verify # exit 0
```
One environment note, so the machine is not a mystery: this box has a
real `pnpm` in `/usr/bin`, and `core/test/bench-preflight.test.js` drops
every `PATH` directory that holds one — which on this box drops
`/usr/bin` and with it `mkdir`. That test fails identically on the
unmodified base `ab3604de` (6 pass / 1 fail, same `mkdir: not found`),
so the `verify` above ran with a `PATH` that is the same box minus
`pnpm`; there core is 3230/3230 and both plugin suites are green. CI has
no `pnpm` there and is the machine that decides.
## Not run
- `core/dev/bench.sh smoke … && node dev/smoke.mjs` — not run for this
change.
## Checkpoint
<!-- flybot:checkpoint -->
{
"pr": 3047,
"claim": "Dev-1",
"issue": 3046,
"summary": "read_group_chat's newest N of TOTAL discounted only the
bookings room.reservedSeqs names, so a room whose booking list is
shorter than its reserved count trusted a list that cannot place it: a
window holding 196 lines read newest 30 of 206. A list shorter than the
count now reads as unknown and keeps the room-wide discount, the
fallback an older room with no list already had. A room whose list
covers its count keeps the per-booking arithmetic #3039 added, and a
room with no floor booking is unchanged.",
"files": [
"core/src/host/groups.js",
"core/test/read-group-total-below-floor.test.js",
"docs/subsystems/core-host.md",
"patches/ds-bot/0012-room-membership.patch",
"patches/ds-bot/files/test/read-group-total-below-floor.test.js",
"changelog.d/3046-room-short-booking-list.fixed.md"
],
"checks": {
"ran": "TZ=UTC npm run verify",
"result": "green",
"at": "ca1d3ba0405f1384b1e3042960f0aebd51601fa0"
},
"next": "none \u2014 ready for review"
}
<!-- /flybot:checkpoint -->1 parent 4fae033 commit 6bd98a7
6 files changed
Lines changed: 51 additions & 4 deletions
File tree
- changelog.d
- core
- src/host
- test
- docs/subsystems
- patches/ds-bot
- files/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
1065 | | - | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
1066 | 1072 | | |
1067 | 1073 | | |
1068 | 1074 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2118 | 2118 | | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | | - | |
| 2121 | + | |
2122 | 2122 | | |
2123 | 2123 | | |
2124 | 2124 | | |
| |||
2145 | 2145 | | |
2146 | 2146 | | |
2147 | 2147 | | |
2148 | | - | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
2149 | 2155 | | |
2150 | 2156 | | |
2151 | 2157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
0 commit comments