Skip to content

containerize connector#36

Merged
aldevv merged 2 commits intomainfrom
containerize_auth0
Nov 26, 2025
Merged

containerize connector#36
aldevv merged 2 commits intomainfrom
containerize_auth0

Conversation

@aldevv
Copy link
Contributor

@aldevv aldevv commented Nov 24, 2025

Summary by CodeRabbit

  • Refactor
    • Internal configuration structure improvements for Auth0 integration, including reorganized configuration handling and enhanced metadata support.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings November 24, 2025 15:17
@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pkg/config/gen/gen.go is excluded by !**/gen/** and included by pkg/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This pull request introduces a generated Go configuration file in pkg/config/conf.gen.go that defines an Auth0 struct with mapstructure-tagged fields and reflection-based typed getter methods. Concurrently, pkg/config/schema.go is updated to add a go:generate directive and replace the ConfigurationSchema with a new Config object constructed with connector metadata.

Changes

Cohort / File(s) Summary
Generated Auth0 Configuration
pkg/config/conf.gen.go
Introduces Auth0 struct with four mapstructure-tagged fields (Auth0BaseUrl, Auth0ClientId, Auth0ClientSecret, SyncPermissions) and reflection-based getter methods (GetString, GetInt, GetBool, GetStringSlice, GetStringMap) that resolve field values by tag and panic on type mismatch.
Configuration Schema Updates
pkg/config/schema.go
Adds go:generate directive, replaces ConfigurationSchema with new Config object (constructed via field.NewConfiguration with connector display name, help URL, and icon URL metadata), and relocates ConfigurationFields to a separate var declaration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • conf.gen.go: Review the reflection logic in findFieldByTag for correctness and verify that panic-on-type-mismatch is the intended error handling strategy. Note that this is a generated file—confirm the generator source is appropriately configured.
  • schema.go: Verify that the new Config construction accurately replaces the removed ConfigurationSchema and that the go:generate directive points to a valid generator. Check that the connector metadata values (display name, help URL, icon URL) are correct.

Poem

🐰 A struct springs forth, tagged with care,
Getters retrieve with reflection's flair—
Auth0 config, neat and true,
Schema blooms where old ones flew! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'containerize connector' is vague and generic. The actual changes add Auth0 configuration structures and generated code, which are not related to containerization. Update the title to accurately reflect the changes, such as 'Add Auth0 configuration struct with generated getters' or 'Generate Auth0 config schema with reflective accessors'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
pkg/config/conf.gen.go (2)

6-26: Reflection helper is fine; note nil‑receiver behavior and silent miss cases

Auth0’s field tags match the schema keys, and findFieldByTag will correctly locate fields by mapstructure tag. Be aware that calling any of these methods on a (*Auth0)(nil) will panic due to reflect.ValueOf(c).Elem(), and that unknown tags will just return (nil, false) and therefore a zero value in the public getters—typos in field names won’t surface loudly. If this ever becomes painful in debugging, you’d need to adjust the generator in baton‑sdk rather than this file.


28-86: Getter semantics: zero on missing tag, panic on type mismatch

The getter methods (GetStringSlice, GetString, GetInt, GetBool, GetStringMap) all:

  • Return the type’s zero value when the tag isn’t found.
  • Panic with "wrong type" if a caller asks for the wrong type for a given field.

That’s a reasonable “programming error” contract, but worth keeping in mind: e.g., GetString("sync-permissions") will panic since that field is bool. Also, with the current Auth0 struct only GetString and GetBool can ever return non‑zero values; the others are effectively no‑ops added for API consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3cfb7a7 and a2a3a74.

⛔ Files ignored due to path filters (10)
  • .github/workflows/capabilities_and_config.yaml is excluded by none and included by none
  • .github/workflows/release.yaml is excluded by none and included by none
  • .gon-amd64.json is excluded by none and included by none
  • .gon-arm64.json is excluded by none and included by none
  • .goreleaser.docker.yaml is excluded by none and included by none
  • .goreleaser.yaml is excluded by none and included by none
  • Dockerfile.lambda is excluded by none and included by none
  • Makefile is excluded by none and included by none
  • cmd/baton-auth0/main.go is excluded by none and included by none
  • pkg/config/gen/gen.go is excluded by !**/gen/** and included by pkg/**
📒 Files selected for processing (2)
  • pkg/config/conf.gen.go (1 hunks)
  • pkg/config/schema.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pkg/config/conf.gen.go (1)
pkg/config/schema.go (1)
  • SyncPermissions (30-34)
🔇 Additional comments (2)
pkg/config/schema.go (2)

8-35: Auth0 configuration fields look consistent with expected usage

The field keys (auth0-base-url, auth0-client-id, auth0-client-secret, sync-permissions) and metadata (display name, description, placeholders, WithIsSecret(true) for the secret, and required flags) are coherent and match the struct tags in pkg/config/conf.gen.go. This should render well in the UI and enforce the right validation.


37-51: Migration complete; Config properly exported and integrated

Verification confirms the new Config export is properly wired. No old ConfigurationSchema symbols remain anywhere in the codebase, and Config is actively used by the code generator in pkg/config/gen/gen.go. The migration is clean with no stale references.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR containerizes the Auth0 connector by introducing Lambda support, code generation for configuration schema, and streamlining the release process through reusable workflows.

  • Adds code generation for configuration structures using go:generate
  • Introduces Lambda deployment support with a dedicated Dockerfile
  • Migrates release workflows to use centralized reusable workflows

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/config/schema.go Adds go:generate directive, enhances field descriptions with display names and placeholders, renames ConfigurationSchema to Config
pkg/config/gen/gen.go New code generator that produces configuration structs from schema definitions
pkg/config/conf.gen.go Generated configuration struct and accessor methods for Auth0 connector
cmd/baton-auth0/main.go Updates reference from ConfigurationSchema to Config
Makefile Adds code generation target, introduces BATON_LAMBDA_SUPPORT build tag support, renames add-dep to add-deps
Dockerfile.lambda New Dockerfile for AWS Lambda deployment
.goreleaser.yaml Removed in favor of reusable workflow
.goreleaser.docker.yaml Removed in favor of reusable workflow
.gon-amd64.json Removed in favor of reusable workflow
.gon-arm64.json Removed in favor of reusable workflow
.github/workflows/release.yaml Simplified to use reusable workflow with Lambda support
.github/workflows/capabilities_and_config.yaml Enhanced to generate both config schema and capabilities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,3 +1,4 @@
//go:generate go run ./gen
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The go:generate directive has leading whitespace before the comment. Go directives should start at the beginning of the line without any leading spaces or tabs to be properly recognized by the go generate tool.

Copilot uses AI. Check for mistakes.
// Code generated by baton-sdk. DO NOT EDIT!!!
package config

import "reflect"
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The import statement has trailing whitespace. Remove the trailing space after \"reflect\" for cleaner code formatting.

Suggested change
import "reflect"
import "reflect"

Copilot uses AI. Check for mistakes.
SyncPermissions bool `mapstructure:"sync-permissions"`
}

func (c* Auth0) findFieldByTag(tagValue string) (any, bool) {
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Missing space between receiver variable and type pointer. The receiver should be (c *Auth0) with a space between c and *Auth0 for proper Go syntax formatting.

Suggested change
func (c* Auth0) findFieldByTag(tagValue string) (any, bool) {
func (c *Auth0) findFieldByTag(tagValue string) (any, bool) {

Copilot uses AI. Check for mistakes.
@aldevv aldevv merged commit a038e9d into main Nov 26, 2025
4 checks passed
@aldevv aldevv deleted the containerize_auth0 branch November 26, 2025 12:39
@coderabbitai coderabbitai bot mentioned this pull request Dec 2, 2025
2 tasks
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.

4 participants