Files
jsahnandClaude Fable 5 d9dda79282 Add per-paper summary verification and cap safeguards
- Per-paper summary batches are fact-checked against abstracts (verify ->
  revise once on major issues -> re-verify), controlled by SEBRIEF_VERIFY_ENABLED
- The paper cap never drops papers already published in this week's digest
  (--force re-runs could otherwise erase them from every digest)
- SEBRIEF_MAX_PAPERS default 40 -> 60 (observed weekly volume ~47)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-02 17:21:41 +09:00

55 lines
1.7 KiB
Python

"""Settings loading: CSV splitting, validation, derived properties."""
from __future__ import annotations
from pathlib import Path
import pytest
from pydantic import ValidationError
from sebrief.config import Settings
def make_settings(**overrides) -> Settings:
return Settings(_env_file=None, **overrides)
def test_defaults():
s = make_settings()
assert s.minimax_model == "MiniMax-M3"
assert s.minimax_fallback_models == ["MiniMax-M2.7", "MiniMax-M2.5"]
assert s.run_weekday == 0
assert s.run_time_kst == "07:00"
assert s.catchup_window_hours == 72
assert s.max_papers == 60
assert s.backfill_days == 7
assert s.verify_enabled is True
assert s.paper_summary_enabled is True
assert s.paper_summary_batch_size == 8
assert s.rss_feeds == []
assert s.db_path == Path("data") / "sebrief.sqlite3"
def test_csv_fields_split():
s = make_settings(
MINIMAX_FALLBACK_MODELS=" a , b ,",
SEBRIEF_RSS_FEEDS="e-Informatica|https://example.org/rss, X|https://x.example/feed",
SEBRIEF_EXTRA_BLACKLIST_ISSNS="1234-5678, 2345-6789",
)
assert s.minimax_fallback_models == ["a", "b"]
assert s.rss_feeds == ["e-Informatica|https://example.org/rss", "X|https://x.example/feed"]
assert s.extra_blacklist_issns == ["1234-5678", "2345-6789"]
def test_run_weekday_validated():
with pytest.raises(ValidationError):
make_settings(SEBRIEF_RUN_WEEKDAY="7")
assert make_settings(SEBRIEF_RUN_WEEKDAY="6").run_weekday == 6
def test_env_aliases(tmp_path):
s = make_settings(SEBRIEF_DATA_DIR=str(tmp_path / "d"), SEBRIEF_MAX_PAPERS="10")
assert s.data_dir == tmp_path / "d"
assert s.max_papers == 10
assert s.db_path == tmp_path / "d" / "sebrief.sqlite3"