fix(python-bridge): allow instance shadowing only for validated config attributes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Yujong Lee 2026-09-21 20:58:02 +00:00
parent 4a0151f77f
commit d3f2ddba05
2 changed files with 3 additions and 1 deletions

View file

@ -120,7 +120,7 @@ impl ObjectGuard {
if !attributes.get_item(name)?.is(value.bind(py)) {
return Ok(false);
}
if instance.contains(name)? && value.bind(py).is_callable() {
if instance.contains(name)? && !self.config_names.contains(&name.as_str()) {
return Ok(false);
}
}

View file

@ -820,6 +820,8 @@ def test_redis_semantic_configuration_drift_falls_back_to_python(
assert resolver.resolve().kind == "python_callback"
with rebound(facade.cache, "_index_name", "other-index"):
assert resolver.resolve().kind == "python_callback"
with rebound(facade.cache, "CACHE_KEY_FIELD_NAME", "other-field"):
assert resolver.resolve().kind == "python_callback"
def patched_embedding(self: object, prompt: str, metadata: object = None) -> list[float]:
return _semantic_embedding(prompt)