-
Notifications
You must be signed in to change notification settings - Fork 491
fix: Library checker ensure there is no annotation for non-assessable requirements #2667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: Library checker ensure there is no annotation for non-assessable requirements #2667
Conversation
WalkthroughIntroduces a validation check in tools/convert_library_v2.py to raise a ValueError when constructing requirement nodes if a non-assessable node includes a non-empty annotation. The check occurs after node assembly and before URN registration. No other public interfaces or control flow are altered. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Converter as convert_library_v2.py
Caller->>Converter: build_requirement_node(data)
activate Converter
Converter->>Converter: assemble node
alt Non-assessable AND annotation non-empty
Converter-->>Caller: raise ValueError("non-assessable cannot have annotation")
else Valid node
Converter->>Converter: add URN to set
Converter-->>Caller: return node
end
deactivate Converter
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tools/convert_library_v2.py
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: enterprise-startup-functional-test (3.12)
- GitHub Check: startup-docker-compose-test
- GitHub Check: startup-functional-test (3.12)
- GitHub Check: enterprise-startup-docker-compose-test
- GitHub Check: build_community_frontend
- GitHub Check: build_enterprise_frontend
if node.get("assessable", False) is False and node.get("annotation", ""): | ||
raise ValueError(f"Requirement(with name={repr(node.get("name"))}) can't have a non-empty 'annotation' because it is not an assessable requirement.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax error: nested quotes in f-string.
The f-string on line 996 contains unescaped double quotes inside node.get("name")
, which will cause a syntax error.
Apply this diff to fix the syntax error:
- if node.get("assessable", False) is False and node.get("annotation", ""):
- raise ValueError(f"Requirement(with name={repr(node.get("name"))}) can't have a non-empty 'annotation' because it is not an assessable requirement.")
+ if node.get("assessable", False) is False and node.get("annotation", ""):
+ raise ValueError(f"Requirement(with name={repr(node.get('name'))}) can't have a non-empty 'annotation' because it is not an assessable requirement.")
Optional improvement: Consider enhancing the error message to include the URN for easier debugging:
raise ValueError(f"Requirement '{node.get('urn')}' (name={repr(node.get('name'))}) cannot have an annotation because it is not assessable.")
🤖 Prompt for AI Agents
In tools/convert_library_v2.py around lines 995 to 996 the f-string uses nested
double quotes causing a syntax error; replace the inner double quotes with
single quotes (or escape them) so the f-string is valid, and update the message
to be clearer by including the URN: raise a ValueError that references
node.get('urn') and node.get('name') using single quotes inside the f-string
(e.g. "Requirement '{node.get('urn')}' (name={repr(node.get('name'))}) cannot
have an annotation because it is not assessable.").
… requirements
Summary by CodeRabbit