Skip to content

refactor: rename SecretVar.Ref() to GetSecretRef() and IsFromEnv() to IsFromSecret() - #4600

Closed
BearTS wants to merge 1 commit into
06-22-feat_make_secretref_and_fromsecret_non_global_fieldsfrom
06-22-refactor_change_ref_-_secretref
Closed

refactor: rename SecretVar.Ref() to GetSecretRef() and IsFromEnv() to IsFromSecret()#4600
BearTS wants to merge 1 commit into
06-22-feat_make_secretref_and_fromsecret_non_global_fieldsfrom
06-22-refactor_change_ref_-_secretref

Conversation

@BearTS

@BearTS BearTS commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Renames the Ref() method on SecretVar to GetSecretRef() to improve API clarity and consistency with the existing GetValue() and IsFromSecret() naming conventions. Alongside this rename, tests are updated to use IsFromSecret() instead of IsFromEnv() and FromEnv field accesses, and test fixtures are migrated from direct struct literal construction to the NewSecretVarFromRef constructor.

Changes

  • Renamed SecretVar.Ref() to SecretVar.GetSecretRef() across all call sites in core schemas, providers, config store, and HTTP transport layers
  • Replaced IsFromEnv() assertions and direct FromEnv/EnvVar field accesses in tests with IsFromSecret() and GetSecretRef() to reflect the unified secret source abstraction
  • Replaced inline SecretVar{Val: "", EnvVar: "...", FromEnv: true} struct literals in tests with NewSecretVarFromRef(...) constructor calls
  • Updated JSON field name expectations in redaction tests from env_var/from_env to secret_ref/from_secret

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

go test ./core/schemas/...
go test ./core/providers/utils/...
go test ./framework/configstore/...
go test ./transports/bifrost-http/...

Breaking changes

  • Yes
  • No

Any code outside this repository that calls SecretVar.Ref() or SecretVar.IsFromEnv() directly, or that accesses the EnvVar/FromEnv struct fields, will need to be updated to use GetSecretRef() and IsFromSecret() respectively.

Security considerations

No functional changes to secret resolution or storage logic. This is a pure rename/refactor with no impact on how secrets are read, written, or redacted.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved consistency of error and warning messages when secret-backed configuration values resolve to empty.
  • New Features

    • Extended configuration schema to support secret references for MCP external client URL settings.
  • Chores

    • Standardized internal secret reference handling and validation across configuration components.

Walkthrough

Renames the exported SecretVar.Ref() accessor to GetSecretRef() and updates all call sites across providers, configstore, and HTTP transport layers. Simultaneously migrates IsFromEnv()/FromEnv/env_var semantics to IsFromSecret()/from_secret/secret_ref in production code and tests. JSON parsing in NewSecretVar and UnmarshalJSON now accepts objects with only a value field. Schema is updated to support secret references in MCP external client URL configuration.

Changes

SecretVar API Rename and Provenance Semantics Migration

Layer / File(s) Summary
SecretVar method rename and JSON parsing relaxation
core/schemas/secretvar.go
The exported Ref() method is renamed to GetSecretRef() with updated doc comments. JSON-object parsing in NewSecretVar and UnmarshalJSON now enters when a value field exists, independent of env_var or secret_ref presence, allowing compatibility unmarshalling to determine provenance.
Core provider validation errors use GetSecretRef()
core/providers/utils/utils.go
Error messages in ConfigureProxy (HTTP proxy, SOCKS5 proxy, CA cert branches) and ConfigureTLS now invoke GetSecretRef() when reporting empty secret-resolved proxy and network configuration values.
Configstore hashing and MCP header serialization use GetSecretRef()
framework/configstore/clientconfig.go, framework/configstore/rdb.go, framework/configstore/tables/mcp.go
Hash computation in GenerateClientConfigHash, GenerateKeyHash, and GenerateMCPClientHash use GetSecretRef() for secret-reference hash inputs. Header serialization in UpdateMCPClientConfig and TableMCPClient.BeforeSave persist secret-backed header values via GetSecretRef().
Bifrost HTTP handlers and config library use GetSecretRef()
transports/bifrost-http/handlers/config.go, transports/bifrost-http/lib/config.go
HTTP handler (updateConfig) and config library (loadAuthConfig) use GetSecretRef() when constructing validation error messages for empty secret-resolved credentials and preserving secret reference metadata during auth configuration.
SecretVar and vault unit tests: GetSecretRef() and IsFromSecret() assertions
core/schemas/secretvar_test.go, core/schemas/vault_test.go
Tests update assertions to validate secret references via GetSecretRef() and provenance via IsFromSecret() for env-var references, backward-compatibility unmarshalling, vault references, redacted values, and map entry handling.
Client config redaction tests: secret_ref/from_secret JSON schema
framework/configstore/clientconfig_redaction_test.go
Redaction test expectations assert IsFromSecret() provenance and validate unmarshaled JSON exposes secret_ref plus from_secret: true for env-backed secrets, and confirm non-secret endpoints have from_secret: false.
Encryption tests: IsFromSecret() provenance and value access
framework/configstore/encryption_test.go, framework/configstore/tables/encryption_test.go
Encryption tests update SecretVar-backed provider config assertions from IsFromEnv() to IsFromSecret(); unresolved-ref construction migrates to NewSecretVar("env.<VAR>"); reference metadata validated via GetSecretRef(). One virtual key test fixes direct value comparison using GetValue().
Virtual key tests: IsFromSecret() and GetSecretRef() assertions
framework/configstore/tables/virtualkey_secretvar_test.go
Env-backed reference assertions switch from IsFromEnv()/EnvVar to IsFromSecret()/GetSecretRef() across database round-trips, JSON marshaling, and JSON unmarshaling.
Bifrost auth tests: IsFromSecret() and GetSecretRef() assertions
transports/bifrost-http/lib/config_test.go, transports/bifrost-http/lib/ctx_test.go
Auth tests update provenance assertions from IsFromEnv()/EnvVar to IsFromSecret()/GetSecretRef() for env-backed username and password across resolution, hashing, combined flows, and missing-env-var scenarios.
Config schema: mcp_external_client_url supports secret references
transports/config.schema.json
JSON schema for mcp_external_client_url (object form) is extended with secret_ref (string) and from_secret (boolean) properties alongside existing fields, enabling secret-backed external client URL configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • danpiths
  • akshaydeo

Poem

🐇 A method once called Ref, now GetSecretRef instead,
With IsFromSecret hopping where IsFromEnv once led,
No logic was changed, just the names freshly renamed,
The rabbit checked every file—each caller reclaimed!
✨ Consistent at last, from the schema outward spread.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.38% 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
Title check ✅ Passed The title accurately summarizes the main refactoring changes: renaming SecretVar.Ref() to GetSecretRef() and IsFromEnv() to IsFromSecret().
Description check ✅ Passed The description covers all key aspects: purpose, changes made, type of change, affected areas, testing instructions, breaking changes, and security considerations. It follows the template structure and provides sufficient detail.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-22-refactor_change_ref_-_secretref

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"


Comment @coderabbitai help to get the list of available commands and usage tips.

@BearTS BearTS changed the title refactor: change ref -> secretRef refactor: rename SecretVar.Ref() to GetSecretRef() and IsFromEnv() to IsFromSecret() Jun 22, 2026
@BearTS
BearTS marked this pull request as ready for review June 22, 2026 07:33
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Pure rename refactor with no functional changes to secret resolution, storage, or redaction logic; all call sites updated consistently.

Every renamed method has its call sites updated across all affected layers, and the JSON wire format change is handled with backward-compatible schema additions. The one non-trivial behavioral change — the widened JSON-object detection condition in NewSecretVar/UnmarshalJSON — moves from a buggy fallthrough to correct structured parsing and is an improvement, not a regression.

No files require special attention. The stale Ref() strings in test error messages are cosmetic only.

Important Files Changed

Filename Overview
core/schemas/secretvar.go Renames Ref() to GetSecretRef(); widens JSON-object detection condition in NewSecretVar/UnmarshalJSON to fire on any object that has a "value" key (previously also required env_var or secret_ref). No logic regressions; the widening is a correctness improvement.
core/schemas/secretvar_test.go All Ref()/IsFromEnv() call sites updated to GetSecretRef()/IsFromSecret(); NewSecretVarFromRef() constructor calls replaced with direct private-field struct literals (valid in package schemas). Several t.Errorf format strings still reference the old "Ref()" name.
transports/config.schema.json Adds secret_ref/from_secret fields to the SecretVar object shape while retaining the legacy env_var/from_env fields for backward compatibility. Correct approach.
framework/configstore/clientconfig.go Mechanical rename of Ref() to GetSecretRef() in hash computation paths. No behavioral change.
framework/configstore/tables/encryption_test.go Replaces IsFromEnv()/EnvVar field accesses and inline struct literals with IsFromSecret()/GetSecretRef()/NewSecretVar constructor. Also fixes one assertion from found.Value (string) to found.Value.GetValue() reflecting the SecretVar type upgrade in TableVirtualKey.
framework/configstore/rdb.go Single-line rename of Ref() to GetSecretRef() in header serialization. Correct.
core/providers/utils/utils.go Four mechanical renames of Ref() to GetSecretRef() in proxy/TLS error-message format strings. No behavioral change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Input string to NewSecretVar / UnmarshalJSON"] --> B{Valid JSON?}
    B -- No --> E{Has env. prefix?}
    B -- Yes --> C{"Has 'value' key?\n(new: value only)\n(old: value + env_var or secret_ref)"}
    C -- No --> E
    C -- Yes --> D["Parse via secretVarCompat struct"]
    D --> D1{secret_ref or from_secret set?}
    D1 -- Yes --> D2["New format: SecretVar{secretRef, fromSecret}"]
    D1 -- No --> D3{from_env + env_var set?}
    D3 -- Yes --> D4["Backward compat: migrate env_var to env.X"]
    D3 -- No --> D5{value == env_var == env.X?}
    D5 -- Yes --> D6["Legacy format: resolve env ref"]
    D5 -- No --> D7["Plain value: SecretVar{Val}"]
    E -- Yes --> F["env-sourced SecretVar{secretRef: env.X}"]
    E -- No --> G{Has vault. prefix?}
    G -- Yes --> H["vault-sourced SecretVar{secretRef: vault.X}"]
    G -- No --> I["Plain SecretVar{Val}"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["Input string to NewSecretVar / UnmarshalJSON"] --> B{Valid JSON?}
    B -- No --> E{Has env. prefix?}
    B -- Yes --> C{"Has 'value' key?\n(new: value only)\n(old: value + env_var or secret_ref)"}
    C -- No --> E
    C -- Yes --> D["Parse via secretVarCompat struct"]
    D --> D1{secret_ref or from_secret set?}
    D1 -- Yes --> D2["New format: SecretVar{secretRef, fromSecret}"]
    D1 -- No --> D3{from_env + env_var set?}
    D3 -- Yes --> D4["Backward compat: migrate env_var to env.X"]
    D3 -- No --> D5{value == env_var == env.X?}
    D5 -- Yes --> D6["Legacy format: resolve env ref"]
    D5 -- No --> D7["Plain value: SecretVar{Val}"]
    E -- Yes --> F["env-sourced SecretVar{secretRef: env.X}"]
    E -- No --> G{Has vault. prefix?}
    G -- Yes --> H["vault-sourced SecretVar{secretRef: vault.X}"]
    G -- No --> I["Plain SecretVar{Val}"]
Loading

Reviews (3): Last reviewed commit: "refactor: change ref -> secretRef" | Re-trigger Greptile

Comment thread transports/bifrost-http/lib/ctx_test.go Outdated

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/schemas/vault_test.go (1)

174-178: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the X-Env invariant explicit in this test.

This block only validates behavior when metadata is already correct, so a regression in IsFromSecret()/GetSecretRef() can pass silently. Assert the metadata first, then assert it was not vault-stored.

Suggested patch
-	if env := m.Headers["X-Env"]; env.IsFromSecret() && env.GetSecretRef() == "env.X" {
-		if stored["bifrost/m/1/headers/X-Env"] != "" {
-			t.Error("env-sourced header should not be vault-stored")
-		}
-	}
+	env := m.Headers["X-Env"]
+	if !env.IsFromSecret() || env.GetSecretRef() != "env.X" {
+		t.Errorf("env header metadata changed unexpectedly: ref=%q fromSecret=%v", env.GetSecretRef(), env.IsFromSecret())
+	}
+	if stored["bifrost/m/1/headers/X-Env"] != "" {
+		t.Error("env-sourced header should not be vault-stored")
+	}
🤖 Prompt for 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.

In `@core/schemas/vault_test.go` around lines 174 - 178, The test in the metadata
validation block around the X-Env header check only validates the vault-storage
assertion when the IsFromSecret() and GetSecretRef() conditions are already
true, which means regressions in those methods could pass silently. Split the
validation into two parts: first add explicit assertions that env.IsFromSecret()
returns true and env.GetSecretRef() returns "env.X" to make the metadata
invariant explicit, then separately assert that
stored["bifrost/m/1/headers/X-Env"] is empty. This ensures that any regression
in IsFromSecret() or GetSecretRef() will cause the test to fail rather than
being skipped.
🤖 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 `@framework/configstore/tables/encryption_test.go`:
- Line 252: The schema file transports/config.schema.json contains outdated
field naming that conflicts with the new provenance field semantics now
reflected in the code tests using IsFromSecret() and GetSecretRef() methods.
Update all occurrences of the env_var property to secret_ref and all occurrences
of the from_env property to from_secret throughout the schema file, including at
mcp_external_client_url (lines 268-269) and all other secret provenance field
definitions listed at lines 1150-1177, 2111-2112, 2143-2144, 2217-2218,
2232-2233, 2255-2256, and 2334-2335, to ensure the schema matches the code
contract and prevents validation drift and serialization failures.

In `@transports/bifrost-http/handlers/config.go`:
- Line 140: The SecretVar serialization in the handler produces "secret_ref" and
"from_secret" fields, but the schema definition for the mcp_external_client_url
field in transports/config.schema.json (lines 259–271) has additionalProperties
set to false and only allows the legacy "env_var" and "from_env" fields. Update
the mcp_external_client_url schema definition to accept both the old format
fields (env_var, from_env) for backward compatibility and the new format fields
(secret_ref, from_secret), or set additionalProperties to true to allow the new
serialized format to pass validation.

In `@transports/bifrost-http/lib/config.go`:
- Line 3647: The runtime code at line 3647 is now serializing secrets using
secret_ref and from_secret field names via schemas.NewSecretVarFromRef(), but
the schema validation in transports/config.schema.json has not been updated to
accept these fields. Update the schema to validate secret_ref and from_secret
alongside the existing env_var and from_env validations. Apply this change to
all secretized fields including mcp_external_client_url and credential fields
for bedrock, vault, azure, gcp, and ollama configurations to ensure the
serialized output will pass schema validation.

In `@transports/bifrost-http/lib/ctx_test.go`:
- Around line 535-537: The error message in the assertion that checks
IsFromSecret() still references the old "from-env" terminology which is
inconsistent with the updated API method name. Update the error message string
in the t.Error() call to use the new API terminology instead of "from-env",
making it consistent with what IsFromSecret() actually validates.

---

Outside diff comments:
In `@core/schemas/vault_test.go`:
- Around line 174-178: The test in the metadata validation block around the
X-Env header check only validates the vault-storage assertion when the
IsFromSecret() and GetSecretRef() conditions are already true, which means
regressions in those methods could pass silently. Split the validation into two
parts: first add explicit assertions that env.IsFromSecret() returns true and
env.GetSecretRef() returns "env.X" to make the metadata invariant explicit, then
separately assert that stored["bifrost/m/1/headers/X-Env"] is empty. This
ensures that any regression in IsFromSecret() or GetSecretRef() will cause the
test to fail rather than being skipped.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e9f826df-9757-4a93-a460-412bebceb942

📥 Commits

Reviewing files that changed from the base of the PR and between 983be90 and 2867ee5.

📒 Files selected for processing (15)
  • core/providers/utils/utils.go
  • core/schemas/secretvar.go
  • core/schemas/secretvar_test.go
  • core/schemas/vault_test.go
  • framework/configstore/clientconfig.go
  • framework/configstore/clientconfig_redaction_test.go
  • framework/configstore/encryption_test.go
  • framework/configstore/rdb.go
  • framework/configstore/tables/encryption_test.go
  • framework/configstore/tables/mcp.go
  • framework/configstore/tables/virtualkey_secretvar_test.go
  • transports/bifrost-http/handlers/config.go
  • transports/bifrost-http/lib/config.go
  • transports/bifrost-http/lib/config_test.go
  • transports/bifrost-http/lib/ctx_test.go

require.NoError(t, db.First(&found, key.ID).Error)
// The value should be readable (either the env var value or empty if not set)
assert.True(t, found.Value.IsFromEnv())
assert.True(t, found.Value.IsFromSecret())

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate schema provenance keys =="
rg -n '"mcp_external_client_url"|"env_var"|"from_env"|"secret_ref"|"from_secret"' transports/config.schema.json

echo
echo "== Spot-check new-key usage in code/tests =="
rg -n 'GetSecretRef\(|IsFromSecret\(|"secret_ref"|"from_secret"' core framework transports

Repository: maximhq/bifrost

Length of output: 24649


Update transports/config.schema.json to reflect provenance field naming changes.

The code tests now use IsFromSecret()/GetSecretRef() semantics, but the schema still defines env_var/from_env for all secret provenance fields (including mcp_external_client_url at lines 268–269 and numerous other config surfaces at lines 1150–1177, 2111–2112, 2143–2144, 2217–2218, 2232–2233, 2255–2256, 2334–2335).

Schema is the source of truth for config validation and serialization. This naming mismatch will cause validation drift and serialization failures. Rename all occurrences of env_varsecret_ref and from_envfrom_secret in the schema to match the updated code contract.

🤖 Prompt for 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.

In `@framework/configstore/tables/encryption_test.go` at line 252, The schema file
transports/config.schema.json contains outdated field naming that conflicts with
the new provenance field semantics now reflected in the code tests using
IsFromSecret() and GetSecretRef() methods. Update all occurrences of the env_var
property to secret_ref and all occurrences of the from_env property to
from_secret throughout the schema file, including at mcp_external_client_url
(lines 268-269) and all other secret provenance field definitions listed at
lines 1150-1177, 2111-2112, 2143-2144, 2217-2218, 2232-2233, 2255-2256, and
2334-2335, to ensure the schema matches the code contract and prevents
validation drift and serialization failures.

Source: Coding guidelines

Comment thread transports/bifrost-http/handlers/config.go Outdated
Comment thread transports/bifrost-http/lib/config.go Outdated
Comment thread transports/bifrost-http/lib/ctx_test.go
@BearTS
BearTS force-pushed the 06-22-refactor_change_ref_-_secretref branch from 2867ee5 to bf0a972 Compare June 22, 2026 07:46
@BearTS
BearTS force-pushed the 06-22-feat_make_secretref_and_fromsecret_non_global_fields branch from 983be90 to 6ccf345 Compare June 22, 2026 08:38
@BearTS
BearTS force-pushed the 06-22-refactor_change_ref_-_secretref branch from bf0a972 to f6e7cf6 Compare June 22, 2026 08:38

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

🧹 Nitpick comments (1)
framework/configstore/tables/encryption_test.go (1)

1808-1810: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Assert Bedrock provenance boolean in round-trip tests too.

These checks validate GetSecretRef() but skip IsFromSecret(). Adding parity assertions (as done for Vertex/Azure/Ollama/SGL) strengthens coverage for the encryption no-op contract that keys off secret provenance.

Suggested diff
 	assert.Equal(t, "env.FAKE_AWS_ACCESS_KEY_FOR_TEST", found.BedrockKeyConfig.AccessKey.GetSecretRef(),
 		"env var reference for AccessKey lost on round-trip")
+	assert.True(t, found.BedrockKeyConfig.AccessKey.IsFromSecret(),
+		"from_secret flag for AccessKey lost on round-trip")
 	assert.Equal(t, "env.FAKE_AWS_SECRET_KEY_FOR_TEST", found.BedrockKeyConfig.SecretKey.GetSecretRef(),
 		"env var reference for SecretKey lost on round-trip")
+	assert.True(t, found.BedrockKeyConfig.SecretKey.IsFromSecret(),
+		"from_secret flag for SecretKey lost on round-trip")
🤖 Prompt for 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.

In `@framework/configstore/tables/encryption_test.go` around lines 1808 - 1810,
The round-trip test assertions for BedrockKeyConfig are incomplete. Currently
they check GetSecretRef() for both AccessKey and SecretKey but skip validating
the IsFromSecret() provenance boolean. Add assertions after the existing
GetSecretRef() checks to validate that BedrockKeyConfig.AccessKey.IsFromSecret()
and BedrockKeyConfig.SecretKey.IsFromSecret() both return the expected boolean
values, following the same pattern used in the test assertions for Vertex,
Azure, Ollama, and SGL key configurations to maintain consistency and ensure
complete encryption no-op contract validation.
🤖 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.

Nitpick comments:
In `@framework/configstore/tables/encryption_test.go`:
- Around line 1808-1810: The round-trip test assertions for BedrockKeyConfig are
incomplete. Currently they check GetSecretRef() for both AccessKey and SecretKey
but skip validating the IsFromSecret() provenance boolean. Add assertions after
the existing GetSecretRef() checks to validate that
BedrockKeyConfig.AccessKey.IsFromSecret() and
BedrockKeyConfig.SecretKey.IsFromSecret() both return the expected boolean
values, following the same pattern used in the test assertions for Vertex,
Azure, Ollama, and SGL key configurations to maintain consistency and ensure
complete encryption no-op contract validation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 81315b0a-6101-4424-8100-db2d6e9fc928

📥 Commits

Reviewing files that changed from the base of the PR and between bf0a972 and f6e7cf6.

📒 Files selected for processing (16)
  • core/providers/utils/utils.go
  • core/schemas/secretvar.go
  • core/schemas/secretvar_test.go
  • core/schemas/vault_test.go
  • framework/configstore/clientconfig.go
  • framework/configstore/clientconfig_redaction_test.go
  • framework/configstore/encryption_test.go
  • framework/configstore/rdb.go
  • framework/configstore/tables/encryption_test.go
  • framework/configstore/tables/mcp.go
  • framework/configstore/tables/virtualkey_secretvar_test.go
  • transports/bifrost-http/handlers/config.go
  • transports/bifrost-http/lib/config.go
  • transports/bifrost-http/lib/config_test.go
  • transports/bifrost-http/lib/ctx_test.go
  • transports/config.schema.json
✅ Files skipped from review due to trivial changes (1)
  • transports/bifrost-http/lib/config.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • framework/configstore/rdb.go
  • transports/bifrost-http/lib/ctx_test.go
  • framework/configstore/tables/mcp.go
  • framework/configstore/tables/virtualkey_secretvar_test.go
  • framework/configstore/clientconfig_redaction_test.go
  • framework/configstore/clientconfig.go
  • framework/configstore/encryption_test.go
  • core/providers/utils/utils.go
  • core/schemas/secretvar.go
  • transports/bifrost-http/lib/config_test.go

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