ADFA-3871 | Improve dropdown entries parsing and metadata detection#1261
ADFA-3871 | Improve dropdown entries parsing and metadata detection#1261
Conversation
Add trailing glyph removal for spinner entries, allow empty canvas tags, and remove broad assignment regex.
|
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)
📝 WalkthroughRelease Notes - ADFA-3871: Improve dropdown entries parsing and metadata detectionFeatures & Improvements
Risks & Considerations
WalkthroughThe PR updates explicit-tag annotation assignment in MarginAnnotationParser, refactors SpinnerWidget to derive and normalize spinner entries (including storing inline lists as string arrays), and removes generic key/value inference from MetadataDetector's canvas-metadata detection. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/AndroidWidget.kt`:
- Around line 97-100: The check using rawEntries.startsWith("@") should ignore
leading whitespace so values like " `@array/options`" are treated as resource
references; in the block handling AttributeKey.ENTRIES.xmlName, first compute a
trimmedLeading = rawEntries.trimStart() (or similar) and use
trimmedLeading.startsWith("@") for the branch decision, and when storing into
processed[AttributeKey.ENTRIES.xmlName] call escapeXmlAttr() on the
trimmedLeading value so the resource reference is preserved and escaped
correctly (update the condition and the value passed to escapeXmlAttr() in the
rawEntries -> processed handling).
- Around line 126-129: The current removeTrailingDropdownGlyph extension on
String uses a regex that removes ASCII 'v' and 'V' and therefore strips valid
trailing characters (function: String.removeTrailingDropdownGlyph); update the
regex to only target actual dropdown glyphs (use their Unicode code points or
named characters) and remove 'v' and 'V' from the character class—e.g., replace
Regex("\\s*[▼▽▾▿⌄˅∨vV]$") with one that omits ASCII v/V (for example
Regex("\\s*[▼▽▾▿⌄˅∨]$") or explicitly list Unicode escapes like
"\\s*[\\u25BC\\u25BD\\u25BE...]$") so legitimate trailing 'v'/'V' in values
(e.g., "SUV") are preserved.
🪄 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: cd07db65-f17d-4adf-b7af-c001ab5ab9a3
📒 Files selected for processing (3)
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/MarginAnnotationParser.ktcv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/AndroidWidget.ktcv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/utils/MetadataDetector.kt
Description
This PR refines the parsing logic within the
cv-image-to-xmlmodule to improve accuracy:canvasTagslist is empty.assignmentRegexcheck to prevent false positives when detecting canvas metadata.Details
Logic-related updates:
toSpinnerEntries(),removeTrailingDropdownGlyph(), andisMeaningfulDropdownText()extension functions inAndroidWidget.ktto clean up text values.MarginAnnotationParser.ktto includecanvasTags.isEmpty().assignmentRegexfromMetadataDetector.kt.document_5154784628711625137.mp4
Ticket
ADFA-3871
Observation
The removal of the assignment-based metadata detection in
MetadataDetectoris intended to reduce false positives where standard text with colons or equals signs was being incorrectly flagged as canvas metadata.