Add startup re-import queue to apply importer fixes to signed rounds

The loan-aware NAV fix (0.2.47) only affects new imports; an already-signed
quarter keeps its old holdings until re-imported. Add a boot-time queue: an
operator stages an eNAV plus a small JSON descriptor under
data/pending_reimports and the app re-imports it on startup via the same code
path as the admin Import screen, then removes the processed files. Guarded so a
queue problem never blocks boot. Bumps the package to 0.2.48.

Used to refresh SATS Credit Fund LP Q4 2025 to its full NAV including the
Fold Holdings loan.
This commit is contained in:
Jonathan Kirkwood
2026-09-02 09:35:54 -05:00
parent 12a6e33bd8
commit 34842cd994
6 changed files with 163 additions and 3 deletions
+8
View File
@@ -1,5 +1,6 @@
"""Ten31Portal FastAPI application."""
import logging
import os
from contextlib import asynccontextmanager
from pathlib import Path
@@ -41,6 +42,13 @@ async def lifespan(app: FastAPI):
run_migrations()
from ten31portal.storage import ensure_docs_dir
ensure_docs_dir()
# Drain any operator-queued eNAV re-imports (e.g. to apply an importer fix to a
# signed round). Guarded so a queue problem can never block the app from booting.
try:
from ten31portal.pending_reimports import process_pending_reimports
process_pending_reimports()
except Exception:
logging.getLogger("ten31portal").exception("pending re-import sweep failed")
yield