test-go / test (push) Failing after 44s
test-web / test (push) Successful in 49s
test-go / integration (push) Failing after 2m42s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (releases and dev) (push) Canceled after 4m8s
Rule 25: the fingerprinting knobs move out of source into a DB-backed singleton (migration 0061), edited from a card on the Duplicates page and shared live with the scanner, the backfill and the duplicate sweep through one service instance, so a save needs no restart. The length is the knob that can silently break the library: prints taken at two lengths never match. Each track_fingerprints row now records the length it was taken at, and every reader filters on the current one — the backfill treats another length as stale, the gauge counts it pending, the sweep never streams it. Equivalent to a version bump, except that setting the length back makes rows not yet redone current again. The card warns before a length change re-fingerprints the library. Off stops every decode: the scan takes only the stream hash (a demux, and what recognises a moved file) and stores nothing, dropping a changed file's stale row; the backfill idles. A save also makes a sweep due, since a new threshold or length changes what the same prints group into, and the sweep interval gains slack so an hourly interval on an hourly tick doesn't skip every other tick. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SQ31KQpYbStyK5y58UmPLH
51 lines
2.7 KiB
SQL
51 lines
2.7 KiB
SQL
-- 0061_fingerprint_settings.up.sql — fingerprinting's knobs, in admin Settings
|
|
-- (Scribe #3913, milestone #400). Rule 25: anything an operator might tune is a
|
|
-- database row, changed without a restart. Singleton in the style of
|
|
-- reacquisition_settings (0056).
|
|
CREATE TABLE fingerprint_settings (
|
|
id boolean PRIMARY KEY DEFAULT true,
|
|
|
|
-- Fingerprinting new files, the backfill, and the duplicate sweep. Off stops
|
|
-- the decode work entirely — the reason to turn it off is a slow NAS, and
|
|
-- that is the operator's call. On by default: a library that cannot tell its
|
|
-- duplicates apart is what milestone #400 exists to end.
|
|
enabled boolean NOT NULL DEFAULT true,
|
|
|
|
-- Seconds of audio fpcalc fingerprints. Chromaprints taken at different
|
|
-- lengths cannot be compared, which is why track_fingerprints records the
|
|
-- length each row was taken at (below): change this and every chromaprint is
|
|
-- re-derived, and until then only rows at the new length are compared.
|
|
chromaprint_length_sec integer NOT NULL DEFAULT 120,
|
|
|
|
-- The most disagreement two aligned fingerprints may show and still be
|
|
-- proposed as one recording. Unrelated audio sits near 0.5, so the ceiling
|
|
-- stays well clear of it.
|
|
acoustic_max_bit_error_rate double precision NOT NULL DEFAULT 0.15,
|
|
|
|
-- Files the backfill decodes at once. Decoding competes with playback
|
|
-- transcoding for CPU and with streaming for the mount.
|
|
backfill_concurrency integer NOT NULL DEFAULT 2,
|
|
|
|
-- The least time between duplicate sweeps. A sweep still runs only when
|
|
-- fingerprints have changed since the last one.
|
|
sweep_interval_hours integer NOT NULL DEFAULT 1,
|
|
|
|
-- When the settings were last saved. A new threshold or length can change
|
|
-- what a sweep finds, so a save makes a sweep due.
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
|
|
CONSTRAINT fingerprint_settings_singleton CHECK (id = true),
|
|
CONSTRAINT fingerprint_settings_length_range
|
|
CHECK (chromaprint_length_sec >= 30 AND chromaprint_length_sec <= 600),
|
|
CONSTRAINT fingerprint_settings_threshold_range
|
|
CHECK (acoustic_max_bit_error_rate >= 0.01 AND acoustic_max_bit_error_rate <= 0.35),
|
|
CONSTRAINT fingerprint_settings_concurrency_range
|
|
CHECK (backfill_concurrency >= 1 AND backfill_concurrency <= 8),
|
|
CONSTRAINT fingerprint_settings_sweep_interval_range
|
|
CHECK (sweep_interval_hours >= 1 AND sweep_interval_hours <= 168)
|
|
);
|
|
INSERT INTO fingerprint_settings (id) VALUES (true) ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Every row written so far was taken at fpcalc's default length.
|
|
ALTER TABLE track_fingerprints ADD COLUMN chromaprint_length_sec integer NOT NULL DEFAULT 120;
|