Addressing PR comments — TypeScript SDK refactor + Chevrotain-based parser#574
Addressing PR comments — TypeScript SDK refactor + Chevrotain-based parser#574
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #574 +/- ##
============================================
+ Coverage 5.40% 16.39% +10.99%
============================================
Files 56 72 +16
Lines 2463 2807 +344
Branches 327 369 +42
============================================
+ Hits 133 460 +327
- Misses 2319 2332 +13
- Partials 11 15 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
remove all the python implementation. Only keep the typescript part |
Done in commit |
Applied in commit |
|
all typescript classes that inherit from FilterBuilder should not have |
Done in commit
|
|
Done in commit
All file names now match their class name in camelCase. All imports, barrel exports, and test files updated. 53/53 tests pass. |
|
@claude[agent] |
Fixed all identified SonarCloud quality gate issues in commit Critical/High Severity:
Medium Severity:
All tests pass (53/53), linter clean, build successful. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…dd project conventions documentation
expand assertions and variables to facilitate reading them
… ESLint overrides
update documentation and examples for clarity on filter criteria combination
… escaped characters - enhanced the parsing logic to correctly handle escaped characters in filter expressions. - updated the `normalizeExpression` function to utilize a new `splitByUnescapedSeparator` method for better separation of expressions. - improved the `parseValueExpression` function to handle leading and trailing wildcards more effectively. - refactored range parsing to ensure proper handling of different range formats. - added comprehensive unit tests to cover new functionality and edge cases, including escaped symbols and various logical combinations.
…nd improve logic handling
f09610b to
a26b222
Compare
|
Instead of building a typescript parser from scratch, use chevrotain to build a parser that would mimic the c# parser behavior. At the end, parsing with typescript should give the same developer experience. import { parse } from parsers // <-- here the developer only import the parse method
const input = `name=*bat*,*man
const filter = parse(input) // <--- calling the parse with default optionsThe usage must remain the same from the caller's perspective. The existing test should stand, especially those in parser.test.ts file which don't care about implementation details |
Agent-Logs-Url: https://github.com/candoumbe/DataFilters/sessions/1f0ef57d-c61d-4d8c-b034-50a421596596 Co-authored-by: candoumbe <13941078+candoumbe@users.noreply.github.com>
Agent-Logs-Url: https://github.com/candoumbe/DataFilters/sessions/1f0ef57d-c61d-4d8c-b034-50a421596596 Co-authored-by: candoumbe <13941078+candoumbe@users.noreply.github.com>
Done in commit What changed in
Jest config: All 77 existing tests pass (41 parser + 36 filter-class tests). |
There was a problem hiding this comment.
Add missing ARRANGE, ACT, ASSERT comments so tests are easier to read
There was a problem hiding this comment.
Added in commit d739891. Every test in builder.test.ts now has // Arrange, // Act, and // Assert sections. The "should throw when no conditions added" test uses // Act & Assert since the assertion and the act are inseparable in a expect(() => ...).toThrow() pattern.
…ilder tests Agent-Logs-Url: https://github.com/candoumbe/DataFilters/sessions/7433b24c-48ff-4666-99d9-6685981aa6ca Co-authored-by: candoumbe <13941078+candoumbe@users.noreply.github.com>
|

Addresses all PR review feedback on the TypeScript SDK and replaces the hand-written parser with a Chevrotain-based implementation that mirrors the C#
FilterTokenParserbehaviour.Changes Made
TypeScript SDK structure
src/python/, both Python workflows,.devcontainer/python/config, and all related.gitignore/README.mdentries)equalsFilter.ts,iFilter.ts)Expressionsuffix from allIFilter-implementing classes (EqualsFilter,ContainsFilter,StartsWithFilter, etc.)public/privateaccess modifiers throughoutChevrotain parser (
src/typescript/src/parser.ts)ChevrotainEmbeddedActionsParserEscaped,Text,TO(withlonger_altso "TORONTO" is a single token),Comma,Pipe,Bang,Asterisk,LeftSquare,RightSquare,Equals,WhitespacefilterInput,fieldOrValuePart,fieldAssignment,inheritedValuePart,valueExpression,pipeExpression,negatedExpr,primaryExpr,rangeExpression,valueTextChunks,rangeValueChunks,fieldNameRule&-separated multi-field expressions (backslash-escaped\&is treated as a literal ampersand, not a separator)import { parse } from "parsers"andparse(input, options?)work identically from the caller's perspectiveJest / build config
chevrotain@^12as a runtime dependency andesbuildas a dev dependencyjest.global-setup.cjs: uses esbuild to pre-bundle Chevrotain (pure ESM) to CommonJS before tests run, keeping the existingts-jestCJS setup intactsrc/typescript/.jest-cache/to.gitignoreTesting
Original prompt
Objective
Create a monorepo structure to support Python and TypeScript SDKs alongside the existing C# DataFilters library, with completely separate CI/CD pipelines to avoid interfering with the existing C# build process.
Requirements
integration.ymlanddelivery.ymlworkflows (they are auto-generated by Nuke)src/python/andsrc/typescript/directoriesdevelop(default),main, andrelease/*branchesChanges to implement
1. New Directory Structure
2. New Workflows (in
.github/workflows/)python-integration.ymlpython-delivery.ymlPYPI_API_TOKENtypescript-integration.ymltypescript-delivery.ymlNPM_TOKEN3. Configuration Files
src/python/pyproject.tomlsrc/python/setup.pysrc/python/requirements-dev.txtsrc/typescript/package.jsonsrc/typescript/tsconfig.jsonsrc/typescript/jest.config.js4. Updated Files
.gitignore__pycache__/,*.egg-info/,.pytest_cache/,.coverage,dist/,build/node_modules/,dist/,coverage/,.eslintcacheREADME.mdTechnical Details
Workflow Path Triggers
Each workflow uses
paths:filter to only run when relevant files change:src/python/**,.github/workflows/python-*.ymlsrc/typescript/**,.github/workflows/typescript-*.ymlCI/CD Behavior
Compatibility
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Quelle serait la meilleure façon de fournir des librairies python, typescript pour générer des filtres compatible avec datafilters ?
Assistant: Je vais explorer le dépôt pour mieux comprendre sa structure et vous donner une recommandation optimale.
Assistant: Maintenant, laissez-moi explorer la structure du projet pour mieux comprendre comment fonctionnent les filtres :
Assistant: Maintenant je comprends bien votre projet. DataFilters est une bibliothèque en C# qui permet de filtrer des données avec une syntaxe semblable à Elasticsearch. Pour fournir des librairies Python et TypeScript compatibles, voici les meilleures approches :
🏗️ Architecture recommandée
1. Option A : Mono-dépôt avec code partagé
Créer un dépôt central contenant :
This pull request was created from Copilot chat.