Skip to content

fix(subscriptions): resolve named services from subscription annotations#458

Open
yugstar wants to merge 1 commit into
argoproj:masterfrom
yugstar:fix-346-named-service-resolution
Open

fix(subscriptions): resolve named services from subscription annotations#458
yugstar wants to merge 1 commit into
argoproj:masterfrom
yugstar:fix-346-named-service-resolution

Conversation

@yugstar

@yugstar yugstar commented Jun 19, 2026

Copy link
Copy Markdown

Closes #346

Problem

iterate() in pkg/subscriptions/annotations.go parses a subscription annotation key like notifications.argoproj.io/subscribe.<trigger>.<service> by splitting on . and taking service = parts[1].

For a named service the name is dropped. Example: a service registered in the config as service.github.orgb (lookup key github.orgb) is subscribed with:

notifications.argoproj.io/subscribe.on-sync.github.orgb: my-recipient

The key splits to [on-sync, github, orgb], so parts[1] is just github. Dispatch then looks up github (not registered) and fails with notification service "github" is not supported.

This breaks named services in general (github.orgb, slack.teamA, …) and is the root cause behind the multiple-GitHub-app-installation use case in #346.

Fix

Join the remaining segments instead of taking only the second one:

service = strings.Join(parts[1:], ".")

so the full name github.orgb is preserved and resolves to the registered config key. This matches the multi-segment service naming that config.go already supports. Backward compatible: existing two-segment keys (subscribe.<trigger>.<service>) are unchanged.

Test

Extended TestIterate with a subscribe.on-sync.github.orgb case asserting the resolved service is github.orgb.

Proven as a real regression test:

  • Before the fix: TestIterate fails — Not equal: expected "github.orgb", actual "github".
  • After the fix: passes.

go build ./... and go vet ./pkg/subscriptions/ are clean.

iterate() set the service to only parts[1] when splitting the subscription
annotation key, dropping any further name segments. A named service such
as service.github.orgb (registered in the config as github.orgb) therefore
resolved to just \"github\" and failed with \"notification service github is
not supported\".

Join the remaining segments so the full name (github.orgb) is used,
matching the multi-segment keys that config.go already supports. Existing
two-segment keys (subscribe.<trigger>.<service>) are unchanged.

Closes argoproj#346

Signed-off-by: Aman Raj <aman.yug@gmail.com>
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.13%. Comparing base (da04400) to head (e5cf7bb).
⚠️ Report is 37 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #458      +/-   ##
==========================================
+ Coverage   55.41%   57.13%   +1.72%     
==========================================
  Files          46       49       +3     
  Lines        4125     3782     -343     
==========================================
- Hits         2286     2161     -125     
+ Misses       1511     1263     -248     
- Partials      328      358      +30     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Allow multiple GitHub app Installation IDs

1 participant