Store now indexes every Save into the upload_files table via SetRepo.
DB failures are logged as warnings and do not fail the upload because
.meta.json remains the source of truth and startup backfill recovers.
Add Store.Backfill to walk Root at startup and insert index rows for
any pre-existing .meta.json sidecars, swallowing duplicate-key races.
The upload_file MCP Tool now writes an audit_log entry on success.
Tests cover dual-write args, repo-error non-failure, and backfill
skipping existing rows.
Co-Authored-By: Claude <noreply@anthropic.com>
Sweep() used to run synchronously at startup without any time bound.
On a large uploads directory this can block the server for 30s or more,
keeping /healthz returning 503 while the reaper works. Add a context
timeout so startup continues if the sweep cannot finish within budget.
The timeout is set to 5 seconds: long enough to clear typical leftover
state, short enough that a stuck sweep will not meaningfully delay
health checks or startup readiness.
Change Store.Sweep to accept a context.Context and check ctx.Err() at
the top of each iteration. If the context is cancelled or times out,
Sweep returns the files deleted so far and ctx.Err().
Add TestStore_Sweep_HonorsContextCancel to ensure a cancelled context
causes Sweep to exit early instead of running to completion.
Deliberately unchanged: there is still no periodic reaper. The server
only sweeps once at startup; this change just bounds that single sweep.
Co-Authored-By: Claude <noreply@anthropic.com>