Skip to content

[smsgate] add support for scheduled messages#31

Merged
capcom6 merged 1 commit into
masterfrom
smsgate/schedule-at-support
Jun 1, 2026
Merged

[smsgate] add support for scheduled messages#31
capcom6 merged 1 commit into
masterfrom
smsgate/schedule-at-support

Conversation

@capcom6
Copy link
Copy Markdown
Member

@capcom6 capcom6 commented May 27, 2026

Summary by CodeRabbit

  • New Features

    • Added --schedule-at CLI flag to schedule message delivery (RFC3339 local time). Scheduled times must be in the future.
  • Chores

    • Standardized CLI help categories for clearer grouping of commands and flags.
    • Updated module dependencies to newer versions for improved stability and compatibility.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7c39632-9c44-4e70-9e3d-dc0a93036c9c

📥 Commits

Reviewing files that changed from the base of the PR and between 06fd19d and ac3502c.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • cmd/smsgate/smsgate.go
  • go.mod
  • internal/commands/flags/send.go
  • internal/commands/messages/batch/send.go
  • internal/commands/messages/send.go
  • internal/commands/webhooks/consts.go
  • internal/commands/webhooks/delete.go
  • internal/commands/webhooks/list.go
  • internal/commands/webhooks/register.go
  • internal/commands/webhooks/webhooks.go
✅ Files skipped from review due to trivial changes (5)
  • internal/commands/webhooks/consts.go
  • cmd/smsgate/smsgate.go
  • internal/commands/webhooks/delete.go
  • internal/commands/webhooks/list.go
  • go.mod
🚧 Files skipped from review as they are similar to previous changes (3)
  • internal/commands/messages/batch/send.go
  • internal/commands/messages/send.go
  • internal/commands/flags/send.go

📝 Walkthrough

Walkthrough

Adds a --schedule-at RFC3339 timestamp flag (future-time validation), centralizes CLI category labels into constants, updates go.mod dependency versions, and propagates ScheduleAt into single and batch message send payloads.

Changes

Message Scheduling and CLI Organization

Layer / File(s) Summary
CLI Constants Refactoring
cmd/smsgate/smsgate.go, internal/commands/webhooks/consts.go, internal/commands/webhooks/delete.go, internal/commands/webhooks/list.go, internal/commands/webhooks/register.go, internal/commands/webhooks/webhooks.go
Introduced package-level CLI category constants (categoryConfiguration, categoryOutput, categoryWebhooks) and replaced inline category string literals with these constants across command definitions.
Dependency Updates
go.mod
Bumped direct and indirect module versions (e.g., client-go, samber/lo, testify, urfave/cli/v2, excelize/v2 and several golang.org/x and transitive modules).
Schedule Flag Definition and Validation
internal/commands/flags/send.go
Added --schedule-at timestamp flag (RFC3339, local timezone), introduced categoryOptions/categoryBody, extended SendFlags with ScheduleAt *time.Time, and validate that schedule-at (if set) is strictly in the future.
Schedule Time Integration into Message Send
internal/commands/flags/send.go, internal/commands/messages/send.go, internal/commands/messages/batch/send.go
Updated SendFlags.Merge() to coalesce ScheduleAt into outgoing smsgateway.Message, and set ScheduleAt (initialized to nil) in both single-message and batch send message constructions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • android-sms-gateway/cli#23: Overlaps in modifying internal/commands/messages/send.go message construction; that PR adds DataMessage/TextMessage and DeviceID fields while this PR adds ScheduleAt.

Suggested labels

codex

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding scheduled message support via the new --schedule-at flag and ScheduleAt field across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 smsgate_Darwin_arm64.tar.gz
🍎 Darwin x86_64 smsgate_Darwin_x86_64.tar.gz
🐧 Linux arm64 smsgate_Linux_arm64.tar.gz
🐧 Linux i386 smsgate_Linux_i386.tar.gz
🐧 Linux x86_64 smsgate_Linux_x86_64.tar.gz
🪟 Windows arm64 smsgate_Windows_arm64.zip
🪟 Windows i386 smsgate_Windows_i386.zip
🪟 Windows x86_64 smsgate_Windows_x86_64.zip

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 28, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Full review triggered.

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 28, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Full review triggered.

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 29, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Full review triggered.

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 29, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Full review triggered.

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 29, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Full review triggered.

@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented May 30, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot added the codex label May 30, 2026
Copy link
Copy Markdown

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

🧹 Nitpick comments (2)
cmd/smsgate/smsgate.go (1)

76-78: ⚡ Quick win

Complete the category constant extraction.

The "Output" category on line 78 remains hardcoded while this refactor extracts other categories into constants. For consistency, consider adding a categoryOutput constant.

♻️ Proposed refactor
 const (
 	categoryConfiguration = "Configuration"
+	categoryOutput        = "Output"
 )

Then update the format flag:

 		&cli.StringFlag{
 			Name:     "format",
-			Category: "Output",
+			Category: categoryOutput,
 			Usage:    "Output format. Supported: text, json, raw",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/smsgate/smsgate.go` around lines 76 - 78, The "Output" string in the
cli.StringFlag for the "format" flag is still hardcoded; add a new constant
named categoryOutput (e.g., const categoryOutput = "Output") alongside the other
category constants and change the Category on the flag (the cli.StringFlag with
Name "format") to use categoryOutput so all categories are consistently
extracted as constants.
internal/commands/flags/send.go (1)

145-153: ⚡ Quick win

Don’t add a correctness cross-field check for schedule-at vs valid-until/ttl: the SMS Gateway for Android API rejects scheduled requests where scheduleAt is after the expiration time (scheduleAt <= validUntil when validUntil is set; same rule applies with ttl), so it won’t “silently never send.” Optional: a client-side check could still improve error UX.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/commands/flags/send.go` around lines 145 - 153, Remove any
cross-field correctness check that rejects a request when scheduleAt is after
validUntil/ttl; keep only the existing future-only validation for scheduleAt
(the c.Timestamp("schedule-at") check that returns error if not
After(time.Now())) and assign to fl.ScheduleAt, and if you want UX help add a
non-fatal warning/log (not a returned error) when scheduleAt > validUntil or
conflicts with ttl; do not return an error or block setting fl.ScheduleAt based
on validUntil or ttl.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@go.mod`:
- Around line 27-29: Update the vulnerable module entries in go.mod by bumping
golang.org/x/crypto and golang.org/x/net to the patched releases that address
the cited advisories (replace the current v0.52.0 and v0.55.0 entries with the
fixed versions), optionally update golang.org/x/text to a recent release, then
run go get golang.org/x/crypto@<fixed-version> and go get
golang.org/x/net@<fixed-version> (or go get <module>`@latest` if you intend the
latest), followed by go mod tidy and running your test suite to verify no
breakages; ensure the go.mod lines for modules golang.org/x/crypto and
golang.org/x/net reflect the new versions.

---

Nitpick comments:
In `@cmd/smsgate/smsgate.go`:
- Around line 76-78: The "Output" string in the cli.StringFlag for the "format"
flag is still hardcoded; add a new constant named categoryOutput (e.g., const
categoryOutput = "Output") alongside the other category constants and change the
Category on the flag (the cli.StringFlag with Name "format") to use
categoryOutput so all categories are consistently extracted as constants.

In `@internal/commands/flags/send.go`:
- Around line 145-153: Remove any cross-field correctness check that rejects a
request when scheduleAt is after validUntil/ttl; keep only the existing
future-only validation for scheduleAt (the c.Timestamp("schedule-at") check that
returns error if not After(time.Now())) and assign to fl.ScheduleAt, and if you
want UX help add a non-fatal warning/log (not a returned error) when scheduleAt
> validUntil or conflicts with ttl; do not return an error or block setting
fl.ScheduleAt based on validUntil or ttl.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a3963ba-b8ce-4ba9-ac59-cea3de9a4a4e

📥 Commits

Reviewing files that changed from the base of the PR and between 01b8e76 and 18013e5.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • cmd/smsgate/smsgate.go
  • go.mod
  • internal/commands/flags/send.go
  • internal/commands/messages/batch/send.go
  • internal/commands/messages/send.go
  • internal/commands/webhooks/consts.go
  • internal/commands/webhooks/delete.go
  • internal/commands/webhooks/list.go
  • internal/commands/webhooks/register.go
  • internal/commands/webhooks/webhooks.go

Comment thread go.mod
@capcom6 capcom6 force-pushed the smsgate/schedule-at-support branch from 06fd19d to ac3502c Compare June 1, 2026 02:51
@capcom6 capcom6 merged commit becb9b0 into master Jun 1, 2026
10 checks passed
@capcom6 capcom6 deleted the smsgate/schedule-at-support branch June 1, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant