Repository navigation
refactor(mcp): use the shared pattern predicate for drill-downs - #3663
alex-fedotyev wants to merge 3 commits into
Conversation
clickstack_event_patterns now imports templateToRegex, buildPatternPredicate and MAX_PREDICATE_TEMPLATE_LENGTH from @hyperdx/common-utils/dist/drain, and its own copy is deleted. MCP mines without extra delimiters, so the whereSnippet it returns is unchanged. The existing patternDrilldown tests import from common-utils and pass as they are. Part of FR-385. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: eda26c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| @@ -1,11 +1,11 @@ | |||
| import { minePatterns } from '@hyperdx/common-utils/dist/drain'; | |||
|
|
|||
| import { | |||
There was a problem hiding this comment.
🔵 minor — Tests for the common-utils predicate now sit in the api package, so common-utils' own suite doesn't cover them
Move the templateToRegex and buildPatternPredicate cases into packages/common-utils/src/__tests__/pattern-predicate.test.ts and keep only the andSql tests here. Today that file only tests extra delimiters and parsePatternPredicate. These cases cover escaping, quotes and backslashes, Unicode whitespace, empty templates and MAX_PREDICATE_TEMPLATE_LENGTH. Because they import the built @hyperdx/common-utils/dist/drain, changing pattern-predicate.ts and running the common-utils tests can't catch a regression in any of them. They also only run against whatever dist was last built.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Keeping these here: they pin the exact whereSnippet this tool returns, and the common-utils suite now also covers the length limit and the no-option round trip (04c8a76).
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a behavior-preserving refactor. The MCP Reviewers (7): correctness, testing, maintainability, project-standards, kieran-typescript, agent-native, learnings-researcher. Notes (non-blocking, no action required):
|
…mcp-shared-pattern-predicate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mcp-shared-pattern-predicate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Switches
clickstack_event_patternsto the shared pattern predicate from #3662 and deletes the MCP copy oftemplateToRegex,buildPatternPredicateandMAX_PREDICATE_TEMPLATE_LENGTH. Part of FR-385.Stack
Part 2 of 4. Each PR is based on the one before it, so its diff shows only its own step. Review in order:
Please merge in order: once a PR merges, the next one is retargeted to
main. CI and the tier label only run on PRs whose base ismain, so PRs 2 to 4 get them at that point. Until then the test plan lists what I ran locally.Summary
Pure refactor. MCP mines without extra delimiters, so the
whereSnippetit returns for each pattern is unchanged.PATTERN_MATCH_SEMANTICS,andSqlanduserWhereAsSqlstay inpatternDrilldown.ts, since only MCP uses them.Test plan
patternDrilldown.test.tstests import from common-utils and pass as they arejest src/mcpinpackages/api(29 suites, 578 tests),tsc --noEmit, eslint on the changed files, knip