Lee-W commented on code in PR #72152:
URL: https://github.com/apache/airflow/pull/72152#discussion_r3964090968


##########
providers/common/ai/tests/unit/common/ai/hooks/test_pydantic_ai.py:
##########
@@ -930,3 +951,35 @@ def 
test_documented_model_prefix_is_a_valid_pydantic_ai_provider(self):
             # environment; failing past provider-name resolution is enough to
             # prove "google-cloud" is recognized.
             pass
+
+    def test_conn_fields_model_description_prefix_is_valid_provider(self):
+        """
+        Drift tripwire for the ``provider.yaml`` conn-field, the actual UI 
source.
+
+        Once a hook's ``provider.yaml`` declares ``conn-fields``, the 
connection
+        form renders those and ``get_ui_field_behaviour`` placeholders are 
never
+        shown (``providers_manager.py``'s ``ui_metadata_loaded``, deprecated
+        since 3.2.0) — so this description, not the placeholder below, is what
+        a user actually copies the model prefix from.
+        """
+        connection_types = get_provider_info()["connection-types"]
+        vertex_conn_fields = next(
+            c["conn-fields"] for c in connection_types if c["connection-type"] 
== "pydanticai-vertex"
+        )
+        description = vertex_conn_fields["model"]["description"]
+        match = _GOOGLE_MODEL_PREFIX_RE.search(description)
+        assert match, f"no google model prefix found in description: 
{description!r}"
+        _assert_prefix_is_known_provider(match.group())
+
+    def test_ui_field_behaviour_placeholder_prefix_is_valid_provider(self):
+        """
+        Drift tripwire for the ``get_ui_field_behaviour`` placeholder.
+
+        Superseded at runtime by the ``provider.yaml`` conn-field above, but
+        still source code a developer can read and copy from directly, so it
+        needs to stay accurate too.
+        """
+        placeholder = 
PydanticAIVertexHook.get_ui_field_behaviour()["placeholders"]["extra"]

Review Comment:
   Added 
`test_conn_types_ui_field_behaviour_placeholder_prefix_is_valid_provider`.
   
   It reads `get_provider_info()["connection-types"]`'s 
`ui-field-behaviour.placeholders.extra` for `pydanticai-vertex` — the copy that 
lives
   in `provider.yaml` itself, separate from `conn-fields` and from the hook's 
`get_ui_field_behaviour`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to