feat: add --descendant and --ancestor flags to verdi node list#7300
Open
Khushi281300 wants to merge 1 commit intoaiidateam:mainfrom
Open
feat: add --descendant and --ancestor flags to verdi node list#7300Khushi281300 wants to merge 1 commit intoaiidateam:mainfrom
Khushi281300 wants to merge 1 commit intoaiidateam:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Overview
This PR introduces the
--descendantand--ancestorflags toverdi node list, addressing issue #6782. These options allow users to explore the provenance graph directly from the CLI by filtering nodes based on their relationships.What’s Included
New CLI Options
Added
DESCENDANTandANCESTORoptions insrc/aiida/cmdline/params/options/main.pyusingNodeParamType.Enhanced Query Logic
Refactored the
node_listcommand insrc/aiida/cmdline/commands/cmd_node.pyto use a customQueryBuilder.This enables:
with_ancestorswith_descendantswith explicit tagging (
tag='node') to ensure correct filtering.Backward Compatibility
All existing features (sorting, projections, limits, and entry-point filters) remain unchanged.
Testing & Verification
1. Unit Tests
Added
tests/cmdline/commands/test_node_list_relationship.pywith test cases for:Result:
3 passed2. Manual Verification
Tested on a local SQLite profile using a simple provenance chain:
verdi node list --ancestor 3→ returns node 4verdi node list --descendant 4→ returns node 33. Regression Check
Executed
tests/cmdline/commands/test_node.pyto ensure no regressions.graphvizand prompt formatting), which are unrelated to this PR.