Skip to content

fix(config): use WithSuggestedValue for noun/verb defaults - #45

Merged
johnallers merged 3 commits into
mainfrom
john.allers/suggested-value-nouns-verbs
Jul 22, 2026
Merged

fix(config): use WithSuggestedValue for noun/verb defaults#45
johnallers merged 3 commits into
mainfrom
john.allers/suggested-value-nouns-verbs

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

Commit 6d27d6d added field.WithDefaultValue(defaultNouns) / WithDefaultValue(defaultVerbs) to the noun/verb config fields.

WithDefaultValue feeds two things:

  1. the CLI/runtime flag defaultpkg/cli registers it as the cobra flag default, and viper (BindPFlags + Unmarshal) injects it into the connector config even when the stored config omits the field;
  2. the exported schema default — used by the c1 GUI to pre-populate the field for a new connector.

connector.NewfilterArgs treats an empty noun/verb as "use the full default set" (attachment, blogpost, comment, page, space + 8 verbs). Because of (1), an existing connector whose stored config never set noun/verb now gets ["space"] + 6 verbs injected at runtime → filterArgs narrows the sync, dropping nouns {attachment, blogpost, comment, page} and verbs {archive, update}. That's a silent breaking change.

Fix

Use field.WithSuggestedValue (baton-sdk v0.20.1, from ConductorOne/baton-sdk#1024) instead of WithDefaultValue. The suggested value is surfaced only in the exported schema — the GUI still pre-populates noun/verb for new connectors — but it is not registered as the flag default, so nothing is injected at runtime when the field is unset. Existing connectors that leave the fields unset see an empty value at runtime again and keep their historical full-set behavior.

Verification

  • ./baton-confluence config (exported schema): noun -> ["space"], verb -> [administer, create, delete, export, read, restrict_content] — GUI pre-population intact.
  • Runtime path with no config/env set: Noun=[], Verb=[] — no injection; filterArgs returns the full default set.
  • go build ./cmd/baton-confluence and go test ./... pass against baton-sdk v0.20.1.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: fix(config): use WithSuggestedValue for noun/verb defaults

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base d6b17ea63a1f.
Review mode: full
View review run

Review Summary

The full PR diff was scanned for security and correctness. The substantive change swaps field.WithDefaultValue to field.WithSuggestedValue for the noun/verb config fields, plus the baton-sdk bump (v0.19.1 to tagged v0.20.1) that introduces that option. I verified the fix against the SDK vendor code: the CLI/flag path (cli.go uses GetDefaultValue) reads only DefaultValue, while schema export (marshal.go uses GetExportedDefaultValue) prefers SuggestedValue, so the GUI still pre-populates while nothing is injected at runtime when the field is unset. Since StringSliceField seeds DefaultValue as an empty slice, flag registration stays valid, and filterArgs (connector.go:65) treats the empty runtime value as "use full default set", correctly restoring historical behavior for existing connectors. The prior finding about a baton-sdk branch pseudo-version pin is addressed: go.mod now pins tagged v0.20.1. No new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking issues found.

@c1-squire-dev
c1-squire-dev Bot marked this pull request as ready for review July 22, 2026 19:51
@c1-squire-dev
c1-squire-dev Bot requested a review from a team July 22, 2026 19:52
johnallers and others added 3 commits July 22, 2026 20:03
Adding WithDefaultValue to the noun/verb fields registered them as
CLI/runtime flag defaults, which viper injects into the connector config
even when a connector's stored config omits them. connector.New treats
an empty noun/verb as "use the full default set", so existing connectors
that never set these fields silently began syncing the narrower config
default set instead of their historical full set — a breaking change.

Switch to WithSuggestedValue (baton-sdk), which surfaces the defaults
ONLY in the exported config schema (so the c1 GUI still pre-populates
them for new connectors) without registering them as flag defaults.
Existing connectors that leave the fields unset now see an empty value
at runtime again and retain their prior behavior.

Depends on baton-sdk WithSuggestedValue (ConductorOne/baton-sdk#1024);
the go.mod pin must be updated to the released SDK version before merge.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Repin from the pre-release branch pseudo-version to the released
v0.20.1, which includes WithSuggestedValue (ConductorOne/baton-sdk#1024).

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@c1-squire-dev
c1-squire-dev Bot force-pushed the john.allers/suggested-value-nouns-verbs branch from 78ca058 to 123e355 Compare July 22, 2026 20:05

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking issues found.

@johnallers
johnallers merged commit 99208e7 into main Jul 22, 2026
9 of 11 checks passed
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