Fold one frame per press, not eight -- and put snapshots where the user can find them

Four matches, each followed by a template save, then five consecutive failures.
Jorijn asked whether it was user error. It was not.

Over one evening the harvest folded 185 frames into a template whose
max_sub_template_num is 96, and the template went from matching ten presses out
of ten to failing five in a row. The frames one press contributes are
near-duplicates of a single image, so folding eight of them per press does not
add coverage: it spends the template's slots on one finger position and evicts
the diversity the enrolment put there. Stock's roughly forty-six updates in a
session are spread across many separate presses, which is where diversity
actually comes from.

So one fold per matched press, which also needs no extra capture at all because
the matching frame is already inside the trustlet. Eight remains available for a
deliberate experiment.

The snapshot directory was resolved from $HOME while the script is run under
sudo, so every snapshot landed in /root/fp6-backups and looked, from the user's
shell, like it had never been taken. That is the one thing that would have made
this unrecoverable, and it was caught only because the restore was needed. It
now resolves the invoking user's home.
This commit is contained in:
Jorijn van der Graaf 2026-09-05 01:36:10 +02:00
commit 756093e847
2 changed files with 22 additions and 8 deletions

View file

@ -111,12 +111,22 @@ bool g_learn = true;
// Dump the trustlet's own log out of the response buffer after every command.
// See DumpTaLog: on pmOS this is the ONLY way to read it.
bool g_taLog = false;
// How many frames one press may contribute. Stock has no explicit bound -- it
// harvests until the finger lifts -- but a finger left resting on the sensor
// should not grow the template without limit, and the template body has a hard
// ceiling: it moves as a SINGLE gpfile op against a 516084-byte listener
// buffer, and a 30-sample body already measured 386402.
int g_learnMaxFrames = 8;
// How many frames ONE PRESS may contribute, counting the matching frame.
//
// 1, and that is a correction rather than a default. At 8 it folded 185 frames
// across one evening against a max_sub_template_num of 96, and the template
// went from matching ten presses out of ten to failing five in a row --
// measured 2026-09-05, four matches each followed by a save, then nothing. The
// frames a single press contributes are near-duplicates of one image, so
// feeding eight of them per press does not add coverage, it spends the
// template's slots on one position and evicts the diversity the enrolment put
// there.
//
// Stock's ~46 updates in a session are spread over many separate presses, which
// is where real diversity comes from. One fold per matched press mirrors that
// and needs no extra capture at all, because the matching frame is already in
// the trustlet. Raise it only for a deliberate experiment.
int g_learnMaxFrames = 1;
// The namespace key the trustlet hashes into the SFS group's directory name.
// It defaults to Android's because that is what this device's existing store

View file

@ -90,7 +90,11 @@ restart() { # $1 = extra args
printf ' TIMED OUT\n'; return 1
}
SNAPDIR=$HOME/fp6-backups/snapshots
# NOT $HOME: this script is run under sudo, where HOME is root's, so snapshots
# silently landed in /root/fp6-backups and `ls ~/fp6-backups/snapshots` said
# they did not exist. Resolve the INVOKING user's home instead.
SNAPHOME=$(getent passwd "${SUDO_USER:-$(id -un)}" | cut -d: -f6)
SNAPDIR=${SNAPHOME:-$HOME}/fp6-backups/snapshots
case "${1:-}" in
snapshot)
@ -144,7 +148,7 @@ wipe)
# taken first because a template is not reproducible without a finger.
echo "=== wipe: every stored template ==="
echo "before:"; sizes
D=$HOME/fp6-backups/$(date +%Y-%m-%d-%H%M)-pre-wipe
D=${SNAPHOME:-$HOME}/fp6-backups/$(date +%Y-%m-%d-%H%M)-pre-wipe
mkdir -p "$D"
sudo tar -cf "$D/persist-data.tar" -C /mnt/persist data
sudo cp "$MAP" "$D/" 2>/dev/null || true