Skip to content

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

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

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

Conversation

@gontzess
Copy link

@gontzess gontzess commented Jan 27, 2026

Summary

  • Upgrade baton-sdk to v0.7.16
  • Upgrade Go to 1.25.2
  • Update CI workflow to use go-version-file instead of hardcoded Go versions
  • Add pkg/config with go:generate for typed config
  • Add WithDefaultCapabilitiesConnectorBuilder option

CI Status

  • go-lint: PASS
  • go-test: PASS
  • test: FAIL (Cloudflare API credentials required - pre-existing infrastructure limitation)

Build Status

  • Local build: PASS (verified go build ./...)

Test plan

  • go build ./...
  • go test ./...
  • go-lint passes
  • go-test passes

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

coderabbitai bot commented Jan 27, 2026

Walkthrough

Go toolchain upgraded from 1.23.4 to 1.25.2 with major dependency bump to baton-sdk v0.7.4 and multiple transitive dependency updates. New Cloudflare Zero Trust configuration support added via generated struct and schema definitions with field relationships and constraints.

Changes

Cohort / File(s) Summary
Dependency Management
go.mod
Go toolchain bumped 1.23.4 → 1.25.2. Major version upgrade: baton-sdk v0.3.35 → v0.7.4. Multiple transitive updates: otter v1.2.4 → v2.2.1, gopsutil/v3 → v4, compress v1.17.11 → v1.18.0, sys v0.30.0 → v0.38.0, and others. New indirect deps added; some removed.
Configuration Setup
pkg/config/config.go
New Cloudflare Zero Trust configuration schema with four string fields: account-id (required), api-key, api-token, email. Defines field relationships: at least one of api-token or api-key required (mutually exclusive), email dependent on api-key. Includes go:generate directive for code generation.
Generated Config Struct
pkg/config/conf.gen.go
Auto-generated CloudflareZeroTrust struct with AccountId, ApiKey, ApiToken, Email fields. Provides reflection-based accessor methods: GetString(), GetInt(), GetBool(), GetStringSlice(), GetStringMap(). Helper method findFieldByTag() locates fields by mapstructure tags.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Dependencies dance in versions new,
The toolchain leaps to twenty-five, it's true!
CloudFlare Zero Trust now joins the fold,
With generated configs, relations bold.
Baton SDK climbs, from three to seven bright! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions baton-sdk v0.7.16, but the actual upgrade is to v0.7.4. The title also omits the Go toolchain upgrade from 1.23.4 to 1.25.2, which is a significant change. Update the title to accurately reflect the changes, such as: 'chore: upgrade baton-sdk to v0.7.4 and Go to 1.25.2' or similar.
✅ 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 3 times, most recently from 736bcbd to 26c1323 Compare January 27, 2026 21:27
@gontzess gontzess force-pushed the task-sdk-upgrade-batch-10 branch from 26c1323 to 681384f Compare January 27, 2026 21:27
@gontzess gontzess marked this pull request as ready for review January 27, 2026 22:03
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: 1

🤖 Fix all issues with AI agents
In `@pkg/config/conf.gen.go`:
- Around line 13-26: The findFieldByTag method can panic when c is nil because
reflect.ValueOf(c).Elem() is invalid; update findFieldByTag to first guard the
receiver: check the pointer receiver (c) for nil (or use reflect.ValueOf(c) and
ensure Kind() == reflect.Ptr and !IsNil()) before calling Elem(), and if nil
return nil, false immediately; this prevents the runtime crash and preserves the
existing return semantics when no field is found.

Comment on lines +13 to +26
func (c *CloudflareZeroTrust) 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

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 before reflection.

reflect.ValueOf(c).Elem() will panic if c is nil. Consider adding a nil guard in the generator to avoid a runtime crash for zero-value configs.

🐛 Suggested guard (apply in generator)
 func (c *CloudflareZeroTrust) findFieldByTag(tagValue string) (any, bool) {
+	if c == nil {
+		return nil, false
+	}
 	v := reflect.ValueOf(c).Elem() // Dereference pointer to struct
 	t := v.Type()
🤖 Prompt for AI Agents
In `@pkg/config/conf.gen.go` around lines 13 - 26, The findFieldByTag method can
panic when c is nil because reflect.ValueOf(c).Elem() is invalid; update
findFieldByTag to first guard the receiver: check the pointer receiver (c) for
nil (or use reflect.ValueOf(c) and ensure Kind() == reflect.Ptr and !IsNil())
before calling Elem(), and if nil return nil, false immediately; this prevents
the runtime crash and preserves the existing return semantics when no field is
found.

gontzess and others added 2 commits January 28, 2026 11:47
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@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