Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b9c7984b4 |
@@ -5,6 +5,7 @@
|
||||
* Frueher: bp-core-rag-service:8097 — der existiert auf prod NICHT (nur macmini/dev),
|
||||
* dadurch lieferte die Drafting-Engine dort keinen RAG-Kontext. Die ai-sdk embeddet
|
||||
* mit bge-m3 und ist prod-erreichbar. Genutzt von draft-, chat- und vendor-review-Routes.
|
||||
* Fundstellen via article_label sind live ab dem Prod-Re-Ingest 2026-06.
|
||||
*/
|
||||
|
||||
const SDK_URL =
|
||||
|
||||
@@ -33,6 +33,12 @@ type RegulatoryNewsFilter struct {
|
||||
// GetRegulatoryNews scans all v2 obligations for upcoming deadlines
|
||||
// and returns formatted news items sorted by urgency.
|
||||
func GetRegulatoryNews(regulations map[string]*V2RegulationFile, filter RegulatoryNewsFilter) []RegulatoryNewsItem {
|
||||
return GetRegulatoryNewsAt(regulations, filter, time.Now().UTC())
|
||||
}
|
||||
|
||||
// GetRegulatoryNewsAt is GetRegulatoryNews with an injectable reference time so the
|
||||
// upcoming-deadline window is deterministic in tests (no time-bomb once a deadline passes).
|
||||
func GetRegulatoryNewsAt(regulations map[string]*V2RegulationFile, filter RegulatoryNewsFilter, now time.Time) []RegulatoryNewsItem {
|
||||
if filter.HorizonDays <= 0 {
|
||||
filter.HorizonDays = 365
|
||||
}
|
||||
@@ -40,7 +46,7 @@ func GetRegulatoryNews(regulations map[string]*V2RegulationFile, filter Regulato
|
||||
filter.Limit = 5
|
||||
}
|
||||
|
||||
today := time.Now().UTC().Truncate(24 * time.Hour)
|
||||
today := now.UTC().Truncate(24 * time.Hour)
|
||||
horizon := today.AddDate(0, 0, filter.HorizonDays)
|
||||
var items []RegulatoryNewsItem
|
||||
|
||||
|
||||
@@ -174,7 +174,10 @@ func TestGetRegulatoryNews_FromRealFiles(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Skipf("could not load v2 regulations: %v", err)
|
||||
}
|
||||
items := GetRegulatoryNews(regs, RegulatoryNewsFilter{Limit: 20, HorizonDays: 730})
|
||||
// Fixed reference date so the test is deterministic regardless of the wall clock:
|
||||
// VBR-OBL-001 (deadline 2026-06-19) must fall within [ref, ref+730d].
|
||||
ref := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
items := GetRegulatoryNewsAt(regs, RegulatoryNewsFilter{Limit: 20, HorizonDays: 730}, ref)
|
||||
// Should find at least the Widerrufsbutton obligation
|
||||
found := false
|
||||
for _, item := range items {
|
||||
|
||||
Reference in New Issue
Block a user