Skip to content

stable to develop#916

Merged
ajtmccarty merged 4 commits intodevelopfrom
stable
Apr 3, 2026
Merged

stable to develop#916
ajtmccarty merged 4 commits intodevelopfrom
stable

Conversation

@ajtmccarty
Copy link
Copy Markdown
Contributor

@ajtmccarty ajtmccarty commented Apr 3, 2026

Summary by CodeRabbit

  • Documentation
    • Updated generator configuration documentation to provide clearer descriptions of parameter mapping, target group selection, Python class implementation, and execution flow options.

Wim Van Deun and others added 4 commits March 30, 2026 11:20
Bumps [infrahub-testcontainers](https://github.com/opsmill/infrahub) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/opsmill/infrahub/releases)
- [Changelog](https://github.com/opsmill/infrahub/blob/stable/CHANGELOG.md)
- [Commits](opsmill/infrahub@infrahub-v1.8.1...infrahub-v1.8.2)

---
updated-dependencies:
- dependency-name: infrahub-testcontainers
  dependency-version: 1.8.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…stcontainers-1.8.2

chore(deps-dev): bump infrahub-testcontainers from 1.8.1 to 1.8.2
…ratorDefintionConfig-descriptions

improve InfrahubGeneratorDefintionConfig descriptions
@ajtmccarty ajtmccarty requested a review from a team as a code owner April 3, 2026 17:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Walkthrough

The change updates field descriptions in InfrahubGeneratorDefinitionConfig to clarify the configuration schema semantics. Specifically, the parameters field description is updated to explain GraphQL variable name to attribute path mapping using double-underscore notation. The targets field description is refined to specify it references a CoreStandardGroup whose members become individual targets. The class_name field description clarifies it specifies a Python class extending InfrahubGenerator with a default of "Generator". Additionally, descriptions for convert_query_response, execute_in_proposed_change, and execute_after_merge are updated without modifying their default values or types.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author; the PR lacks any explanation of the changes, rationale, or testing performed. Add a comprehensive description following the repository template: include the 'Why' section explaining the motivation, 'What changed' section describing the documentation updates, and relevant sections from the template to provide proper context for reviewers.
Title check ❓ Inconclusive The title 'stable to develop' is vague and generic, describing a branch merge operation rather than the actual changes made to the codebase (documentation updates for InfrahubGeneratorDefinitionConfig fields). Provide a descriptive title that summarizes the main change, such as 'Update InfrahubGeneratorDefinitionConfig field descriptions' to better reflect the actual modifications in the PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
infrahub_sdk/schema/repository.py (1)

84-113: Run formatting, linting, and documentation generation commands before merging.

You've modified Field descriptions in Pydantic models. Before merging, run:

  • uv run invoke format lint-code to ensure code formatting and linting compliance
  • uv run invoke docs-generate to regenerate documentation from updated docstrings
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@infrahub_sdk/schema/repository.py` around lines 84 - 113, The Field
descriptions on the Pydantic model InfrahubGeneratorDefinitionConfig were
changed; before merging, run the repository formatting, linting, and docs
generation steps to ensure consistency and updated docs: execute "uv run invoke
format lint-code" to apply formatting and lint fixes for the modified Field
usages (e.g., name, file_path, query, parameters, targets, class_name,
convert_query_response, execute_in_proposed_change, execute_after_merge) and
then run "uv run invoke docs-generate" to regenerate documentation from the
updated docstrings/descriptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@infrahub_sdk/schema/repository.py`:
- Around line 90-93: The Field description for the parameters attribute is
inaccurate; update the Field(description=...) for the parameters variable in the
repository.Schema class so it says that keys are member object attribute names
used to extract values (via getattr on member.peer) and those extracted values
are passed directly as GraphQL variables, rather than describing any
double-underscore path parsing. Reference the parameters Field and the usage via
getattr(member.peer, identifier) in generator modules when editing the text.

---

Nitpick comments:
In `@infrahub_sdk/schema/repository.py`:
- Around line 84-113: The Field descriptions on the Pydantic model
InfrahubGeneratorDefinitionConfig were changed; before merging, run the
repository formatting, linting, and docs generation steps to ensure consistency
and updated docs: execute "uv run invoke format lint-code" to apply formatting
and lint fixes for the modified Field usages (e.g., name, file_path, query,
parameters, targets, class_name, convert_query_response,
execute_in_proposed_change, execute_after_merge) and then run "uv run invoke
docs-generate" to regenerate documentation from the updated
docstrings/descriptions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f99bb3d8-46cb-4756-bd34-9c0990c40fdd

📥 Commits

Reviewing files that changed from the base of the PR and between a9a6893 and 70202d4.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • infrahub_sdk/schema/repository.py

Comment on lines 90 to +93
parameters: dict[str, Any] = Field(
default_factory=dict, description="The input parameters required to run this check"
default_factory=dict,
description="Maps GraphQL query variable names to target object attribute paths using double-underscore notation.",
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for code that parses double-underscore notation in parameters

# Search for patterns that might indicate double-underscore parsing
rg -n -C5 '__' --type=py --glob='**/generator*.py' --glob='**/repository*.py'

# Look for methods that process params/parameters in generator classes
ast-grep --pattern 'def $FUNC($$$) {
  $$$
  params
  $$$
}'

Repository: opsmill/infrahub-sdk-python

Length of output: 11179


🏁 Script executed:

# Search for InfrahubGeneratorDefinitionConfig usage and definition
rg -n "InfrahubGeneratorDefinitionConfig" --type=py -A 5 -B 2

# Look at the actual parameters field definition and usage
rg -n "parameters" --type=py infrahub_sdk/schema/repository.py

# Check for any documentation or tests about how parameters work
fd -e py -e md | xargs rg -l "parameters.*GraphQL\|parameters.*double" 2>/dev/null | head -10

Repository: opsmill/infrahub-sdk-python

Length of output: 3468


🏁 Script executed:

# Look at the full definition of InfrahubGeneratorDefinitionConfig
sed -n '84,115p' infrahub_sdk/schema/repository.py

# Search for how params/parameters are used in generator execution
rg -n "self.params\|parameters" infrahub_sdk/generator.py -B 3 -A 3

# Look for any transformation or parsing of parameters
rg -n "\.get\(|split\(|parse" infrahub_sdk/generator.py --type=py -A 2 -B 2

Repository: opsmill/infrahub-sdk-python

Length of output: 2081


🏁 Script executed:

# Search for actual examples or tests showing how the parameters field is used
rg -n "parameters.*=" --type=py -B 2 -A 2 | grep -A 5 -B 5 "InfrahubGeneratorDefinitionConfig\|generator.*parameters" | head -50

# Look at how collect_data and other methods use self.params
sed -n '45,80p' infrahub_sdk/generator.py

# Search for any documentation or examples in md/yaml files
fd -e md -e yaml | xargs grep -l "generator" 2>/dev/null | head -5

Repository: opsmill/infrahub-sdk-python

Length of output: 1392


🏁 Script executed:

# Find where self.params is initialized
rg -n "self.params\s*=" --type=py -B 5 -A 5

# Look for InfrahubOperation class definition
rg -n "class InfrahubOperation" --type=py -A 30

# Check if there's any initialization from InfrahubGeneratorDefinitionConfig
rg -n "InfrahubGenerator\|InfrahubOperation" infrahub_sdk/generator.py | head -20

Repository: opsmill/infrahub-sdk-python

Length of output: 4037


🏁 Script executed:

# Search for tests or examples using InfrahubGeneratorDefinitionConfig with parameters
fd -e py | xargs grep -l "InfrahubGeneratorDefinitionConfig\|generator.*config" 2>/dev/null | head -10

# Look at tests directory for generator tests
fd test.*generator -type f

# Search for any usage examples in comments or docstrings
rg -n "parameters.*:" --type=py -B 5 -A 5 infrahub_sdk/schema/repository.py

Repository: opsmill/infrahub-sdk-python

Length of output: 2254


🏁 Script executed:

# Look at how generator definitions are actually used in ctl/generator.py
sed -n '1,100p' infrahub_sdk/ctl/generator.py

# Search for examples of generator configs in test files
fd test -type d

# Look for any YAML examples of generators
fd -e yaml -e yml | xargs grep -l "generator" 2>/dev/null | head -5

Repository: opsmill/infrahub-sdk-python

Length of output: 4029


🏁 Script executed:

# Get more context from ctl/generator.py around the parameter usage
sed -n '85,100p' infrahub_sdk/ctl/generator.py

# Search for any double-underscore usage in context of parameters or attributes
rg -n "identifier\|check_parameter\|params" infrahub_sdk/ctl/generator.py -B 2 -A 2 | head -60

Repository: opsmill/infrahub-sdk-python

Length of output: 881


🏁 Script executed:

# Check if there's any double-underscore transformation in getattr or attribute access
rg -n "split.*__\|\.replace.*__\|parse.*__" --type=py

# Look more carefully at how parameters are used in the actual generator run
rg -n "params\|parameters" infrahub_sdk/ctl/generator.py -A 3 -B 3

# Check if there's any documentation about this in README or docs
find . -name "*.md" | xargs grep -i "generator.*parameter\|double.*underscore" 2>/dev/null

Repository: opsmill/infrahub-sdk-python

Length of output: 55


🏁 Script executed:

# Search more carefully for double-underscore pattern in context of parameters/attributes
rg "parameters" infrahub_sdk/ctl/generator.py -C 10

# Check if parameters are actually transformed or mapped anywhere
rg -n "\.keys\(\)|identifier|check_parameter" infrahub_sdk/ctl/generator.py

# Look at the complete generator config loading
sed -n '40,100p' infrahub_sdk/ctl/generator.py

Repository: opsmill/infrahub-sdk-python

Length of output: 3964


Correct the inaccurate parameters field description.

The current description states parameters "Maps GraphQL query variable names to target object attribute paths using double-underscore notation." However, investigation of infrahub_sdk/ctl/generator.py and infrahub_sdk/generator.py reveals that parameter keys are used directly as Python attribute names (via getattr(member.peer, identifier)) and passed to GraphQL queries without any parsing of double-underscore notation. No such transformation logic exists in the codebase.

Revise the description to accurately reflect that parameter keys represent member object attribute names used to extract values passed as GraphQL variables.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@infrahub_sdk/schema/repository.py` around lines 90 - 93, The Field
description for the parameters attribute is inaccurate; update the
Field(description=...) for the parameters variable in the repository.Schema
class so it says that keys are member object attribute names used to extract
values (via getattr on member.peer) and those extracted values are passed
directly as GraphQL variables, rather than describing any double-underscore path
parsing. Reference the parameters Field and the usage via getattr(member.peer,
identifier) in generator modules when editing the text.

@ajtmccarty ajtmccarty merged commit 2bfc100 into develop Apr 3, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants