# GDBM recovery selection: counters do not identify a database

Publication package, revised 4 November 2026. The nine original selector cases
are retained unchanged; a four-case usability supplement is described below.
Linux x86-64, GDBM 1.23 only.

## Result and boundaries

Two valid images from independently created databases with synchronization
counts 1 and 2 are accepted; the selector chooses the second database.
Two images from one database with counts 1 and 3 return SUSPICIOUS.
Both pairs deliberately violate the expected alternating-snapshot history.
This is **not** evidence of data loss in GDBM's correctly used protocol.

Changing only file mtimes reverses selection for standard-format inputs.
The adjacent same-origin numsync control resists that reversal; equal foreign
counters reach the mtime fallback. See observation.json and results-table.md.

The seven images are constructed fixtures, **not** outputs of
gdbm_failure_atomic. No crash, concurrent mutation, power interruption,
counter wrap or performance test occurred; no reflink capability was exercised.
Lineage is a test key, not a cryptographically authenticated identifier.
Preserve original evidence and independently establish expected database
identity. Do not change permissions or timestamps just to force acceptance.

## Review and correction

A separate agent reviewed source/prose and independently reproduced the same
nine outcomes and seven fixture hashes with the same native binary but a
different Python/kernel/filesystem environment. It found a borrowed filename
lifetime defect in the ctypes wrapper. The revised probe retains both encoded
filenames until the returned pointer is decoded. A regression test failed on
the original wrapper and passes on this revision.

Both captures here were newly executed with the corrected probe. Their
probe_sha256 binds this revision; all nine outcomes and seven fixture hashes
are unchanged from research commit 5526b86d976ba7f50a3671acf82c81f2e6345b8e.
The original package, including the flawed wrapper and original captures, is
preserved under content/research/gdbm-snapshot-selection in that Git history.
Do not mix its captures with this revision's verifier.

The exact GNU 1.23/1.26 source comparison was reviewed by the integrating
agent, not independently reproduced by the second reviewer. Native 1.26 was
not executed. sources.json preserves the original retrieval record; claims.json
maps five bounded claims to the same case and source IDs. The inaccessible
ACM Queue paper is only a further-reading pointer, not evidentiary support.

## Reproduce

Requires Linux x86-64, Python 3.12 and a GDBM 1.23 shared library with snapshot
selector support. No Python packages or production files are needed.

```sh
sha256sum -c SHA256SUMS
PYTHONDONTWRITEBYTECODE=1 python3 verify.py
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest -v test_probe.py
PYTHONDONTWRITEBYTECODE=1 python3 -O -m unittest -v test_probe.py
PYTHONDONTWRITEBYTECODE=1 python3 probe.py --output /tmp/gdbm-selection.json
```

The 17 tests include a fresh native replay, all input-file checks, negative
receipt mutations and the wrapper lifetime regression. The exact-capture
test intentionally requires the recorded environment. On another supported
environment, compare rows and fixtures separately and retain the new environment
fields; do not rewrite a historical receipt to claim an exact replay.

The read-only verifier checks the retained evidence; the probe uses disposable
temporary files. Native library version, binary hash, ABI, Python version,
kernel, filesystem and wrapper hash appear in each capture.

package.py deterministically rebuilds SHA256SUMS and the downloadable ZIP from
an explicit allowlist. Upstream GNU source archives are not redistributed.
Official sources: GNU 1.23 release, src/gdbmsync.c and doc/gdbm.texi; GNU manual
Numsync and Crash Tolerance API. URLs and pinned source hashes are in sources.json.

## Selection versus opening: 4 November supplement

usability.py calls the same native selector, then separately attempts to open
its selected file in reader mode with GDBM_XVERIFY. Four constructed controls:
valid adjacent images open successfully; one readable non-database and two
readable non-databases with different mtimes produce OK but fail reader-open;
equal-time non-databases produce SAME with no selected filename.

The pinned 1.23 src/gdbmsync.c returns a sole readable candidate without opening
it; for two readable candidates, unavailable counters and equal counters share
the timestamp fallback. Its hash was rechecked against sources.json. The 1.26
file still differs only in its copyright year; 1.26 was not executed.
The new captures usability.json and usability-replay.json agree exactly.
These are deliberate input-precondition violations, not damage produced by a
crash, a vulnerability claim or failure of correctly used snapshotting.
A successful reader-open is not application-level validation. The supplement
was verified by its author, not the earlier independent reviewer.

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest -v test_probe.py test_usability.py
PYTHONDONTWRITEBYTECODE=1 python3 -O -m unittest -v test_probe.py test_usability.py
PYTHONDONTWRITEBYTECODE=1 python3 usability.py --output /tmp/gdbm-usability.json
```

Seven supplementary tests check native replay, identical retained captures,
case coverage, input hashes and rejection of false reader acceptance, altered
status, scope and harness. The original observation/replay/fixture bytes and
probe implementation are unchanged. This package now has 22 members including
the checksum manifest; its 21 payload files are explicitly allowlisted.
