Skip to content

Conversation

@chrisgacsal
Copy link
Collaborator

@chrisgacsal chrisgacsal commented Sep 9, 2025

Overview

Re-add customer override service to customer subject hook to fix init. It was accidentally removed in #3345.

Summary by CodeRabbit

  • New Features

    • Added support for customer-specific overrides in subject-related workflows, enabling tailored behavior per account and more consistent rule application.
  • Chores

    • Internal wiring updated to integrate the new override capability across services, ensuring the override is available where subject hooks run without changing external configuration.

@chrisgacsal chrisgacsal requested review from a team and turip September 9, 2025 11:06
@chrisgacsal chrisgacsal self-assigned this Sep 9, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Updated the customer subject hook to accept and propagate a billing.CustomerOverrideService: constructor signature changed and the service is stored in SubjectCustomerHookConfig for use by the hook.

Changes

Cohort / File(s) Summary
Customer subject hook implementation
app/common/customer.go
Added billing.CustomerOverrideService parameter to NewCustomerSubjectServiceHook; added CustomerOverride field to customerservicehooks.SubjectCustomerHookConfig and populated it with the provided service.
Dependency wiring / generated wire
cmd/server/wire_gen.go
Updated call site to pass billingService into NewCustomerSubjectServiceHook, matching the extended constructor signature.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9cba0a and 26d928b.

📒 Files selected for processing (2)
  • app/common/customer.go (2 hunks)
  • cmd/server/wire_gen.go (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/customer-subject-hook-init

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chrisgacsal chrisgacsal added the release-note/bug-fix Release note: Bug Fixes label Sep 9, 2025
@chrisgacsal chrisgacsal force-pushed the fix/customer-subject-hook-init branch from d9cba0a to 26d928b Compare September 9, 2025 11:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/common/customer.go (1)

62-69: Update Wire provider set and regenerate wire_gen.go
The call in cmd/server/wire_gen.go (line 366) is missing the new billing.CustomerOverrideService parameter—add it to your Wire injector’s provider set (e.g. in cmd/server/wire.go), then rerun wire to rebuild wire_gen.go so NewCustomerSubjectServiceHook is invoked with all required args. Optionally document the new parameter in the function comment.

🧹 Nitpick comments (1)
app/common/customer.go (1)

76-81: Warn when CustomerOverride is unset SubjectCustomerHookConfig.Validate only checks for Customer, making CustomerOverride optional; if EnableSubjectHook is true but CustomerOverride is nil, emit a warning to improve ops visibility.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3dd5ec8 and d9cba0a.

📒 Files selected for processing (1)
  • app/common/customer.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/common/customer.go (2)
openmeter/billing/service.go (1)
  • CustomerOverrideService (35-42)
openmeter/customer/service/hooks/subjectcustomer.go (2)
  • NewSubjectCustomerHook (92-113)
  • SubjectCustomerHookConfig (115-123)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Lint
  • GitHub Check: Build
  • GitHub Check: Code Generators
  • GitHub Check: Test
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
app/common/customer.go (1)

11-11: Import of billing package looks correct

Path matches the existing import scheme and is required for the new type. No issues.

@chrisgacsal chrisgacsal enabled auto-merge (squash) September 9, 2025 11:11
@chrisgacsal chrisgacsal merged commit 8fb4841 into main Sep 9, 2025
21 of 22 checks passed
@chrisgacsal chrisgacsal deleted the fix/customer-subject-hook-init branch September 9, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants