Skip to content

feat(web_core): export isSafeRegex from the v1.0 entry point - #3572

Closed
josemontespg wants to merge 1 commit into
mainfrom
web-core-export-safe-regex
Closed

josemontespg wants to merge 1 commit into
mainfrom
web-core-export-safe-regex

Conversation

@josemontespg

@josemontespg josemontespg commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Re-exports isSafeRegex and SafeRegexOptions from @a2ui/web_core/v1_0. The function already backs the basic catalog's regex validation and is exported from /v0_9. The v1.0 MCP catalog needs it to accept regular expressions from agents without pulling in the v0.9 entry point or a second ReDoS checker.

Changes

  • typescript/core/web_core/src/common/safe_regex.ts (moved from v0_9/basic_catalog/functions/, with its test): the check is version-agnostic, so it lives next to common/basic_functions.ts and the root, v0.8, v0.9 and v1.0 entry points all re-export it from there instead of reaching into the v0.9 tree.
  • typescript/core/web_core/src/v1_0/index.ts: export isSafeRegex and type SafeRegexOptions.
  • typescript/core/web_core/CHANGELOG.md: Unreleased entry.

Verification

  • yarn workspace @a2ui/web_core run build and run lint pass locally.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request exports isSafeRegex and SafeRegexOptions from the v0_9 directory in v1_0/index.ts. Feedback suggests moving safe_regex.ts to a shared location (such as src/validation/ or src/common/) to avoid introducing a backward dependency on an older version's internal structure, which could cause issues if v0_9 is deprecated or removed in the future.

@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from bb25d9d to dc74b97 Compare October 23, 2026 22:16
@josemontespg
josemontespg added this pull request to stack #3585 October 23, 2026 23:38
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from dc74b97 to 3fb9dcf Compare October 23, 2026 23:43
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch 2 times, most recently from 1a591f2 to 7d49003 Compare October 24, 2026 00:05
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from 3fb9dcf to 412b291 Compare October 24, 2026 00:05
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from 7d49003 to 7ba06ac Compare October 24, 2026 01:10
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from 412b291 to d13c825 Compare October 24, 2026 01:10
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from 7ba06ac to 0161e90 Compare October 24, 2026 01:23
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from d13c825 to bd27240 Compare October 24, 2026 01:23
@josemontespg
josemontespg removed this pull request from stack #3585 October 24, 2026 01:26
@josemontespg
josemontespg added this pull request to stack #3594 October 24, 2026 01:26
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from 0161e90 to 9f1a22e Compare October 24, 2026 01:29
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from bd27240 to 0351c16 Compare October 24, 2026 01:29
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from 9f1a22e to af1cbfc Compare October 24, 2026 01:44
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from 0351c16 to 9bbdf55 Compare October 24, 2026 01:44
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from af1cbfc to c716e89 Compare October 26, 2026 09:07
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from 9bbdf55 to 702818c Compare October 26, 2026 09:07
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from c716e89 to 837d5f9 Compare October 26, 2026 09:48
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from 702818c to eaf1eae Compare October 26, 2026 09:48
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from 837d5f9 to e993246 Compare October 26, 2026 17:04
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch 2 times, most recently from 20f4aed to d3d9eda Compare October 26, 2026 17:28
@josemontespg
josemontespg force-pushed the catalogs-example-kanban branch from aefc843 to 9324d8f Compare October 26, 2026 17:31
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch 2 times, most recently from 4bf3683 to 7275d38 Compare October 26, 2026 18:18
@josemontespg
josemontespg removed this pull request from stack #3594 October 26, 2026 18:19
Base automatically changed from catalogs-example-kanban to main October 26, 2026 20:31
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from a8d8a95 to a5661f8 Compare October 26, 2026 20:31
@josemontespg
josemontespg removed this pull request from stack #3629 October 26, 2026 20:34
@josemontespg
josemontespg added this pull request to stack #3640 October 26, 2026 20:34
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from a5661f8 to f64494f Compare October 26, 2026 20:36
@josemontespg
josemontespg removed this pull request from stack #3640 October 26, 2026 21:37
@josemontespg
josemontespg added this pull request to stack #3643 October 26, 2026 21:38
@josemontespg
josemontespg removed this pull request from stack #3643 October 26, 2026 22:01
@josemontespg
josemontespg added this pull request to stack #3645 October 26, 2026 22:04
@josemontespg
josemontespg removed this pull request from stack #3645 October 26, 2026 23:14
@josemontespg
josemontespg added this pull request to stack #3647 October 26, 2026 23:17

@ditman ditman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The move itself is pretty mechanical, and I'm fine with it!

HOWEVER, this introduces a very specific dependency with "redos-detector" into the root of the web_core package.

I think this was OK when it was part of the catalog implementation, because we've been looser with taking dependencies there (the catalog is an optional package for end users).

IMO we should not export this from the root of the package, and keep it under "catalog".

If we want to export this from the root of web_core, IMO we should instead expose an interface for the implementation of the isSafeRegex function (similar to how we render markdown) that end users may optionally inject using the same mechanism as what we do in markdown. Then, we can provide a "redos-detector" package implementation that users can use conveniently.

But mandating a dependency on a specific package looks a little bit too opinionated (when there's alternatives)

@josemontespg
josemontespg removed this pull request from stack #3647 October 27, 2026 00:30
@josemontespg
josemontespg added this pull request to stack #3649 October 27, 2026 00:32
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from f64494f to c7b2b3d Compare October 27, 2026 17:42

@josemontespg josemontespg left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the review! Applied the suggested changes. PTAL when you can.

@josemontespg
josemontespg requested a review from ditman October 27, 2026 17:59
@josemontespg
josemontespg removed this pull request from stack #3649 October 27, 2026 18:27
@josemontespg
josemontespg added this pull request to stack #3661 October 27, 2026 18:29
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch 2 times, most recently from 46c8cb8 to f6e58af Compare October 28, 2026 22:23
@josemontespg
josemontespg removed this pull request from stack #3661 October 28, 2026 22:24
@josemontespg
josemontespg changed the base branch from main to web-core-settle-async-args October 28, 2026 22:24
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from f6e58af to f84ee6d Compare October 28, 2026 22:24
Base automatically changed from web-core-settle-async-args to main October 28, 2026 22:33
@josemontespg
josemontespg force-pushed the web-core-export-safe-regex branch from f84ee6d to 8149292 Compare October 28, 2026 22:45
@josemontespg
josemontespg added this pull request to stack #3730 October 28, 2026 22:46
Catalog packages built on A2UI v1.0 can now validate agent-supplied regular expressions against catastrophic backtracking with the same check the basic catalog uses, without importing from @a2ui/web_core/v0_9.
@josemontespg

Copy link
Copy Markdown
Collaborator Author

Agreed. @a2ui/catalog-mcp now carries its own copy of the ReDoS check (src/functions/safe_regex.ts, backed by redos-detector) in #3574, so web_core keeps its current API and this PR is not needed. Closing.

@ditman

ditman commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for simplifying this way from web_core!

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