Skip to content

Comments

[settings] add gateway settings support#206

Open
capcom6 wants to merge 4 commits intomasterfrom
settings/add-gateway-settings-support
Open

[settings] add gateway settings support#206
capcom6 wants to merge 4 commits intomasterfrom
settings/add-gateway-settings-support

Conversation

@capcom6
Copy link
Member

@capcom6 capcom6 commented Feb 17, 2026

Summary by CodeRabbit

  • New Features

    • Added a notification_channel setting under gateway configuration.
  • Behavioral Changes

    • JWT TTL now uses standard time.Duration in config.
    • Legacy custom duration type and its parsing/serialization removed.
    • Basic-auth parsing made more robust; malformed credentials are rejected consistently.
  • Chores

    • Bumped SMS gateway client library.
    • Updated test deployment image tags and normalized compose restart syntax.
    • Linting/configuration rules updated.

@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Bumped a client-go dependency; removed a custom Duration type and updated JWT TTL usage; added gateway.notification_channel to settings rules; switched auth parsing to strings.Cut; added //nolint:revive directives; updated golangci config; adjusted e2e compose image tags and quoting.

Changes

Cohort / File(s) Summary
Dependency
go.mod
Bumped github.com/android-sms-gateway/client-go from v1.9.6-... to v1.10.1-.... No other require edits.
Config types & wiring
internal/config/types.go, internal/config/config.go, internal/config/module.go
Removed custom Duration type and its (un)marshal helpers; changed JWT.TTL from Duration to time.Duration and updated default/usage (removed explicit conversions).
Settings validation
internal/sms-gateway/modules/settings/utils.go
Added gateway.notification_channel string entry to rules and rulesPublic maps.
Auth parsing
internal/sms-gateway/handlers/middlewares/userauth/userauth.go
Replaced manual index/slice parsing of username:password with strings.Cut; returns Unauthorized if delimiter missing.
Nolint directives
internal/sms-gateway/modules/metrics/module.go, internal/sms-gateway/modules/metrics/handler.go, internal/version/version.go
Inserted //nolint:revive directives to silence package-name lint warnings; no behavioral changes.
Linter config
.golangci.yml
Updated header/version, enabled modernize, expanded exhaustruct/public-lib exclusions, added gosec excludes and adjusted nolintlint rules.
E2E compose
test/e2e/docker-compose.yml
Set explicit images android-sms-gateway/server:public and :private; normalized restart policy quoting/formatting.
Misc (metrics)
internal/sms-gateway/modules/metrics/...
Minor lint-only edits (file-level directives); no runtime changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title '[settings] add gateway settings support' directly reflects the main change: adding gateway.notification_channel field to settings validation rules, which represents new gateway settings support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Copy link

@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.

🧹 Nitpick comments (1)
go.mod (1)

7-7: Pseudo-version dependency — consider pinning to a tagged release before merging.

v1.10.1-0.20260217004820-83d276545735 is a pseudo-version pointing to an unreleased commit. This is fine during development, but ideally this should be updated to a proper tagged release (e.g., v1.10.1) before shipping, to ensure reproducibility and clearer dependency tracking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 7, The go.mod entry for module
github.com/android-sms-gateway/client-go currently uses a pseudo-version
(v1.10.1-0.20260217004820-83d276545735); replace that pseudo-version with a
proper tagged release (for example v1.10.1 or the latest stable tag) in go.mod
and then refresh the module metadata (update go.sum / tidy modules) so the
project references a reproducible, tagged dependency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@go.mod`:
- Line 7: The go.mod entry for module github.com/android-sms-gateway/client-go
currently uses a pseudo-version (v1.10.1-0.20260217004820-83d276545735); replace
that pseudo-version with a proper tagged release (for example v1.10.1 or the
latest stable tag) in go.mod and then refresh the module metadata (update go.sum
/ tidy modules) so the project references a reproducible, tagged dependency.

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 server_Darwin_arm64.tar.gz
🍎 Darwin x86_64 server_Darwin_x86_64.tar.gz
🐧 Linux arm64 server_Linux_arm64.tar.gz
🐧 Linux i386 server_Linux_i386.tar.gz
🐧 Linux x86_64 server_Linux_x86_64.tar.gz
🪟 Windows arm64 server_Windows_arm64.zip
🪟 Windows i386 server_Windows_i386.zip
🪟 Windows x86_64 server_Windows_x86_64.zip

Copy link

@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: 2

🧹 Nitpick comments (1)
.golangci.yml (1)

400-402: allow-unused: true disables detection of stale nolint directives.

Setting this to true means dead //nolint:... annotations will silently accumulate as code changes. Since the PR also adds several new nolint directives (e.g., in internal/sms-gateway/modules/metrics/module.go, internal/version/version.go), consider keeping this false long-term and only using it during the version-bump stabilization window, to preserve the hygiene guarantee.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci.yml around lines 400 - 402, The config currently sets
allow-unused: true which disables detection of stale //nolint directives; revert
this to allow-unused: false (or remove the change) so the linter will warn about
dead nolint annotations, and if you need to relax it temporarily, document the
version-bump window and flip it back afterwards—also review the newly added
nolint instances in internal/sms-gateway/modules/metrics/module.go and
internal/version/version.go and remove or justify any unnecessary //nolint
entries before re-enabling the stricter check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.golangci.yml:
- Around line 346-351: The global suppression of gosec rule G117 (and G704) in
the gosec block removes an important security guardrail; instead of excluding
G117 project-wide, revert the global excludes and apply targeted suppressions
only where intentional JSON marshaling of secrets occurs (use inline nolint
comments or file-specific golangci.yml overrides) so that functions/types
handling secrets are explicitly annotated; update the gosec configuration to
remove G117 from the top-level excludes and add guidance in code comments where
you keep G704/G117 suppressed locally for known false positives, referencing the
gosec rule IDs G117 and G704 and the gosec section in .golangci.yml to locate
the change.
- Around line 256-259: The .golangci.yml contains duplicate exhaustruct
exclusion patterns—remove the redundant entries for
"^github.com/gofiber/.+Config$", "^gopkg.in/telebot.v4.LongPoller$",
"^gopkg.in/telebot.v4.ReplyMarkup$", and "^gopkg.in/telebot.v4.Settings$" so
each pattern appears only once; locate the duplicate block that repeats these
patterns and delete the repeated lines, leaving the original exclusion entries
intact to avoid noise.

---

Nitpick comments:
In @.golangci.yml:
- Around line 400-402: The config currently sets allow-unused: true which
disables detection of stale //nolint directives; revert this to allow-unused:
false (or remove the change) so the linter will warn about dead nolint
annotations, and if you need to relax it temporarily, document the version-bump
window and flip it back afterwards—also review the newly added nolint instances
in internal/sms-gateway/modules/metrics/module.go and
internal/version/version.go and remove or justify any unnecessary //nolint
entries before re-enabling the stricter check.

Copy link

@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.

🧹 Nitpick comments (2)
.golangci.yml (2)

396-398: allow-unused: true silently permits stale //nolint directives and contradicts the inline comment.

The comment directly above this setting reads "Disable to ensure that all nolint directives actually have an effect", which describes the behaviour of false. Flipping to true disables that check, allowing dead suppressions to accumulate undetected.

If the intent is to accommodate the newly added //nolint:revive directives in other files, the safer approach is to keep allow-unused: false and only place those directives on lines where revive actually fires — rather than globally relaxing the enforcement.

♻️ Proposed fix
-      # Disable to ensure that all nolint directives actually have an effect.
-      # Default: false
-      allow-unused: true
+      # Disable to ensure that all nolint directives actually have an effect.
+      # Default: false
+      allow-unused: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci.yml around lines 396 - 398, The config currently sets
allow-unused: true which silently permits stale //nolint directives; change
allow-unused back to false in the .golangci.yml (the allow-unused setting) and
remove the global relaxation, then instead add targeted //nolint:revive comments
only on the specific lines/functions where revive actually reports issues (use
the revive linter output to find these locations) so unused nolint directives
are not allowed to accumulate.

262-262: Consider narrowing the two broad exhaustruct exclusion patterns for consistency.

  • Line 262: ^github.com/go-telegram/bot/models.+$ matches every type in the models subpackage. The sibling pattern on line 261 (^github.com/go-telegram/bot.+Params$) uses a suffix anchor; a narrowed pattern (e.g. …models.+(Config|Params|Options)$) would align better with the library's builder-style type naming.
  • Line 268: ^github.com/revrost/go-openrouter.+$ excludes the entire go-openrouter package unconditionally, unlike most other patterns in this list that use specific suffix anchors (Config$, Params$, Claims$, Opts$, etc.). Consider narrowing to common suffixes (e.g. …(Request|Config|Options|Params)$).

Both patterns are valid for external libraries where exhaustruct is intentionally permissive, but narrowing them would improve consistency with the rest of the configuration.

♻️ Proposed narrowing
-        - ^github.com/go-telegram/bot/models.+$
+        - ^github.com/go-telegram/bot/models.+(Config|Params|Options)$
...
-        - ^github.com/revrost/go-openrouter.+$
+        - ^github.com/revrost/go-openrouter.+(Request|Config|Options|Params)$
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci.yml at line 262, The exclusion regexes in .golangci.yml are too
broad: replace the pattern ^github.com/go-telegram/bot/models.+$ with a narrowed
pattern that only targets builder-style types (for example limit to suffixes
like (Config|Params|Options)$) and similarly change
^github.com/revrost/go-openrouter.+$ to only match common type suffixes (for
example (Request|Config|Options|Params|Opts)$); update the two entries so they
use these more specific suffix-anchored regexes to match only intended types
(referencing the existing patterns ^github.com/go-telegram/bot/models.+$ and
^github.com/revrost/go-openrouter.+$ when making the replacements).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.golangci.yml:
- Around line 342-347: The global suppression of gosec rule G117 in the
gosec.excludes list removes an important guardrail; edit the gosec.excludes
block (the gosec config under the gosec key) to remove G117 from the global
excludes and instead apply targeted, inline suppressions for specific
files/structs that are false-positives; keep G704 in the global excludes only if
you have validated its false-positive rate, otherwise restrict it similarly by
directory or inline comments. Locate the gosec.excludes entry (the current list
containing G117 and G704) and remove G117 from that global list, then add
//nolint:gosec or equivalent file-level annotations next to the exact
structs/functions that are known false positives, or scope disables to specific
packages in the linter config.

---

Nitpick comments:
In @.golangci.yml:
- Around line 396-398: The config currently sets allow-unused: true which
silently permits stale //nolint directives; change allow-unused back to false in
the .golangci.yml (the allow-unused setting) and remove the global relaxation,
then instead add targeted //nolint:revive comments only on the specific
lines/functions where revive actually reports issues (use the revive linter
output to find these locations) so unused nolint directives are not allowed to
accumulate.
- Line 262: The exclusion regexes in .golangci.yml are too broad: replace the
pattern ^github.com/go-telegram/bot/models.+$ with a narrowed pattern that only
targets builder-style types (for example limit to suffixes like
(Config|Params|Options)$) and similarly change
^github.com/revrost/go-openrouter.+$ to only match common type suffixes (for
example (Request|Config|Options|Params|Opts)$); update the two entries so they
use these more specific suffix-anchored regexes to match only intended types
(referencing the existing patterns ^github.com/go-telegram/bot/models.+$ and
^github.com/revrost/go-openrouter.+$ when making the replacements).

@capcom6 capcom6 force-pushed the settings/add-gateway-settings-support branch from cf0d0cd to 1d4ef31 Compare February 19, 2026 00:36
Copy link

@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: 2

🧹 Nitpick comments (2)
.golangci.yml (2)

396-398: allow-unused: true silences dead nolint directives project-wide.

With require-explanation: true and require-specific: true still enforced, the quality bar for new directives is maintained, but stale directives on removed code won't be caught. This is likely intentional to accommodate the new file-level //nolint:revive annotations that may not fire in all lint configurations, but it's worth acknowledging the trade-off.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci.yml around lines 396 - 398, The setting allow-unused: true in the
golangci-lint config mutes detection of dead //nolint directives project-wide;
to avoid stale nolint comments slipping through, change allow-unused to false
(or document and scope the exception) so golangci-lint will flag unused nolint
directives; ensure the repo still preserves required behavior by keeping
require-explanation: true and require-specific: true, and if you need to exempt
file-level //nolint:revive usages, do so explicitly (e.g., per-file policy)
rather than leaving allow-unused enabled globally.

260-262: Remove unused exhaustruct package exclusions from .golangci.yml.

The following packages have exclusion rules in .golangci.yml (lines 260–262, 266, 268, 277) but are not present in go.mod:

  • github.com/go-telegram-bot-api/telegram-bot-api
  • github.com/go-telegram/bot
  • github.com/mymmrac/telego
  • github.com/revrost/go-openrouter
  • github.com/ThreeDotsLabs/watermill

These appear to be inherited from a template config. Since the project never imports these libraries, their exclusions add unnecessary noise and should be removed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci.yml around lines 260 - 262, Remove the unused exhaustruct
exclusion entries from .golangci.yml: delete the regex rules referencing
^github.com/go-telegram-bot-api/telegram-bot-api/.+Config$,
^github.com/go-telegram/bot.+Params$, ^github.com/go-telegram/bot/models.+$ and
the other exclusions for github.com/mymmrac/telego,
github.com/revrost/go-openrouter and github.com/ThreeDotsLabs/watermill; confirm
these packages are not present in go.mod and then run golangci-lint to ensure no
remaining false-positive exhaustruct exclusions remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 7: The go.mod currently pins github.com/android-sms-gateway/client-go to
a pseudo-version (v1.10.1-0.20260218044357-fb0b167fbe22); replace this with a
real released tag or coordinate a release: either update go.mod to the proper
tagged release (e.g., github.com/android-sms-gateway/client-go v1.10.1) after
that tag is published, or revert to the last stable published version (e.g.,
v1.10.0) until v1.10.1 is published; ensure the dependency line containing
"github.com/android-sms-gateway/client-go v1.10.1-0.20260218044357-fb0b167fbe22"
is updated and run go mod tidy to refresh the module graph.

In `@internal/config/config.go`:
- Around line 89-91: The JWT TTL field currently uses time.Duration which the
YAML unmarshaler can't parse from human-readable strings like "24h"; restore the
previous custom Duration type (e.g., type Duration struct { time.Duration }) and
implement UnmarshalYAML on it to accept string values (using time.ParseDuration)
and numeric node kinds (treat as nanoseconds), then change the JWT config struct
field TTL from time.Duration to this Duration type (references: the JWT struct
fields Secret, TTL, Issuer in internal/config/config.go and the Duration type
and its UnmarshalYAML method); ensure any code that reads TTL converts Duration
back to time.Duration where needed.

---

Duplicate comments:
In @.golangci.yml:
- Around line 342-347: The global gosec exclusion of G117 in .golangci.yml is
too broad; remove G117 from the top-level gosec.excludes and instead add a
scoped suppression using golangci-lint's "exclude-rules" (or gosec's
file/path-specific config) targeting only the offending files/types once you've
identified them, leaving G704 unchanged if it truly needs global exclusion;
update gosec.excludes to only include genuinely global rules (e.g., G704) and
create one or more exclude-rules entries that reference the specific file path
regexes and rule: G117 to narrow the scope.

---

Nitpick comments:
In @.golangci.yml:
- Around line 396-398: The setting allow-unused: true in the golangci-lint
config mutes detection of dead //nolint directives project-wide; to avoid stale
nolint comments slipping through, change allow-unused to false (or document and
scope the exception) so golangci-lint will flag unused nolint directives; ensure
the repo still preserves required behavior by keeping require-explanation: true
and require-specific: true, and if you need to exempt file-level //nolint:revive
usages, do so explicitly (e.g., per-file policy) rather than leaving
allow-unused enabled globally.
- Around line 260-262: Remove the unused exhaustruct exclusion entries from
.golangci.yml: delete the regex rules referencing
^github.com/go-telegram-bot-api/telegram-bot-api/.+Config$,
^github.com/go-telegram/bot.+Params$, ^github.com/go-telegram/bot/models.+$ and
the other exclusions for github.com/mymmrac/telego,
github.com/revrost/go-openrouter and github.com/ThreeDotsLabs/watermill; confirm
these packages are not present in go.mod and then run golangci-lint to ensure no
remaining false-positive exhaustruct exclusions remain.

@capcom6 capcom6 force-pushed the settings/add-gateway-settings-support branch from 1d4ef31 to 0915454 Compare February 19, 2026 07:21
@capcom6 capcom6 added the deployed The PR is deployed on staging label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployed The PR is deployed on staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant