feat(message-parser): PoC O(N) block splitter + benchmark baseline#39380
feat(message-parser): PoC O(N) block splitter + benchmark baseline#39380Harshit2405-2004 wants to merge 18 commits intoRocketChat:developfrom
Conversation
…litter lists and boundaries
…er (lists, quotes, syntax, tests, lint)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: e753deb The changes in this PR will be included in the next version bump. This PR includes changesets to release 42 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds BlockSplitter Layer 1: a new markdown-like block parser (exported BlockType/Block and BlockSplitter.split) to packages/message-parser, plus tests, benchmarks, and a changelog entry. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/message-parser/src/BlockSplitter.ts">
<violation number="1" location="packages/message-parser/src/BlockSplitter.ts:58">
P1: Whitespace-only lines are incorrectly treated as list continuation instead of blank line terminators due to logic order. The `isIndented` check (line 59) is evaluated before the blank line check (line 73), causing whitespace-only lines to be appended to lists rather than terminating them.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
🧹 Nitpick comments (3)
packages/message-parser/src/BlockSplitter.ts (1)
39-55: Unclosed code blocks are silently accepted.If the input contains an opening
```without a closing fence, the parser will consume all remaining lines into the code block without any indication. This may be intentional for robustness, but downstream consumers might want to know the block is incomplete.Consider tracking whether the closing fence was found if this distinction matters for error reporting or UI feedback.
💡 Optional: Track incomplete code blocks
export type Block = { type: BlockType; content: string; level?: number; language?: string; ordered?: boolean; + incomplete?: boolean; };if (line.startsWith('```')) { this.flush(blocks, currentBlock); const language = line.slice(3).trim(); const codeLines = []; + let closed = false; i++; while (i < lines.length && !lines[i].startsWith('```')) { codeLines.push(lines[i]); i++; } + if (i < lines.length) { + closed = true; + } blocks.push({ type: BlockType.CODE, content: codeLines.join('\n'), language, + incomplete: !closed, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/message-parser/src/BlockSplitter.ts` around lines 39 - 55, The code path in BlockSplitter that handles triple-backtick code fences currently treats an unclosed fence as a complete code block; modify that logic in the method handling lines (the block that starts with if (line.startsWith('```'))) to detect whether the closing fence was found: introduce a boolean (e.g., closed) initialized false, set it true if the while loop exits because a closing '```' was encountered (i < lines.length), and include an incomplete flag (or similar) on the pushed block object (e.g., incomplete: !closed) so downstream consumers can tell the block was unclosed.packages/message-parser/tests/skip-flags-regression.spec.ts (1)
11-22: Test assertion doesn't validate the non-linear growth claim.The test name states "should demonstrate non-linear growth" but the assertion only checks
times[7]is defined. This makes it a documentation/logging test rather than a regression guard. If the intent is to catch performance regressions, consider adding an assertion that validates the growth pattern (e.g.,times[7] < times[1] * 50or similar threshold).If this is intentionally a diagnostic-only test to log timing data without enforcement, the test name could be adjusted to reflect that (e.g., "should log timing data for nested formatting depths").
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/message-parser/tests/skip-flags-regression.spec.ts` around lines 11 - 22, The test "should demonstrate non-linear growth with nested formatting" currently only checks times[7] is defined, so either make it a real regression guard or rename it; to guard performance, replace the trivial assertion with a quantitative check comparing measured durations from measureDepth (e.g., assert times[7] is below a multiple of times[1] like times[7] < times[1] * 50 or some project-appropriate threshold) using the times map produced in the test, or if it's only diagnostic, rename the it() description to "should log timing data for nested formatting depths" to reflect intent.packages/message-parser/tests/blockSplitter.spec.ts (1)
3-118: Consider adding edge case tests.The test suite covers the main scenarios well. For completeness, consider adding tests for:
- Empty input (
'')- Unclosed code block (
```js\ncodewithout closing fence)- Heading without space (
#NoSpaceshould become a paragraph, not a heading per the regex)These can be addressed in a follow-up if not critical for this PoC.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/message-parser/tests/blockSplitter.spec.ts` around lines 3 - 118, Add three edge-case tests to the BlockSplitter.split suite: assert empty input ('') returns zero blocks or a single empty paragraph as your implementation expects (use BlockSplitter.split and check blocks.length and/or blocks[0].type), assert an unclosed code fence (e.g., "```js\ncode") yields a CODE block containing the raw code string (check blocks contains a BlockType.CODE with content 'code'), and assert a heading without a space (e.g., "#NoSpace") is treated as a paragraph (use BlockSplitter.split and expect a BlockType.PARAGRAPH with content '#NoSpace'); place these new tests alongside the existing ones so they exercise BlockSplitter.split and BlockType behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/message-parser/src/BlockSplitter.ts`:
- Around line 39-55: The code path in BlockSplitter that handles triple-backtick
code fences currently treats an unclosed fence as a complete code block; modify
that logic in the method handling lines (the block that starts with if
(line.startsWith('```'))) to detect whether the closing fence was found:
introduce a boolean (e.g., closed) initialized false, set it true if the while
loop exits because a closing '```' was encountered (i < lines.length), and
include an incomplete flag (or similar) on the pushed block object (e.g.,
incomplete: !closed) so downstream consumers can tell the block was unclosed.
In `@packages/message-parser/tests/blockSplitter.spec.ts`:
- Around line 3-118: Add three edge-case tests to the BlockSplitter.split suite:
assert empty input ('') returns zero blocks or a single empty paragraph as your
implementation expects (use BlockSplitter.split and check blocks.length and/or
blocks[0].type), assert an unclosed code fence (e.g., "```js\ncode") yields a
CODE block containing the raw code string (check blocks contains a
BlockType.CODE with content 'code'), and assert a heading without a space (e.g.,
"#NoSpace") is treated as a paragraph (use BlockSplitter.split and expect a
BlockType.PARAGRAPH with content '#NoSpace'); place these new tests alongside
the existing ones so they exercise BlockSplitter.split and BlockType behavior.
In `@packages/message-parser/tests/skip-flags-regression.spec.ts`:
- Around line 11-22: The test "should demonstrate non-linear growth with nested
formatting" currently only checks times[7] is defined, so either make it a real
regression guard or rename it; to guard performance, replace the trivial
assertion with a quantitative check comparing measured durations from
measureDepth (e.g., assert times[7] is below a multiple of times[1] like
times[7] < times[1] * 50 or some project-appropriate threshold) using the times
map produced in the test, or if it's only diagnostic, rename the it()
description to "should log timing data for nested formatting depths" to reflect
intent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fed4bd90-6d29-41b4-9cad-2b585dfae2a2
📒 Files selected for processing (5)
.changeset/block-splitter-layer1.mdpackages/message-parser/benchmarks/parser.bench.tspackages/message-parser/src/BlockSplitter.tspackages/message-parser/tests/blockSplitter.spec.tspackages/message-parser/tests/skip-flags-regression.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/message-parser/src/BlockSplitter.tspackages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.tspackages/message-parser/benchmarks/parser.bench.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
🧠 Learnings (12)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/message-parser/src/BlockSplitter.tspackages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.tspackages/message-parser/benchmarks/parser.bench.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/message-parser/src/BlockSplitter.tspackages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.tspackages/message-parser/benchmarks/parser.bench.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.tspackages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
packages/message-parser/tests/blockSplitter.spec.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
Applied to files:
packages/message-parser/benchmarks/parser.bench.ts
🔇 Additional comments (11)
packages/message-parser/tests/skip-flags-regression.spec.ts (1)
24-31: LGTM!The pathological input test correctly guards against exponential parsing behavior with a concrete 1-second timeout assertion. This aligns with the skip-flag mechanism in the grammar that prevents unbounded backtracking on unmatched markers.
packages/message-parser/src/BlockSplitter.ts (3)
1-15: LGTM!Clean type definitions. The
Blocktype with optional properties (level,language,ordered) appropriately captures the varying metadata needs of different block types.
57-81: LGTM!The list handling correctly:
- Detects ordered vs unordered markers
- Sets
orderedtoundefinedwhen mixed types are encountered- Continues list blocks for indented content
The approach of preserving the raw syntax in
contentallows downstream parsers to handle nested structures.
96-114: LGTM!The paragraph accumulation and blank-line flushing logic is straightforward and handles the block boundary detection correctly.
.changeset/block-splitter-layer1.md (1)
1-5: LGTM!Changeset is correctly formatted and appropriately scoped as a patch for a new PoC feature.
packages/message-parser/benchmarks/parser.bench.ts (3)
64-65: LGTM!Good additions for emphasis benchmarking. The "deeply nested" case complements the existing "deep nesting" fixture with a different nesting pattern.
148-151: LGTM!This pathological fixture aligns with the skip-flags regression test and provides benchmark data for the worst-case parsing scenario. Useful for tracking parser performance improvements.
169-173: LGTM!Good representative real-world fixture that exercises multiple parser features (mentions, emphasis, code, channels, emoji) in a realistic message structure.
packages/message-parser/tests/blockSplitter.spec.ts (3)
1-10: LGTM!Good foundational test for paragraph aggregation. The test correctly validates that consecutive non-empty lines form a single paragraph block.
22-29: LGTM!Test correctly validates code block parsing including language extraction and content isolation.
77-99: LGTM!Good coverage of the
orderedflag behavior across mixed, fully-ordered, and fully-unordered list scenarios. The tests align with the implementation's logic of settingorderedtoundefinedwhen mixed markers are encountered.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/message-parser/tests/skip-flags-regression.spec.ts`:
- Around line 24-31: The test 'should handle pathological unmatched markers
without crashing' currently asserts a hard 1s wall-clock bound using
performance.now() and expect(duration). Remove the flaky timing assertion: call
parse(pathological) and assert it does not throw and produces an expected result
(e.g., output is defined/non-null or has expected node count) instead of
measuring duration; update the test to use parse(pathological) and an assertion
like expect(result).toBeDefined() or
expect(result.length).toBeGreaterThanOrEqual(0) while keeping the original
pathological input variable and test name.
- Around line 11-22: The test currently only checks expect(times[7]) is defined
which doesn't verify the regression; update the assertion to compare times[7]
against an expected linear-growth bound derived from earlier depths (use the
measured times object and measureDepth) — e.g. compute an expectedLinear =
times[1] * 7 (or use a linear fit from times[1..3]) and assert
expect(times[7]).toBeLessThanOrEqual(expectedLinear * ALLOWED_FACTOR) (or assert
the ratio times[7]/times[1] is below a threshold) so the test fails when depth 7
shows super-linear blowup; keep the console.table and ensure you reference the
existing variables measureDepth, times and the current expect(times[7]) check
when making this change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 98bff1ff-9e6c-4d16-8c76-def866953569
📒 Files selected for processing (3)
packages/message-parser/src/BlockSplitter.tspackages/message-parser/tests/blockSplitter.spec.tspackages/message-parser/tests/skip-flags-regression.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/message-parser/tests/blockSplitter.spec.ts
- packages/message-parser/src/BlockSplitter.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/message-parser/tests/skip-flags-regression.spec.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
packages/message-parser/tests/skip-flags-regression.spec.ts
🧠 Learnings (13)
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/message-parser/tests/skip-flags-regression.spec.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@cardoso — sharing early benchmark results for the parser rewrite PoC. Important caveat first: BlockSplitter is Layer 1 only (block boundary What the numbers show: Layer 1 (BlockSplitter) vs Peggy full parse: The key insight: because Layer 1 runs at ~2M ops/sec, it will never be The adversarial case is significant: the current Peggy parser degrades Will share full pipeline benchmarks (Layers 1+2+3 combined) once the |
Consolidated PR capturing benchmark baselines, skip-flag regression proofs, and Layer 1 BlockSplitter PoC.
The Goal
A complete O(N) handwritten TypeScript parser replacing Peggy, using existing unit tests as the contract and favoring readability/maintainability.
Why
The 7 skip flags in grammar.peggy make parse results context-dependent on global mutable state. Peggy's memoization key is only (position, rule) it doesn't include flag state so memoization is effectively disabled for every rule that reads a skip flag. This breaks the O(N) packrat guarantee and degrades to O(2^N) on adversarial input.
This PR provides the performance baseline and structural foundation (BlockSplitter Layer 1) to eliminate global flags entirely.
Summary by CodeRabbit
New Features
Tests
Documentation