Skip to content

chore: update baton-sdk to v0.7.16#7

Open
gontzess wants to merge 3 commits into
mainfrom
task-sdk-upgrade-batch-10
Open

chore: update baton-sdk to v0.7.16#7
gontzess wants to merge 3 commits into
mainfrom
task-sdk-upgrade-batch-10

Conversation

@gontzess
Copy link
Copy Markdown

@gontzess gontzess commented Jan 27, 2026

Summary

  • Upgrade baton-sdk to v0.7.16
  • Upgrade Go version from 1.24.5 to 1.25.2
  • Add WithDefaultCapabilitiesConnectorBuilder option for configless capabilities
  • Added Discord bot token configuration support with secure token handling

Status

  • Build verified (go build ./... passes)
  • SDK version: v0.7.16
  • CI verification pending

@gontzess gontzess requested a review from a team January 27, 2026 16:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 27, 2026

Walkthrough

These changes upgrade the baton-sdk dependency and introduce Discord bot configuration support. A new configuration schema is defined with a token field, with corresponding accessor methods auto-generated into a new file.

Changes

Cohort / File(s) Summary
Dependency Management
go.mod
Go toolchain bumped from 1.24.5 to 1.25.2; baton-sdk upgraded from v0.3.44 to v0.7.4; new dependencies added for ruleguard tooling; several indirect dependencies updated (gopsutil v3→v4, otter v1→v2, system utilities); removals of older versions.
Configuration Schema & Generation
pkg/config/config.go, pkg/config/conf.gen.go
New configuration package introduces TokenField as a secret string field and Config schema definition; generated file provides Discord struct with reflection-based getter methods (GetString, GetInt, GetBool, GetStringSlice, GetStringMap) for type-safe field access via mapstructure tags.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A token for Discord takes flight,
Config schemas now shining bright,
Dependencies updated with care,
Baton-SDK's version to spare,
Tools and fields in perfect delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title states 'update baton-sdk to v0.7.16' but the actual changes show baton-sdk upgraded to v0.7.4, not v0.7.16. This is a factual inaccuracy. Update the PR title to accurately reflect the actual baton-sdk version bumped to (v0.7.4), or clarify the discrepancy if v0.7.16 is intended.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task-sdk-upgrade-batch-10

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

@gontzess gontzess changed the title Upgrade baton-sdk to v0.7.x and Go to 1.25.2 Upgrade baton-sdk to v0.7.4 and Go to 1.25.2 Jan 27, 2026
@gontzess gontzess marked this pull request as draft January 27, 2026 18:59
@gontzess gontzess force-pushed the task-sdk-upgrade-batch-10 branch 4 times, most recently from 05343c0 to 3fcff2c Compare January 27, 2026 21:27
@gontzess gontzess marked this pull request as ready for review January 27, 2026 22:03
@gontzess gontzess force-pushed the task-sdk-upgrade-batch-10 branch from 3fcff2c to 9699a94 Compare January 27, 2026 22:06
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

🤖 Fix all issues with AI agents
In `@pkg/config/conf.gen.go`:
- Around line 10-23: The method findFieldByTag on type Discord currently calls
reflect.ValueOf(c).Elem() and will panic if the receiver *Discord is nil; add a
defensive nil check at the start of findFieldByTag (check if c == nil) and
return nil, false immediately when nil, so callers safely get no-value instead
of crashing; keep the rest of the logic (using reflect.ValueOf(c).Elem(),
t.NumField(), field.Tag.Get("mapstructure"), and v.Field(i).Interface())
unchanged.
🧹 Nitpick comments (1)
go.mod (1)

7-10: Move ruleguard dependencies to a tools.go file.

These packages are only used in tools/rules.go (which has //go:build ruleguard constraints) and are not part of the production binary. Moving them to a dedicated tools.go file follows Go best practices and reduces the main module's dependency surface.

♻️ Suggested approach
- github.com/ennyjfrick/ruleguard-logfatal v0.0.2
- github.com/quasilyte/go-ruleguard/dsl v0.3.23

Add a tools-only file (example tools.go at repo root):

//go:build tools
// +build tools

package tools

import (
	_ "github.com/ennyjfrick/ruleguard-logfatal"
	_ "github.com/quasilyte/go-ruleguard/dsl"
)

Comment thread pkg/config/conf.gen.go
Comment on lines +10 to +23
func (c *Discord) findFieldByTag(tagValue string) (any, bool) {
v := reflect.ValueOf(c).Elem() // Dereference pointer to struct
t := v.Type()

for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tag := field.Tag.Get("mapstructure")

if tag == tagValue {
return v.Field(i).Interface(), true
}
}
return nil, false
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Guard against nil receiver to avoid panics in config accessors.
If *Discord is nil, reflect.ValueOf(c).Elem() panics. A defensive nil check prevents accidental crashes.

✅ Suggested fix (update generator)
 func (c *Discord) findFieldByTag(tagValue string) (any, bool) {
+	if c == nil {
+		return nil, false
+	}
 	v := reflect.ValueOf(c).Elem() // Dereference pointer to struct
 	t := v.Type()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (c *Discord) findFieldByTag(tagValue string) (any, bool) {
v := reflect.ValueOf(c).Elem() // Dereference pointer to struct
t := v.Type()
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tag := field.Tag.Get("mapstructure")
if tag == tagValue {
return v.Field(i).Interface(), true
}
}
return nil, false
}
func (c *Discord) findFieldByTag(tagValue string) (any, bool) {
if c == nil {
return nil, false
}
v := reflect.ValueOf(c).Elem() // Dereference pointer to struct
t := v.Type()
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tag := field.Tag.Get("mapstructure")
if tag == tagValue {
return v.Field(i).Interface(), true
}
}
return nil, false
}
🤖 Prompt for AI Agents
In `@pkg/config/conf.gen.go` around lines 10 - 23, The method findFieldByTag on
type Discord currently calls reflect.ValueOf(c).Elem() and will panic if the
receiver *Discord is nil; add a defensive nil check at the start of
findFieldByTag (check if c == nil) and return nil, false immediately when nil,
so callers safely get no-value instead of crashing; keep the rest of the logic
(using reflect.ValueOf(c).Elem(), t.NumField(), field.Tag.Get("mapstructure"),
and v.Field(i).Interface()) unchanged.

@gontzess gontzess changed the title Upgrade baton-sdk to v0.7.4 and Go to 1.25.2 chore: update baton-sdk to v0.7.16 Feb 6, 2026
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.

1 participant