fix(onebot): clarify get_file limitation + honest _mark_all_as_read summary

Adversarial review of Wave 1: get_file's 'file not found in cache' was
misleading for group-file file_ids (unsupported here, not uncached).
Distinguish the two in the error message, surface the limitation in the
summary, and lock the contract with a negative test. Also annotate
get_group_shut_list's ~60s cache-delay tradeoff and mark _mark_all_as_read
as an explicit no-op pending an RE'd one-shot read cmd.
This commit is contained in:
DrSmoothl committed 2026-06-18 00:05:20 +08:00
1 parent 84e5254c3a
commit dbb5160be7
2 files changed
+32 -6

No files matched your search

@@ -669,6 +669,17 @@ describe('extended-actions / get_file', () => {
expect(res).toMatchObject({ status: 'failed', retcode: 100 });
});
it('gives an unsupported-file_id message (not a misleading "not cached") for a group-file id', async () => {
// A group-file file_id cannot be resolved here (no group context); the
// error must say so rather than imply the file is merely uncached.
const getImageInfo = vi.fn(async () => null);
const getRecordInfo = vi.fn(async () => null);
const res = await makeHandler(fakeCtx(fakeBridge(), { getImageInfo, getRecordInfo }))
.handle('get_file', { file_id: '/abcdef-group-file-id' });
expect(res.status).toBe('failed');
expect((res as { wording?: string }).wording).toMatch(/unsupported|get_group_file_url/);
});
it('rejects when neither file nor file_id is given', async () => {
const res = await makeHandler(fakeCtx(fakeBridge())).handle('get_file', {});
expect(res).toMatchObject({ status: 'failed', retcode: 1400 });