imbajin commented on code in PR #351:
URL: https://github.com/apache/hugegraph-ai/pull/351#discussion_r3340722513
##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/schema_manager.py:
##########
@@ -23,14 +23,22 @@
class SchemaManager:
- def __init__(self, graph_name: str):
+ def __init__(
+ self,
+ graph_name: str,
+ *,
+ graph_url: Optional[str] = None,
+ graph_user: Optional[str] = None,
+ graph_pwd: Optional[str] = None,
+ graph_space: Optional[str] = None,
+ ):
self.graph_name = graph_name
self.client = PyHugeClient(
- url=huge_settings.graph_url,
+ url=graph_url if graph_url is not None else
huge_settings.graph_url,
graph=self.graph_name,
- user=huge_settings.graph_user,
- pwd=huge_settings.graph_pwd,
- graphspace=huge_settings.graph_space,
+ user=graph_user if graph_user is not None else
huge_settings.graph_user,
+ pwd=graph_pwd if graph_pwd is not None else
huge_settings.graph_pwd,
+ graphspace=graph_space if graph_space is not None else
huge_settings.graph_space,
Review Comment:
⚠️ **Avoid leaking the global graphspace into request-scoped schema fetches**
Evidence: `GraphConfigRequest.gs` is optional, so a `/graph/extract` request
can provide a named graph and omit `gs`; `GraphExtractFlow.prepare()` then
forwards `graph_space=None`, and this constructor falls back to
`huge_settings.graph_space`. If the process global graphspace was set by an
earlier config path, this request can fetch the schema from that graphspace
even though the caller did not select it. Please distinguish an omitted
request-scoped field from the no-request-config path, and cover the
`gs`-omitted case with a non-empty global `graph_space`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]