fix: surface the fundamentals cache result on every SEC job outcome
The runtime message only appended the cache summary when the import itself completed. On a deferred, failed or source-locked run Admin → Jobs showed just the import outcome, so an operator had no signal that `fundamental_data` had advanced — contradicting the claim now made in the docstring, the schedule hint and the deployment doc. The import status still varies and stays the headline; the cache summary is appended to all of them. Adds a source-locked regression test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+15
-16
@@ -905,24 +905,23 @@ async def run_sec_fundamentals_import() -> None:
|
||||
f"cache {summary['refreshed']} · "
|
||||
f"{summary['score_inputs_changed']} score inputs changed"
|
||||
)
|
||||
# Every outcome carries the cache summary — including deferred, failed and
|
||||
# source-locked ones. The import status is what varies; the refresh always
|
||||
# happened, and Admin → Jobs is the only place an operator sees that.
|
||||
runtime = get_job_runtime_snapshot(job_name)
|
||||
if not import_ran:
|
||||
_runtime_finish(
|
||||
job_name,
|
||||
"completed",
|
||||
processed=1,
|
||||
total=1,
|
||||
message=f"Import disabled · {cache_message}",
|
||||
)
|
||||
elif runtime.get("status") == "completed":
|
||||
if import_ran:
|
||||
status = str(runtime.get("status") or "completed")
|
||||
import_message = runtime.get("message") or "import completed"
|
||||
_runtime_finish(
|
||||
job_name,
|
||||
"completed",
|
||||
processed=1,
|
||||
total=1,
|
||||
message=f"{import_message} · {cache_message}",
|
||||
)
|
||||
processed = 1 if status == "completed" else 0
|
||||
else:
|
||||
status, import_message, processed = "completed", "Import disabled", 1
|
||||
_runtime_finish(
|
||||
job_name,
|
||||
status,
|
||||
processed=processed,
|
||||
total=1,
|
||||
message=f"{import_message} · {cache_message}",
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user