From fbdeb6873a2ae4900604cd3747bc59def1e64942 Mon Sep 17 00:00:00 2001 From: KaifAhmad1 Date: Wed, 10 Jun 2026 15:38:30 +0530 Subject: [PATCH] fix(ingest): prevent mutable options mutation in batch/multi-example calls Deep-copy **options in ingest_examples and batch_public_apis so that mutable values (e.g. params dicts) are not shared across iterations. Add rate_limit_delay to the config_only_key strip list in ingest_public_api so it is not forwarded twice when passed via kwargs. --- semantica/ingest/methods.py | 1 + semantica/ingest/public_api_ingestor.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/semantica/ingest/methods.py b/semantica/ingest/methods.py index f8cdcb4d..83c05cff 100644 --- a/semantica/ingest/methods.py +++ b/semantica/ingest/methods.py @@ -552,6 +552,7 @@ def ingest_public_api( "delay", "fail_fast", "max_retries", + "rate_limit_delay", "validate_no_auth", ): request_kwargs.pop(config_only_key, None) diff --git a/semantica/ingest/public_api_ingestor.py b/semantica/ingest/public_api_ingestor.py index 0b467053..afefbe27 100644 --- a/semantica/ingest/public_api_ingestor.py +++ b/semantica/ingest/public_api_ingestor.py @@ -565,7 +565,7 @@ class PublicAPIIngestor(RESTIngestor): def ingest_examples(self, names: List[str], **options) -> List[APIData]: """Ingest multiple pre-configured public API examples.""" - return [self.ingest_example(name, **options) for name in names] + return [self.ingest_example(name, **copy.deepcopy(options)) for name in names] def batch_public_apis( self, @@ -578,7 +578,7 @@ class PublicAPIIngestor(RESTIngestor): for endpoint in endpoints: try: results.append( - self.ingest_public_api(endpoint, method=method, **options) + self.ingest_public_api(endpoint, method=method, **copy.deepcopy(options)) ) except Exception as exc: self.logger.warning(f"Failed to fetch public API {endpoint}: {exc}")