Skip to content

Restore Market Filter with Custom Expression Parser#403

Open
GODrums wants to merge 7 commits into
masterfrom
feat/expression-ast-parser
Open

Restore Market Filter with Custom Expression Parser#403
GODrums wants to merge 7 commits into
masterfrom
feat/expression-ast-parser

Conversation

@GODrums

@GODrums GODrums commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #400

Step 3 of #395

Adds a compatibility layer to support our filter container in the Steam Market Beta.

Due to React's self CSP, it also replaces filtrex with a custom expression parser supporting the same input syntax. Architected with Opus 4.8, reviewed by Fable 5. Tested all variables and operators manually

Screenshots

!https://github.com/user-attachments/assets/1d296ca3-3ec6-4eed-88c5-7ec2f2d5bdef


Note

Medium Risk
Replaces the entire filter expression engine and broadens valid return types, so subtle syntax or truthiness mismatches vs filtrex could affect highlights across classic and beta market pages.

Overview
Brings CSFloat highlight filters back on the Steam Market beta by mounting the existing filter UI above the React listing grid and wiring beta listing cards to the same gFilterService highlighting used on the classic market.

filtrex is removed and replaced with an in-tree compile_expression tokenizer/parser/evaluator so filter syntax still works under React’s stricter CSP. Filter now compiles through that module; isValidReturnValue treats any non-Error result as valid instead of only booleans and 0/1.

Beta BetaListingEnhancer derives price from listing fiber props, subscribes to filter updates, and paints each card’s background/text when a filter matches.

Reviewed by Cursor Bugbot for commit 47b0317. Configure here.

@GODrums GODrums self-assigned this Jun 13, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 47b0317. Configure here.

Comment thread src/lib/components/market/react/listing.ts Outdated
Comment thread src/lib/components/market/react/filter_panel.ts
@GODrums GODrums requested a review from Step7750 July 5, 2026 17:11
Base automatically changed from feat/market-pattern-enhancements to master July 6, 2026 14:38

@Step7750 Step7750 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.

Great stuff, the expression parser is quite clean and ReactListingHighlight is cleaner than I thought it'd be under the React framework.

@@ -0,0 +1,665 @@
import type {InternalInputVars} from './types';

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.

Unsure if we have the right infra for testing in the extension, but this would certainly be a spot to use it!

Not a hard blocker, but if it's a few prompts away then I'd say it's worth it.

const context = this.injectionContext;
if (!card || !context) return;

const colour = gFilterService.matchColour(context.itemInfo, this.convertedPrice) || '';

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.

nit: If we don't have a color to apply, we should skip applying a style below. Otherwise, there is risk that we reset a bg color that Valve applies in the future.

throw new Error(`unexpected token "${token.value}" at ${token.position}`);
}

/** Parses the `(...)` operand of `in` / `not in` into a list node. Allows an empty list `()`. */

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.

nit: empty list shouldn't be valid syntax IMO. Is there a use case where var in () could be true?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore filtering / highlighting logic by reworking our filter with our own AST parser (circumvent React's CSP default-src 'self')

2 participants