Skip to content

Conversation

@nothing0012
Copy link
Contributor

@nothing0012 nothing0012 commented Dec 24, 2025

Description

This PR enhances the Flagr notification system with richer context and stabilizes the CI pipeline through a modern dependency upgrade.

Key Changes:

  • Rich Notifications: Added flag descriptions and opt-in JSON diffs to slack/email notifications for better observability.
  • Improved Type Safety: Refactored SaveFlagSnapshot to use the typed notification.Operation enum instead of raw strings.
  • CI Pipeline Stabilization: Fully migrated DataRecorder and tests from pubsub v1 to v2, resolving SA1019 deprecation warnings.
  • Safe API Modernization: Transitioned from Topic to Publisher in accordance with the pubsub/v2 specification. All publishing logic and test mocks have been verified for parity.
  • Security & Privacy: Detailed diffs are hidden by default via FLAGR_NOTIFICATION_DETAILED_DIFF_ENABLED=false to protect sensitive configuration data.
  • Refactored for Testability: Introduced a SetNotifier hook to replace hidden init() side effects, enabling clean integration testing.

CI & Dependency Migration

  • Migrated cloud.google.com/go/pubsub from v1 to v2 to resolve deprecation warnings.
  • Updated Topic usage to Publisher in both producer logic and tests.
  • Resolved SA1019 lint warnings which were blocking the CI pipeline.
  • Verified that all CI checks (unit tests, integration tests, linting) are now passing.

Motivation and Context

Modernizing core dependencies while significantly improving the auditing capabilities of the notification system.

How Has This Been Tested?

  • CI Suite: make ci passed with 0 lint issues and 0 test failures.
  • Unit Testing: 100% coverage on new diff calculation and formatting logic.
  • Integration Testing: Verified handler-level notification triggers and privacy defaults.
  • Manual Proof: Verified that pubsub/v2 publishing works correctly with the pstest mock server.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Refactoring / Technical debt

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- Included flag description and pre/post change values in notifications
- Implemented privacy-first, opt-in JSON diffing (FLAGR_NOTIFICATION_DETAILED_DIFF_ENABLED)
- Added automatic pretty-printing for JSON diffs to improve readability
- Refactored notification package for better testability (removed public init, added SetNotifier)
- Added handler-level integration tests for notifications
- Upgraded cloud.google.com/go/pubsub to v2 to resolve deprecation warnings
- Fixed various test stability issues (DB transaction ordering, nil notifier panics)
Correctly upgraded to cloud.google.com/go/pubsub/v2@latest while also
restoring the modern versions of transitive dependencies (auth, iam, api)
that were inadvertently downgraded in the previous commit due to an older
pubsub version constraint.
Updated slack.go and email.go to use the defined Operation constants
instead of string literals for better consistency and type safety.
Refactored entity.SaveFlagSnapshot to accept notification.Operation
instead of a string, improving type safety and consistency across
handler calls.
- Replaced deprecated cloud.google.com/go/pubsub with v2
- Updated Topic usage to Publisher in producer and tests
- Resolved SA1019 lint warnings for CI compliance
@nothing0012 nothing0012 changed the title feat: enhance notification system with rich details and opt-in diffs feat: enhance notification system and migrate to pubsub/v2 to fix CI Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants