Repository navigation
Commit d698f73
authored
Pin the capped own-chat read's window and its count (#2892)
Fixes #2891
`read_own_chat` with no words answers the newest 12 messages of a Bot's
chat with the user (`OWN_CHAT_READ`) and says how many it left out, with
`more` coming from the chat index's count (`core/src/host/chat-index.js`
`latestOwnChat`). No test asserted that heading, so a change that lost
the count still left the 12 lines in place and the chat read as a short
one.
The new row seeds a 20-message chat and pins three facts together: 12
lines shown, the `Your own chat (newest 12 of 20, oldest first)`
heading, and the last line the newest message.
### Mutation (the red)
The row pins present, correct behaviour, so the red is a mutation: with
`latestOwnChat` returning `more: 0`, the heading degrades to `Your own
chat (oldest first):` and the row fails. Restored, it passes twice.
### Not already covered
`grep -rn 'Your own chat' core/test/*.test.js` finds only the own-chat
*brief* sentences in `context-sharing.test.js`; no test asserts the
capped read's heading or its `newest N of M` count.
### What I ran
- The new file alone, twice, green, and once with the mutation above,
red (`Your own chat (oldest first):`).
- `TZ=UTC npm run verify` — green (`EXIT=0`).
- `node scripts/ds-bot-patches.mjs generate` then `check` — only the new
mirror `patches/ds-bot/files/test/own-chat-read-window.test.js` appears;
`core/ equals ds-bot/ + patches/ds-bot/`.
- `node core/scripts/check-arch-docs.mjs` with `ARCH_DOCS_BASE=7bf75332`
— `arch-docs: OK (3 changed file(s))`.
- `node .github/scripts/changelog.mjs check` — `22 fragment(s) in
changelog.d/ are well formed`.
Not run: `smoke` — it cannot start in this checkout (`EROFS` symlinking
the pnpm store into `.dsh-test-smoke`), so it is skipped rather than
counted green.
No `core/client.js`, no existing test and no `*.patch` file is touched:
the only generated entry is the new test mirror, which the `core/ equals
ds-bot/ + patches/` check requires.
Owner: Dev-1
Reviewer: Birfy
Written-by: Dev-1
Bot: Dev-1
Claim-Id: fdad58c6acac4449b4c9655f2a5c9f06
Risk tier: T1
Base: `7bf753325a46fa7a5a2777f1f4a560f40927f638` (live `main` at push
time)
Verified commit: `ae2e501ee0ef10fcc160bd059033d2a74ed8534a` (tree
`fad46a48351c5210fd8d70812fba267196e6dc9d`)
## Checkpoint
<!-- flybot:checkpoint -->
```json
{
"pr": 2892,
"claim": "Dev-1",
"issue": 2891,
"summary": "Pins the capped own-chat read: 12 lines, the `Your own chat (newest 12 of 20, oldest first)` heading, and the newest message last. Returning `more: 0` degrades the heading to `Your own chat (oldest first):` and the row fails, so the count cannot be lost silently. Test-only change plus its generated mirror and one changelog fragment.",
"files": [
"core/test/own-chat-read-window.test.js",
"changelog.d/2891-own-chat-window.changed.md",
"patches/ds-bot/files/test/own-chat-read-window.test.js"
],
"checks": {
"ran": "the new file alone twice, once with the mutation red; TZ=UTC npm run verify; ds-bot-patches generate+check; arch-docs; changelog check",
"result": "green",
"at": "007f0ed6e0e57d07661c03976c55bd4a0b47e87a"
},
"next": "none — ready for review"
}
```
<!-- /flybot:checkpoint -->1 parent a7afa9d commit d698f73
3 files changed
Lines changed: 145 additions & 0 deletions
File tree
- changelog.d
- core/test
- 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 | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
0 commit comments