package notification import ( "path/filepath" "testing" "github.com/stretchr/testify/require" ) func TestNotificationObservabilityAndRecoveryDocsStayInSync(t *testing.T) { t.Parallel() readme := loadTextFile(t, "README.md") runbookDoc := loadTextFile(t, filepath.Join("docs", "runbook.md")) flowsDoc := loadTextFile(t, filepath.Join("docs", "flows.md")) docsIndex := loadTextFile(t, filepath.Join("docs", "README.md")) require.Contains(t, docsIndex, "- [Operator runbook](runbook.md)") normalizedReadme := normalizeWhitespace(readme) normalizedRunbookDoc := normalizeWhitespace(runbookDoc) require.Contains(t, normalizedReadme, normalizeWhitespace("notification.intent.outcomes")) require.Contains(t, normalizedReadme, normalizeWhitespace("notification.route_schedule.depth")) require.Contains(t, normalizedReadme, normalizeWhitespace("notification.intent_stream.oldest_unprocessed_age_ms")) require.Contains(t, normalizedRunbookDoc, normalizeWhitespace("notification.route_schedule.depth")) require.Contains(t, normalizedRunbookDoc, normalizeWhitespace("notification.intent_stream.oldest_unprocessed_age_ms")) require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("new `idempotency_key`")) require.Contains(t, normalizeWhitespace(runbookDoc), normalizeWhitespace("new producer-owned `idempotency_key`")) require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("there is still no `/metrics` route")) require.Contains(t, normalizeWhitespace(runbookDoc), normalizeWhitespace("there is no `/metrics` route")) require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("Metrics intentionally avoid high-cardinality attributes such as `user_id`, email address, `notification_id`, `route_id`, and `idempotency_key`")) require.Contains(t, normalizeWhitespace(flowsDoc), normalizeWhitespace("A dead-lettered route never rolls back or invalidates a sibling route that already reached `published`")) require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("Manual Redis mutation of an existing route record or `notification:route_schedule` is not a supported replay workflow.")) }