test(helpers): setSystemSettingRestored — leave shared settings as found

The testuser-experience rule: the suite must leave shared settings
exactly as it found them. setSystemSettingRestored snapshots the prior
system_settings row, writes through the sanctioned API path (the only
one that reloads the settings registry — raw SQL leaves the cache
stale), and registers a cleanup restoring what WAS there, never a
hardcoded value.

setExtractorVersion now rides it, so the ev-pin tests no longer
restore scan_extractor_version to a hardcoded 1: a deliberate dev bump
of the extractor version survives a suite run instead of being
silently cancelled (the live dev server obeys that setting on its next
poll and would stop re-extracting parser fixes). The now-redundant
explicit t.Cleanup restores are removed from
TestExtractorVersionReextract and pinExtractorVersionOne.
This commit is contained in:
John O'Keefe committed 2026-10-21 20:24:44 -04:00
1 parent f62b46fb15
commit 3ed852515b
3 files changed
+60 -14

No files matched your search

+2 -2
View File
@@ -32,11 +32,11 @@ import (
// the default 1 for the test's duration. Prior interrupted runs can
// leave it bumped (an early test failure aborts before its restore
// cleanup registers), and every stamp assertion in these tests assumes
// the default. The cleanup restores 1 — the repo's steady state.
// the default. Restore-to-prior rides inside setExtractorVersion: the
// suite leaves the setting exactly as it found it.
func pinExtractorVersionOne(t *testing.T, setup *TestServerSetup) {
t.Helper()
setExtractorVersion(t, setup, 1)
t.Cleanup(func() { setExtractorVersion(t, setup, 1) })
}
// forceScanTestFolder runs a FORCE scan over one folder.