Skip to content

Feat: Log messages to help with invalid startup options - #699

Merged
esnible merged 2 commits into
rossoctl:mainfrom
esnible:startup-messages
Jul 27, 2026
Merged

Feat: Log messages to help with invalid startup options#699
esnible merged 2 commits into
rossoctl:mainfrom
esnible:startup-messages

Conversation

@esnible

@esnible esnible commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

No Issue. A small PR that adds logging around invalid start options.

(Optional) Testing Instructions

To start locally,

cd ./authbridge/cmd/authbridge-proxy
go run -tags include_plugin_contextguru . --config ../../../authbridge/demos/context-guru/k8s/authbridge-config.yaml

Summary by CodeRabbit

  • Bug Fixes

    • Improved startup validation for missing/empty --config, including clearer guidance that it must be a YAML file.
    • Enhanced fatal startup errors to include the provided config path and the underlying load failure.
  • Diagnostics

    • Added a warning when a pipeline references an unknown plugin while no plugins are registered (helps detect build/config issues).
    • Updated unknown-plugin error details to include the available registered plugins.

Signed-off-by: Ed Snible <snible@us.ibm.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 755478e3-b2e2-4aaa-9084-27776caf97aa

📥 Commits

Reviewing files that changed from the base of the PR and between fd6fc20 and 904e656.

📒 Files selected for processing (4)
  • authbridge/authlib/plugins/registry.go
  • authbridge/cmd/authbridge-cpex/main.go
  • authbridge/cmd/authbridge-envoy/main.go
  • authbridge/cmd/authbridge-proxy/main.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • authbridge/cmd/authbridge-proxy/main.go
  • authbridge/cmd/authbridge-envoy/main.go
  • authbridge/authlib/plugins/registry.go
  • authbridge/cmd/authbridge-cpex/main.go

📝 Walkthrough

Walkthrough

Plugin builders now warn when no plugins are registered, while CLI commands provide more specific YAML configuration and load-failure messages.

Changes

Plugin build diagnostics

Layer / File(s) Summary
Unknown-plugin diagnostics
authbridge/authlib/plugins/registry.go
Build and BuildWithSPIFFE compute registered plugins once, warn when none are registered, and include the list in errors.

CLI configuration diagnostics

Layer / File(s) Summary
Configuration startup errors
authbridge/cmd/authbridge-cpex/main.go, authbridge/cmd/authbridge-envoy/main.go, authbridge/cmd/authbridge-proxy/main.go
Startup errors now state that --config must reference a YAML file and include the failing configuration path.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.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 is clear and broadly matches the PR’s focus on improved startup validation and logging for invalid options.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@authbridge/cmd/authbridge-cpex/main.go`:
- Line 104: Standardize startup diagnostics in main across all binaries: at
authbridge/cmd/authbridge-cpex/main.go:104,
authbridge/cmd/authbridge-envoy/main.go:102, and
authbridge/cmd/authbridge-proxy/main.go:150, change the required-config message
to use “must point to a YAML file”; at
authbridge/cmd/authbridge-cpex/main.go:109,
authbridge/cmd/authbridge-envoy/main.go:124, and
authbridge/cmd/authbridge-proxy/main.go:165, use the load-failure wording
“failed to load config %q: %v”.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d84f393-666e-4142-abf5-174fc850479a

📥 Commits

Reviewing files that changed from the base of the PR and between afa1396 and fd6fc20.

📒 Files selected for processing (4)
  • authbridge/authlib/plugins/registry.go
  • authbridge/cmd/authbridge-cpex/main.go
  • authbridge/cmd/authbridge-envoy/main.go
  • authbridge/cmd/authbridge-proxy/main.go

Comment thread authbridge/cmd/authbridge-cpex/main.go Outdated

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR improves diagnostics for invalid startup options — clearer --config errors across the three binaries plus a hint when no plugins are registered (a common "forgot the build tags" footgun). Logic is sound and CI is green. The only feedback is on the wording of the new messages themselves: since clearer messaging is the whole point of the PR, a couple of the strings are worth tightening. All comments are non-blocking.

Areas reviewed: Go (authbridge). Commits: 1, signed-off. CI: passing.

Comment thread authbridge/cmd/authbridge-cpex/main.go Outdated

if *configPath == "" {
log.Fatal("--config is required")
log.Fatal("--config is required and must be to a YAML file")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: "--config is required and must be to a YAML file" — "must be to a YAML file" isn't quite grammatical. Suggest "--config is required and must point to a YAML file". Same string appears in authbridge-envoy/main.go:102 and authbridge-proxy/main.go:150. (CodeRabbit flagged this one too.)

Comment thread authbridge/cmd/authbridge-cpex/main.go Outdated
bootCfg, err := config.Load(*configPath)
if err != nil {
log.Fatalf("initial config load: %v", err)
log.Fatalf("initial config load failed to load %q: %v", *configPath, err)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: "initial config load failed to load %q: %v" reads a bit redundantly ("load … load"). Consider "failed to load config %q: %v". Same wording in authbridge-envoy/main.go:124 and authbridge-proxy/main.go:165.

Comment thread authbridge/authlib/plugins/registry.go Outdated
return nil, fmt.Errorf("unknown plugin %q (registered: %v)", e.Name, RegisteredPlugins())
pluginNames := RegisteredPlugins()
if len(pluginNames) == 0 {
slog.Warn("No registered plugins -- Built with --tags or use `go run .` to enable")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: "No registered plugins -- Built with --tags..." — "Built" reads as past tense; the imperative "Build with --tags" fits the hint better. Same warning at line 341.

Signed-off-by: Ed Snible <snible@us.ibm.com>
@esnible
esnible merged commit 0f86530 into rossoctl:main Jul 27, 2026
20 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Jul 27, 2026
@esnible
esnible deleted the startup-messages branch July 27, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants