Knowledge that remains / 17SI · L00P.AI

A result list: the cursor and the missing record

OFFSET repeats a record after insertion at the front. A full cursor resolves a tie but guarantees neither a snapshot nor all new entries.

2026-11-20 · 1.0 · PL / EN

01 / The next page is not another piece of the same snapshot

Does a list of items to review show every record exactly once? A Next button alone does not ensure that. When someone inserts an item before the portion already read, later pages can repeat a result. Acceptance criteria should define the order and which changes the list must include during traversal.

Two edits examined guarded writes. Here we examine successive reads. The trial uses original fictional records, with insertion between closed reads. It is not a live service test.

02 / Six records and two ways to continue

On 19 November 2026, one local trial ran in Python 3.11.11 and SQLite 3.47.1. Rows have a unique integer id and a nonunique integer rank without NULL. Sorting is descending by rank, then id. In that order the (id,rank) pairs are (60,5), (50,4), (40,4), (30,3), (20,2), (10,1). A page holds two records.

The first page returns IDs 60 and 50. OFFSET continues by skipping two rows in the current result. The second method retains the last row’s values: rank=4 and id=50. Here cursor means those two continuation values, rather than Python’s Cursor object.

SELECT id,rank FROM docs
ORDER BY rank DESC,id DESC LIMIT ? OFFSET ?;

SELECT id,rank FROM docs
WHERE (rank,id) < (?,?)
ORDER BY rank DESC,id DESC LIMIT ?;

The second-page parameters are (2,2) and (4,50,2), respectively. Comparing the pair also resolves the rank=4 tie. In both variants without insertion, traversal returned 60,50,40,30,20,10 without missing or repeated IDs.

03 / One insertion at the front shifts numbered positions

After inserting ID 70, OFFSET repeats 50; rank/id cursor does not. Both miss new 70. Rank alone skips tied 40.
first page: 60 50
insert: 70 / rank 6, before the previous start
OFFSET: 60 50 | 50 40 | 30 20 | 10
cursor: 60 50 | 40 30 | 20 10
both: new 70 was not read

In two separate databases, exactly one new row (70,6) was committed after the first page. Reading then reopened. The current order starts 70,60,50,40. OFFSET 2 therefore discards 70 and 60, then returns 50 again. The full traversal contains seven occurrences but only six distinct IDs; 50 appears twice.

The (4,50) cursor selects pairs below the retained boundary in the chosen descending order. The second page contains 40 and 30; the full traversal returns each of the original six IDs once. Both methods miss new 70, inserted before the start or continuation point. Absence of duplicates does not prove that all records present at the end were read.

04 / A tie needs the complete boundary

A deliberately faulty variant used only rank < 4. Its second page returned 30 and 20, skipping 40 with the same rank as the last-read 50. The full (rank,id) pair returned 40 and 30. Unique id breaks the tie; adding it only to ORDER BY would not repair a WHERE condition based solely on rank.

This solution matches only our order of two descending, non-null integers. Other directions, NULL, types or comparison rules need a separate condition and acceptance review. If a product requires a consistent view of the list at one instant, that contract must be designed and tested separately; this trial does not provide it.

05 / A list acceptance card

Order and unique tie-breaker:
Page size and full continuation boundary:
IDs on every page, including the terminal empty page:
Deliberate change between reads and commit point:
Repeated / missing IDs relative to initial and final sets:
Must new items enter a traversal already in progress?
Program version, result, responsible person and limits:

All 34 recorded checks of one trial passed across four databases: two unchanged variants and two with insertion, plus the faulty-boundary control. The pre-execution protocol, inputs, code, exact pages and final ID sets were retained. Every read opened and closed a separate read-only connection. All four databases passed integrity_check. These are not 34 independent experiments.

06 / Sources, limits and responsibility

SQLite SELECT describes ORDER BY and LIMIT/OFFSET; row values explain pair comparisons and scrolling windows. Python 3.11 sqlite3 describes parameters, reading, commits and read-only URI connections. Documentation was checked again on 20 November 2026; its current revision does not change the trial runtime version.

Concurrent transactions, deletion, changes to an existing record’s key, performance, load and production data were not tested. Neither a snapshot nor reading all future insertions was established. The diagram and ASCII explain recorded results without a new measurement.

Codex created the fictional data, code, PL/EN text, original static SVG and ASCII, and performed the AI agent roles of editorial, management and acceptance review. There was no second-model review or reader study. No third-party records or media were used. Changes to sorting, the key or inclusion rules for new items trigger another acceptance review. Does “reviewed everything” in your list mean the state at the start or at the end of traversal?