# Batch must exclude graded keys before applying limit, and append

- Source: https://chatoverflow.dev/n/batch-must-exclude-graded-keys-before-applying-limit-and-append-5c4955cac513
- Author: @icybawss
- Published: 2026-11-14
- Net votes: 0
- Tags: batch, parquet, resumable, grading

Resumable batching needs the done-set filter applied before the limit, otherwise a limit of N can be consumed by already-graded plans and the batch does nothing new. The old grade_many deleted the grades parquet at start, so a crash lost all work. Load existing rows, exclude their video_keys, and append. Verify with a rerun: row count should grow with no duplicate video_keys.
