Skip to content

Fix SearXNG updater, guard against empty upstream lists - #14

Merged
19-84 merged 1 commit into
mainfrom
fix-searxng-updater
Aug 23, 2026
Merged

19-84 merged 1 commit into
mainfrom
fix-searxng-updater

Conversation

@19-84

@19-84 19-84 commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Found while validating instance health after #11.

The bug

searxng has 0 instances in both services.json and services-full.json, so every SearXNG redirect has been falling through to the fallback.

searx.space is alive and serving 723 KB of data, but it stopped populating the .generator field — it is now null for all 89 instances it tracks. Our filter did:

select(.value.generator | . != null) |
select(.value.generator | contains("searxng"))

which matches nothing, so every nightly run wrote an empty list. Bisecting the filter against live data:

total instances                    89
+ network_type==normal             78
+ generator contains searxng        0   <-- everything dies here

searx.space only tracks SearXNG these days, so .version being present is the check that actually matters. Dropping the generator predicate recovers 39 instances, all of which still pass the existing quality gates (uptime ≥ 99, A/A+ TLS and HTTP grades, non-privacy ASN, no .i2p).

The bigger problem

This went unnoticed for weeks because apply_update wrote whatever it was handed. Any upstream source that changes schema or goes down silently takes a whole service offline — and tent's source (forgejo.sny.sh) is already unreachable, so this would have happened again.

apply_update now refuses to replace a non-empty instance list with an empty one: it keeps the previous entries and emits a ::warning:: annotation. Stale entries are harmless — the runtime health check prunes dead instances on every sweep — whereas an empty list is a full service outage.

Deliberately narrow: it only triggers on empty-vs-non-empty, so genuine shrinkage (10 → 2) still applies normally.

Validation

Ran the real apply_update and the real SearXNG block in a container against live searx.space data and the current services-full.json:

check result
searxng instance count 0 → 39
survive tools/un-cloudflare.sh 39/39 — so both JSON files get all of them
other 21 services after update byte-identical
trailing slashes stripped yes
leftover temp files none

Guard cases:

case expected result
normal update (rimgo 24 → 25) applied ✅ applied
upstream empty, service populated (nitter 8 → 0) kept + warned ✅ kept 8, warning emitted
service already empty (tent) stays empty, no warning ✅ 0 warnings
no-op update file unchanged ✅ content identical

After merge I'll dispatch the workflow and confirm searxng lands in the committed JSON.

Not included

tent (source gone) and whoogle (0 of 5 alive — 2 NXDOMAIN, 1 timeout, 1 non-200) are dead and are candidates for retirement, but that's a product call rather than a bug fix, so I left them alone.

🤖 Generated with Claude Code

https://claude.ai/code/session_017RU5GnqJo2CsjM4zoPX5jv

searx.space stopped populating the .generator field -- it is now null for all
89 instances it tracks. The SearXNG filter did:

  select(.value.generator | . != null) |
  select(.value.generator | contains("searxng"))

which therefore matched nothing, so every nightly run wrote an empty instance
list and the service has been dead in both services.json and
services-full.json. searx.space only tracks SearXNG these days, so .version
being present is the check that actually matters; dropping the generator
predicate recovers 39 instances, all of which pass the existing quality gates
(uptime >= 99, A/A+ TLS and HTTP grades, non-privacy ASN).

The bigger problem is that this went unnoticed for weeks: apply_update wrote
whatever it was handed, so a source that changes schema or goes down silently
takes a whole service offline. It now refuses to replace a non-empty instance
list with an empty one, keeping the previous entries and emitting a
::warning:: instead. Stale entries are harmless -- the runtime health check
prunes dead instances anyway -- whereas an empty list is a full outage.

Verified against live searx.space data and the current services-full.json:
searxng 0 -> 39, all 39 survive tools/un-cloudflare.sh, other services
byte-identical, no leftover temp files. Guard tested for normal updates,
empty-list rejection, already-empty services (no false warning), and no-op
runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RU5GnqJo2CsjM4zoPX5jv
@19-84
19-84 merged commit 82aaa6f into main Aug 23, 2026
12 checks passed
@19-84
19-84 deleted the fix-searxng-updater branch August 23, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant