Skip to content

Honor Slack/Telegram messenger.address and apply MESSENGER_RATE_* overrides in the HTTP client so mocked messengers can be targeted without production throttling. - #583

Open
tansdf wants to merge 5 commits into
developfrom
internal-tests
Open

tansdf wants to merge 5 commits into
developfrom
internal-tests

Conversation

@tansdf

@tansdf tansdf commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…rrides in the HTTP client so mocked messengers can be targeted without production throttling.

Co-authored-by: Cursor <cursoragent@cursor.com>
…egram URLs type-check without narrowing NullApplicationConfig.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread app/im/application.py Outdated
Comment thread app/config/validation.py Outdated
Comment thread app/config/environment.py Outdated
def normalize_jira_base_url(cls, v):
return v.rstrip("/") if v else v

def apply_messenger_rate_limits(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we remove it and set limits using code:

            rate_limit=self.messenger_rate_limit or self.rate_limit,
            rate_window=messenger_rate_window or self.rate_window,

here: https://github.com/eslupmi/impulse/blob/develop/app/im/application.py#L600
?

Comment thread app/http_client/rate_limited_client.py Outdated
):
self.rate_limit = rate_limit
self.rate_window = rate_window
self.rate_limit, self.rate_window = get_environment_config().apply_messenger_rate_limits(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment thread app/config/environment.py Outdated
description="Port to listen on"
)
messenger_rate_limit: int | None = Field(
default_factory=lambda: _env_optional_int('MESSENGER_RATE_LIMIT'),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's rename ENVS to DEV_MESSENGER_RATE_LIMIT and DEV_MESSENGER_RATE_WINDOW

Comment thread app/im/slack/slack_application.py Outdated

def _get_url(self, app_config: ApplicationConfig):
return 'https://slack.com'
return app_config.address or 'https://slack.com'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think DEV_MESSENGER_CUSTOM_ADDRESS ENV will be better (minimum documentation updates needed)

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants