Skip to content

Conversation

spywo
Copy link

@spywo spywo commented Aug 15, 2025

Problem:
The ACT build process was failing when IDL descriptions contained common special characters like ampersand (&) and hash (#), throwing validation errors such as:
"invalid description for method CrsObject.GetName"

Root Cause:
Two regex patterns in componentdefinition.go were overly restrictive:

  1. descriptionIsValid() - for method/class/function descriptions
  2. errorDescriptionIsValid() - for error descriptions

These patterns excluded commonly used characters that are safe and appropriate for documentation text.

Solution:
Expanded both regex patterns to include additional safe characters:

  • & (ampersand) - for logical conjunctions
  • (hash/pound) - for identifiers, issue numbers, etc.

  • @ (at symbol) - for references, email-like notation
  • % (percent) - for percentages, placeholders
  • $ (dollar) - for currency, variables
    • (asterisk) - for emphasis, wildcards

spywo added 2 commits August 15, 2025 15:15
**Problem:**
The ACT build process was failing when IDL descriptions contained common
special characters like ampersand (&) and hash (#), throwing validation
errors such as:
"invalid description for method CrsObject.GetName"

**Root Cause:**
Two regex patterns in componentdefinition.go were overly restrictive:
1. `descriptionIsValid()` - for method/class/function descriptions
2. `errorDescriptionIsValid()` - for error descriptions

These patterns excluded commonly used characters that are safe and
appropriate for documentation text.

**Solution:**
Expanded both regex patterns to include additional safe characters:
- & (ampersand) - for logical conjunctions
- # (hash/pound) - for identifiers, issue numbers, etc.
- @ (at symbol) - for references, email-like notation
- % (percent) - for percentages, placeholders
- $ (dollar) - for currency, variables
- * (asterisk) - for emphasis, wildcards
@gangatp gangatp requested review from Copilot and gangatp August 25, 2025 13:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes overly restrictive regex validation patterns that were causing ACT build failures when IDL descriptions contained common special characters like ampersand (&) and hash (#). The validation was rejecting legitimate documentation text that included these safe characters.

  • Updated two regex patterns to allow additional safe characters in descriptions
  • Expanded character sets to include &, #, @, %, $, and * for both method/class descriptions and error descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +885 to 887
var IsValidMethodDescription = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_\\\\/+\\-:,.=!?()';&#@%$* |]*$").MatchString
if (description != "") {
return IsValidMethodDescription(description);
Copy link
Preview

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex is compiled every time the function is called. Consider moving the compiled regex to a package-level variable or using regexp.MustCompile once during initialization to improve performance.

Suggested change
var IsValidMethodDescription = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_\\\\/+\\-:,.=!?()';&#@%$* |]*$").MatchString
if (description != "") {
return IsValidMethodDescription(description);
if (description != "") {
return IsValidMethodDescription.MatchString(description);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants