Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infrahub_sdk/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InfrahubCheckInitializer(BaseModel):
class InfrahubCheck:
name: str | None = None
query: str = ""
timeout: int = 10
timeout: int = 60
Copy link

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

Verify timeout usage and confirm test coverage.

The default timeout has been increased from 10 to 60 seconds. Ensure that:

  1. All usages of InfrahubCheck.timeout are compatible with the new default
  2. Existing tests that may depend on the 10-second timeout are updated accordingly
  3. No subclasses override this value in a way that would be affected by the change

Run the following script to verify timeout usage and identify potential impacts:


🏁 Script executed:

#!/bin/bash
# Description: Find all references to timeout in checks and related tests

echo "=== Searching for timeout usage in InfrahubCheck subclasses ==="
rg -n --type=py -C3 'class.*\(InfrahubCheck\)'

echo -e "\n=== Searching for explicit timeout assignments ==="
rg -n --type=py -C3 '\.timeout\s*='

echo -e "\n=== Searching for timeout references in tests ==="
rg -n --type=py -C3 'timeout.*=.*10' -g '*test*.py'

echo -e "\n=== Searching for InfrahubCheck instantiations ==="
rg -n --type=py -C3 'InfrahubCheck\('

Length of output: 2889



🏁 Script executed:

#!/bin/bash
echo "=== Contents of infrahub_sdk/checks.py ==="
sed -n '1,200p' infrahub_sdk/checks.py

echo -e "\n=== Searching for 'timeout' in checks.py ==="
rg -n 'timeout' -C3 infrahub_sdk/checks.py

Length of output: 5940


Remove or integrate the unused timeout attribute
The timeout field on InfrahubCheck is never used (e.g. not passed to client.query_gql_query), so bumping its default has no effect. Either wire it into the client’s GraphQL calls (and update tests) or remove it.

🤖 Prompt for AI Agents
In infrahub_sdk/checks.py around line 36, the timeout attribute on InfrahubCheck
is defined but never used; either remove the unused timeout field or wire it
through to the GraphQL client calls. To fix: if keeping timeout, add it as a
parameter to the code path that performs GraphQL queries (pass it into
client.query_gql_query or equivalent method, updating that method signature and
all call sites and tests to accept/forward the timeout), or delete the attribute
from the dataclass and remove/update any tests that reference it. Ensure tests
reflect the chosen approach.


def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class InfrahubTransform(InfrahubOperation):
name: str | None = None
query: str
timeout: int = 10
timeout: int = 60

def __init__(
self,
Expand Down