# Partial restores: the missing hard-link peer

Research continuation of [PR #2345](https://github.com/hesela/hesela-seo/pull/2345)
and [scope #2340](https://github.com/hesela/hesela-seo/issues/2340), 2026-10-23.
Candidate for review, not public publication or independent peer review.

## Read first

[Synthesis](synthesis.md) explains the recovery consequence.
[Generated results](results.md) contains every build/scenario/selection/policy row.
[Claims](claims.json) links the main findings to exact machine-readable cases.
[Sources](sources.json) identifies the pinned manual, implementation and OS contracts.

This study adds an explicit selection boundary to the parent experiment.
The complete original 19-file package and its SHA256SUMS remain unchanged.

## Method and denominator

Five initial relationship scenarios, two explicit file selections, four policies
and two identified builds give 80 configurations. Each configuration runs twice
in each of two retained captures: 160 invocations per capture, 320 new invocations
in total. The parent study's 320 invocations are a separate population.

Each fixture has src/a, src/b, dst/a and dst/b. Three scenarios also have
outside/retained, initially another hard link to dst/a. All files initially
contain the same 4096 constructed bytes, mode 0600 and fixed modification time.
The source is quiescent and never aliases the destination.

The selection is passed as exact NUL-separated stdin to --files-from=- --from0.
It contains either a alone or both a and b. No directory is listed; no recursive
discovery is inferred from archive mode. Policies are -aHc, -aHI,
-aHI --inplace and -ac. Complete arguments, stdin, stdout, stderr and exit codes
are retained for every invocation.

After transfer, a 16-byte in-place write to dst/a exposes which other names
share its file. This is a controlled write into newly created disposable files,
not a corruption test of real backups. All data readouts are generated from
native filesystem observations, not simulated metadata.

## Environment

Linux 6.8.0-146-generic, x86_64, Python 3.12.3, glibc 2.39, unprivileged UID 1001.
findmnt -T /tmp -n -o FSTYPE reported ext4. The raw observations retain the
stat -f -c %T label ext2/ext3, which does not distinguish this ext4 mount.

The same two executable fingerprints as the parent study were observed:
the distribution rsync 3.2.7 binary and an existing upstream 3.4.1 build.
See the parent's README for the second build's flags and provenance limits.
Neither binary was rebuilt here; these are not independent-host replications.

## Reproduce

Run from this directory after checking out the complete research package.
Python's standard library, local rsync and GNU stat are sufficient.
No network transfer, package installation, privileged mount or backup-tree
argument is required.

~~~sh
python3 -B observe.py --rsync /usr/bin/rsync --output fresh.json
python3 -B observe.py --rsync /usr/bin/rsync --output fresh-repeat.json
python3 -B -c 'import analyze_selection as a; a.compare(a.read("fresh.json"), a.read("fresh-repeat.json"))'
python3 -B -m unittest -v
python3 -B -O -m unittest -v
python3 -B analyze_selection.py --check
sha256sum -c SHA256SUMS
~~~

Repeat --rsync for another executable. Output capture paths must not exist.
The retained-data tests also execute eight fresh key controls using
/usr/bin/rsync. If another build disagrees, retain that result and investigate;
do not silently label it a successful replication.

compare validates the complete matrix, commands, selected stdin, original
source state, hashes, file attributes, alias relations and write propagation.
It then normalizes device/inode identities into equivalence classes and excludes
only the post-write wall-clock mtime and repetition label. Original raw values
remain in both captures. Build fingerprints and version strings must agree.
Generated summary.json and results.md are recomputed, never hand-entered.

The current directory's tests are separate from the parent directory's suite;
run both. No site files, public corpus records or generated website exports
are changed by this addition.

## Limits

This demonstrates documented interface boundaries, not a new rsync defect.
The designed configurations are not a random population and yield no failure
probability. Ownership, ACLs, xattrs, concurrent writers, remote filesystems,
bind mounts, open external handles, crashes, media independence, performance
and application recovery are outside the experiment. The later write is not
fsync evidence. The inference about extra directory links assumes complete,
quiescent enumeration of regular-file names with trustworthy device/inode and
link-count reporting. Preserve the captured path set as part of every claim.
