feat: support parent field in work items
[MR implemented by Duo]
Relates to issue #74 (closed)
Changes
This MR implements complete parent field support for work items in Rust, backporting functionality from the TypeScript implementation in MR !276 (merged).
Key Changes
Type System
- Added
Parentfield variant to the Field enum - Added
WorkItemRefreference type with "#" symbol for issue references - Implemented string mappings and display implementations
Parser System
- Created generic
work_item()parser function supporting both epic (&) and issue (#) references - Refactored
epic()parser to use the generic function - Added new
issue()parser for work item references - Integrated issue parser into the value parsing chain
- Added comprehensive parser tests
Utility Functions
- Implemented
parse_work_item_reference()function to parse both epic and work item references - Added comprehensive tests covering epic references, issue references, edge cases, and fallback scenarios
Analyzer Integration
- Added Parent field validation to the Issues source analyzer
- Integrated Parent field type checking using the field mapping system
Field Mapping
- Added
parent_work_items_attribute()function for parent field attribute mapping - Created Parent field mapping configuration supporting both WorkItemRef and EpicRef
- Enhanced
transform_epic_subquery_with_variable_type()to handle both Epic and Parent fields - Implemented logic to generate appropriate subqueries based on reference type (epic vs work item)
GraphQL Filter Generation
- Added Parent field value transformation in
to_graphql_filter_value() - Added Parent field key mapping in
to_graphql_filter_key() - Updated GraphQLFilters constraints to include Parent field for descendant work items
Testing
- Added tests for parent field with epic references
- Added tests for parent field with issue/work item references
- Added tests for parent field in lists (both epic and issue references)
- Added test for parent field without work items feature flag
- Added parser tests for issue references
- Added utility function tests for work item reference parsing
Features
- Generic Parent field works for all work items (tasks, key results, issues)
- Dual reference support for both epic references (&) and work item references (#)
- Smart path resolution automatically derives group/project paths from references
- Feature flag integration (only available when GlqlWorkItems feature flag is enabled)
- Comprehensive subquery generation creates appropriate GraphQL subqueries based on reference type
- Full test coverage for all major use cases and edge cases
Edited by Daniele Rossetti