fix: note the library-list scan cap; preset-cap note only with presets (M-11, M-12)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 04:19:05 +02:00
co-authored by Claude Opus 5.5
parent d8d7bb67be
commit 031f01451b
4 changed files with 54 additions and 3 deletions
@@ -105,6 +105,7 @@ final class LibraryListAbility implements Ability
'affected' => ['type' => 'array', 'items' => ['type' => 'object']],
'affected_count' => ['type' => 'integer'],
'hidden_count' => ['type' => 'integer'],
'notes' => ['type' => 'array', 'items' => ['type' => 'string']],
],
'required' => ['items', 'next_cursor'],
];
@@ -174,7 +175,7 @@ final class LibraryListAbility implements Ability
* null when no readable entry follows (or the scan cap is reached with nothing found).
*
* @param array<string, string|int> $filters
* @return array{items: list<array<string, mixed>>, next_cursor: ?string}
* @return array{items: list<array<string, mixed>>, next_cursor: ?string, notes?: list<string>}
*/
private function page(array $filters, int $limit, int $skip): array
{
@@ -199,7 +200,19 @@ final class LibraryListAbility implements Ability
}
}
return ['items' => $items, 'next_cursor' => $items === [] ? null : Cursor::encode($skip + count($items))];
// Review M-12: say why the page is short, so the client neither thinks the list ended nor loops.
return [
'items' => $items,
'next_cursor' => $items === [] ? null : Cursor::encode($skip + count($items)),
'notes' => [sprintf(
'Nach %d gelesenen Bibliothekseinträgen abgebrochen (Einträge ohne Bearbeitungsrecht werden '
. 'übersprungen); %s',
self::MAX_SCAN,
$items === []
? 'weitere Einträge mit Filtern (layout_type, scope, search, category) eingrenzen.'
: 'mit next_cursor weiterblättern oder mit Filtern eingrenzen.'
)],
];
}
/**