Repository navigation
feat(web_core): export isSafeRegex from the v1.0 entry point - #3572
josemontespg wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
bb25d9d to
dc74b97
Compare
dc74b97 to
3fb9dcf
Compare
1a591f2 to
7d49003
Compare
3fb9dcf to
412b291
Compare
7d49003 to
7ba06ac
Compare
412b291 to
d13c825
Compare
7ba06ac to
0161e90
Compare
d13c825 to
bd27240
Compare
0161e90 to
9f1a22e
Compare
bd27240 to
0351c16
Compare
9f1a22e to
af1cbfc
Compare
0351c16 to
9bbdf55
Compare
af1cbfc to
c716e89
Compare
9bbdf55 to
702818c
Compare
c716e89 to
837d5f9
Compare
702818c to
eaf1eae
Compare
837d5f9 to
e993246
Compare
20f4aed to
d3d9eda
Compare
aefc843 to
9324d8f
Compare
4bf3683 to
7275d38
Compare
a8d8a95 to
a5661f8
Compare
a5661f8 to
f64494f
Compare
ditman
left a comment
There was a problem hiding this comment.
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)
f64494f to
c7b2b3d
Compare
josemontespg
left a comment
There was a problem hiding this comment.
Thanks for the review! Applied the suggested changes. PTAL when you can.
46c8cb8 to
f6e58af
Compare
f6e58af to
f84ee6d
Compare
f84ee6d to
8149292
Compare
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.
|
Agreed. |
|
Thanks for simplifying this way from web_core! |
Summary
Re-exports
isSafeRegexandSafeRegexOptionsfrom@a2ui/web_core/v1_0. The function already backs the basic catalog'sregexvalidation 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 fromv0_9/basic_catalog/functions/, with its test): the check is version-agnostic, so it lives next tocommon/basic_functions.tsand 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: exportisSafeRegexandtype SafeRegexOptions.typescript/core/web_core/CHANGELOG.md: Unreleased entry.Verification
yarn workspace @a2ui/web_core run buildandrun lintpass locally.