Compare commits

...

1 Commits

Author SHA1 Message Date
Benjamin Admin 6b9c7984b4 fix(ci): regulatory_news Zeitbomben-Test entschaerfen — test-go + Deploy entsperren
CI / detect-changes (push) Successful in 8s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Successful in 7s
CI / validate-canonical-controls (push) Successful in 4s
CI / loc-budget (push) Successful in 18s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 3m2s
CI / test-go (push) Successful in 1m8s
CI / iace-gt-coverage (push) Successful in 19s
CI / test-python-backend (push) Has been skipped
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
test-go failte seit 2026-06-19: VBR-OBL-001 ("Widerrufsbutton ab 19.06.2026") ist
seit dem Stichtag abgelaufen und faellt aus dem Zukunfts-Horizont von GetRegulatoryNews,
wodurch TestGetRegulatoryNews_FromRealFiles bricht. Fix: now-Referenz injizierbar
(GetRegulatoryNewsAt), Test nutzt fixes Datum -> deterministisch. Produktions-Caller
unveraendert (Wrapper). admin rag-query Marker, damit detect-changes admin mitbaut
(article_label-Rendering). go vet + alle ai-sdk-Tests lokal gruen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-21 00:51:47 +02:00
3 changed files with 12 additions and 2 deletions
@@ -5,6 +5,7 @@
* Frueher: bp-core-rag-service:8097 — der existiert auf prod NICHT (nur macmini/dev), * 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 * 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. * 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 = const SDK_URL =
@@ -33,6 +33,12 @@ type RegulatoryNewsFilter struct {
// GetRegulatoryNews scans all v2 obligations for upcoming deadlines // GetRegulatoryNews scans all v2 obligations for upcoming deadlines
// and returns formatted news items sorted by urgency. // and returns formatted news items sorted by urgency.
func GetRegulatoryNews(regulations map[string]*V2RegulationFile, filter RegulatoryNewsFilter) []RegulatoryNewsItem { 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 { if filter.HorizonDays <= 0 {
filter.HorizonDays = 365 filter.HorizonDays = 365
} }
@@ -40,7 +46,7 @@ func GetRegulatoryNews(regulations map[string]*V2RegulationFile, filter Regulato
filter.Limit = 5 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) horizon := today.AddDate(0, 0, filter.HorizonDays)
var items []RegulatoryNewsItem var items []RegulatoryNewsItem
@@ -174,7 +174,10 @@ func TestGetRegulatoryNews_FromRealFiles(t *testing.T) {
if err != nil { if err != nil {
t.Skipf("could not load v2 regulations: %v", err) 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 // Should find at least the Widerrufsbutton obligation
found := false found := false
for _, item := range items { for _, item := range items {