Improve introspection data manipulation#580
Conversation
Signed-off-by: mulhern <amulhern@redhat.com>
It is supported and preferred. Signed-off-by: mulhern <amulhern@redhat.com>
Signed-off-by: mulhern <amulhern@redhat.com>
Signed-off-by: mulhern <amulhern@redhat.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe script centralizes D-Bus interface naming and revision handling via new helpers and a shared ChangesIntrospection Revision Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
misc_scripts/update_introspection_data.py (1)
220-315: 💤 Low valueOptional: lift the four shared
_add_datacalls into a helper.
_make_python_specand_make_docs_specnow share the same(proxy, prefix-list)pairings for manager/pool/blockdev/filesystem — only the leadingOBJECT_MANAGER_INTERFACEintrospect differs. A small table-driven helper would keep them from drifting if a new interface family is added later.♻️ Sketch
_PROXY_INTERFACE_PREFIXES: list[tuple[ProxyType, Sequence[str]]] = [ (ProxyType.MANAGER, TOP_OBJECT_INTERFACE_PREFIXES), (ProxyType.POOL, POOL_OBJECT_INTERFACE_PREFIXES), (ProxyType.BLOCKDEV, BLOCKDEV_OBJECT_INTERFACE_PREFIXES), (ProxyType.FILESYSTEM, FILESYSTEM_OBJECT_INTERFACE_PREFIXES), ] def _add_revisioned_interfaces( specs: MutableMapping[str, str], proxies: Mapping[ProxyType, ProxyObject], revision_ext: str, ) -> None: for proxy_type, prefixes in _PROXY_INTERFACE_PREFIXES: _add_data(specs, proxies[proxy_type], _get_current_interfaces(revision_ext, prefixes))Then both
_make_python_specand_make_docs_speccollapse to a single call (plus the manager-onlyOBJECT_MANAGER_INTERFACEintrospect in the python case).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@misc_scripts/update_introspection_data.py` around lines 220 - 315, Introduce a small table-driven helper (e.g. a constant _PROXY_INTERFACE_PREFIXES: list[tuple[ProxyType, Sequence[str]]] and a function _add_revisioned_interfaces(specs, proxies, revision_ext)) that iterates the four pairs (ProxyType.MANAGER/ TOP_OBJECT_INTERFACE_PREFIXES, ProxyType.POOL/ POOL_OBJECT_INTERFACE_PREFIXES, ProxyType.BLOCKDEV/ BLOCKDEV_OBJECT_INTERFACE_PREFIXES, ProxyType.FILESYSTEM/ FILESYSTEM_OBJECT_INTERFACE_PREFIXES) and calls _add_data for each; then replace the four repeated _add_data(...) calls in _make_python_spec and _make_docs_spec with a single call to _add_revisioned_interfaces(specs, proxies, revision_ext), keeping the extra _add_data(specs, proxies[ProxyType.MANAGER], OBJECT_MANAGER_INTERFACE) only in _make_python_spec.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@misc_scripts/update_introspection_data.py`:
- Around line 285-287: Update the stale type annotations and docstring to
reflect that docs specs are keyed by interface name strings, not ProxyType:
change the return type of _make_docs_spec from dict[ProxyType, str] to dict[str,
str] (and its parameter/usage if necessary), update the parameter type of
_print_docs_spec from Mapping[ProxyType, str] to Mapping[str, str], and edit the
docstring that currently says "dict of ProxyType * XML object" to indicate "dict
of interface name (str) -> XML string" so annotations and docs match the code
paths that set specs[interface_name].
---
Nitpick comments:
In `@misc_scripts/update_introspection_data.py`:
- Around line 220-315: Introduce a small table-driven helper (e.g. a constant
_PROXY_INTERFACE_PREFIXES: list[tuple[ProxyType, Sequence[str]]] and a function
_add_revisioned_interfaces(specs, proxies, revision_ext)) that iterates the four
pairs (ProxyType.MANAGER/ TOP_OBJECT_INTERFACE_PREFIXES, ProxyType.POOL/
POOL_OBJECT_INTERFACE_PREFIXES, ProxyType.BLOCKDEV/
BLOCKDEV_OBJECT_INTERFACE_PREFIXES, ProxyType.FILESYSTEM/
FILESYSTEM_OBJECT_INTERFACE_PREFIXES) and calls _add_data for each; then replace
the four repeated _add_data(...) calls in _make_python_spec and _make_docs_spec
with a single call to _add_revisioned_interfaces(specs, proxies, revision_ext),
keeping the extra _add_data(specs, proxies[ProxyType.MANAGER],
OBJECT_MANAGER_INTERFACE) only in _make_python_spec.
🪄 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: d276fad8-1fca-4b66-ad1a-4331fa301ce5
📒 Files selected for processing (1)
misc_scripts/update_introspection_data.py
Signed-off-by: mulhern <amulhern@redhat.com>
Signed-off-by: mulhern <amulhern@redhat.com>
Signed-off-by: mulhern <amulhern@redhat.com>
7800088 to
714242f
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Related stratis-storage/stratis-docs#390