# FTS5: a passing check can miss different tokens

Hesela research supplement, 1 November 2026. Extends research #3297 and
scope #3295; it does not replace the earlier token-equivalence experiment.

## Finding and boundary

A deliberately stale external-content FTS5 index can pass the rank=1
integrity check even when its token instances disagree with current content.
In the bounded fixture, update the document from az to bq without maintaining
the index. The check succeeds, searching az returns the now-bq document,
and searching bq returns nothing. Rebuilding the disposable copy restores
queries to the current bq content; it does not restore historical az.

This is different from the earlier minus/accent examples, where token
instances really were equal. Here they are unequal, but an internal checksum
collides. No cryptographic hash was broken. No field frequency, vulnerability,
newly introduced regression or priority-of-discovery claim is made.

## Why these two strings?

The pinned SQLite entry-checksum function repeatedly computes
r = 9*r + component modulo 2^64. The same row ID, column, position and main
index prefix produce the same starting r for both two-byte ASCII terms.
The final term contribution is identical:

    9*97 + 122 = 9*98 + 113 = 995

For rowid=1, column=0, position=0 and main-index prefix '0', both complete
entry checksums are 63932. The noncolliding br control is 63933.
The storage-side callback XORs entry checksums; this one-token fixture needs
no aggregate cancellation. Row count and token count also remain unchanged.

The Python model is restricted to ASCII and the specified main-index fields.
It is not a reimplementation or certification of all SQLite integrity logic.
A separately compiled, unmodified upstream checksum function checks the
arithmetic; native SQL checks establish what the actual libraries did.

## Reproduction

Use an FTS5-enabled Python/SQLite build. No installation is required by the
probe, and it never opens an existing database.

    python3 -B observe.py --output fresh.json
    python3 -B -m unittest -v test_observe
    python3 -B -O -m unittest -v test_observe

Three designed fixtures: unchanged az; collision az to bq; noncollision az
to br. Each records baseline, changed source, completed backup and rebuilt
backup, all three diagnostic results, exact token instances, query answers,
row hashes and database-image non-mutation checks. There are no triggers,
prefix indexes, custom tokenizers, concurrent writers or device faults.

Frozen full captures preserve environments, source IDs, SQL traces and errors.
The explicit outcome projection compares measured behavior across builds;
trace text, serialized images and runtime metadata are not required to match.
Such differences are retained, not silently presented as identical bytes.
Repeating the probe checks repeatability, not independent peer review.

## What to do with the result

Treat rank=1 as a useful bounded diagnostic, not a cryptographic certificate
or a proof of exact index/content equality. Maintain the index through the
documented update/trigger mechanism. Preserve the received state before any
repair and inspect the intended queries. Where exact token agreement matters,
compare the observed index with a fresh tokenization under the same schema
and tokenizer in an isolated, consistent snapshot. This fixture illustrates
that comparison; it is not a general-purpose production validator.

Keep current search consistency separate from historical preservation.
A rebuild can fix current search but cannot decide whether bq or az is the
authorized content. That requires a trusted prior/application reference.

## Evidence and source scope

SOURCES.json pins exact upstream files and locators. Upstream source explains
the mechanism but is not asserted byte-identical to a distribution binary.
Native observations and the source-algebra check are separate evidence types.
The prior five-case packet, its sources, data and archives remain unchanged.
This supplement is research evidence awaiting normal publication/review gates.

SQLite source headers disclaim copyright; snapshots retain their headers.
Hesela code and synthetic observations follow existing repository reuse terms.
No blanket new license or third-party paper redistribution is implied.
