Skip to content

feat(config): add distinct suggested_value to exported config schema#1034

Open
c1-squire-dev[bot] wants to merge 3 commits into
mainfrom
johnallers/connector-suggested-value-schema
Open

feat(config): add distinct suggested_value to exported config schema#1034
c1-squire-dev[bot] wants to merge 3 commits into
mainfrom
johnallers/connector-suggested-value-schema

Conversation

@c1-squire-dev

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

Copy link
Copy Markdown
Contributor

Problem

WithSuggestedValue folded its value into the exported schema's default_value (via GetExportedDefaultValue), so a suggested value was byte-identical to a real default in the exported config_schema.json. Downstream, c1 injects schema default_value into a deployed connector's resolved config when the operator left a field unset — so a suggested value silently became an enforced default.

Concretely this regressed baton-confluence: noun/verb use WithSuggestedValue(<narrow set>), which exported as default_value:["space"], which c1 injected, so existing connectors synced only spaces instead of falling back to the connector's full runtime default set.

Change

Add a distinct suggested_value field to each typed sub-message in proto/c1/config/v1/config.proto (IntField, BoolField, StringSliceField, StringMapField, StringField). In schemaFieldToV1:

  • default_value is now sourced from GetDefaultValue (real WithDefaultValue only), and
  • suggested_value is sourced separately from SuggestedValue, only when set.

Fields that use only WithDefaultValue are unchanged (default populated, suggested empty). Fields that use WithSuggestedValue now export an empty default_value plus a populated suggested_value — so consumers can pre-populate a UI from the suggestion without treating it as an injected default.

Adds GetSuggestedValue[T] helper in pkg/field/fields.go.

Tests

pkg/field/struct_test.go: a StringSliceField built with only WithSuggestedValue(["space"]) now exports default_value == [] and suggested_value == ["space"]; a WithDefaultValue field exports the default with empty suggested.

Coordinated with

  • c1 PR (adds a matching suggested_value to its internal + public connector-config schema, carries it through the converters for GUI pre-population, and keeps the deployment resolver injecting default_value only).
  • baton-confluence PR (bumps to this SDK and regenerates config_schema.json).

🤖 Generated with Claude Code

WithSuggestedValue previously folded its value into the exported schema's
default_value (via GetExportedDefaultValue), making a suggested value
indistinguishable from a real default. Downstream consumers (c1) then
injected it as a default into resolved connector config, so e.g.
baton-confluence synced only the narrow suggested noun/verb set instead of
falling back to the full runtime default set.

Emit suggested values into a separate suggested_value proto field on each
typed sub-message (IntField, BoolField, StringSliceField, StringMapField,
StringField). default_value now carries only real WithDefaultValue values;
suggested_value carries WithSuggestedValue. Consumers can pre-populate a GUI
from suggested_value without treating it as a default.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@c1-squire-dev
c1-squire-dev Bot requested a review from a team July 23, 2026 13:12
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

General PR Review: feat(config): add distinct suggested_value to exported config schema

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

Review Summary

The full PR diff was scanned for security and correctness. This PR adds a distinct suggested_value field (numbers 3/3/3/3/6, all additive — no renumbering or reuse) to the config proto IntField/BoolField/StringSliceField/StringMapField/StringField, replaces the folding GetExportedDefaultValue helper with a separate GetSuggestedValue, and updates marshal.go to emit default_value and suggested_value independently; generated pb/.../*.pb.go output matches the proto source. The only new commit since the last review (7eace85) drops redundant proto field comments; those comments do not propagate into generated Go (verified — no drift), so no regeneration is required. The prior review's note about removing the exported GetExportedDefaultValue still stands but is low-impact since that symbol and the folding behavior were introduced in the unreleased base commit; 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.

The export path (schemaFieldToV1) now sources default_value from
GetDefaultValue and suggested_value from GetSuggestedValue, so
GetExportedDefaultValue is dead. Remove it and re-point
TestSuggestedValuePrecedence at schemaFieldToV1 so the both-values-set
case is still covered through the real export path.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>

@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.

Comment thread proto/c1/config/v1/config.proto Outdated
Per review, the self-explanatory suggested_value field name doesn't need
the per-field pre-population comment. Remove it from all five typed
sub-messages and regenerate.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>

@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.

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