Skip to content

DEMRUM-2304: remove force try for regex compilation #313

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

Conversation

carlosmcevilly
Copy link

DEMRUM-2304: remove force try for regex compilation

Previously this work did not have a ticket, so it has been re-pushed with amended commit messages to now include the ticket number.

Main change is to remove try! usage in regex compilation code in addLinkToSpan(::)

  • restructure to guard let regex =
  • introduce log statements for failures: one serious (.fault), one not (.debug)
  • add intentional breaking hard failure if regex does not compile. This must be caught early. The objection is we have a hard coded regex; how could it go wrong? And the answer is, of course, editing.
  • update the regex to remove the backslashes for double quotes -- although the quotes are nested, this is fine in swift ## regular expression syntax. If I am wrong we will have a preconditionFailure very soon.
  • add truncation to the logged string for the .debug log because we get that string from an external source
  • add another guard when extracting the traceId and spanId
  • move the regex into the function as it's only used in that scope
  • re-enable the lint check for SplunkNetwork in both included app projects
  • fix a docs link issue to pass pre-merge checks

Copy link
Contributor

@SMickelsn SMickelsn left a comment

Choose a reason for hiding this comment

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

Looks good.

@carlosmcevilly carlosmcevilly merged commit 5f530e8 into feature/next-gen Jun 3, 2025
2 checks passed
@carlosmcevilly carlosmcevilly deleted the cmcevilly/DEMRUM-2304-remove-force-try-for-regex-compilation branch June 3, 2025 16:55
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants