Skip to content

Conversation

icodebyamanda
Copy link
Contributor

@icodebyamanda icodebyamanda commented Oct 6, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/72649045549333/task/1211479926220518?focus=true

Description: imperfect PR for review for the above project

Feature change process:

  • I have added a schema to validate this feature change.
  • I have tested this change locally in all supported browsers.
  • This code for the config change is ready to merge.
  • This feature was covered by a tech design.

Note

Introduces ElementHiding TS schema and a hybrid AJV validator with targeted rule/domain checks, updates tests to use it, and adjusts an abcnews.go.com rule in features/element-hiding.json.

  • Schema/Types:
    • Add schema/features/element-hiding.ts defining ElementHidingFeature types (rules, domains, settings).
    • Wire elementHiding?: ElementHidingFeature into ConfigV5 via schema/config.ts.
  • Validation:
    • Implement hybrid validator in tests/schema-validation.js with optimized checks for elementHiding.settings.rules and domains.
  • Tests:
    • Switch validation in tests/config-tests.js to createHybridValidator for full and patch validations.
  • Data tweak:
    • Modify features/element-hiding.json abcnews.go.com rule to type: "modify-style" (values removed).

Written by Cursor Bugbot for commit ce7de62. This will update automatically on new commits. Configure here.

euw-arasolofotsara1 added 2 commits October 6, 2025 20:22
- Add TypeScript schema for element hiding feature with all 7 rule types
- Support hide-empty, hide, closest-empty, override, modify-style, modify-attr, disable-default
- Integrate with config.ts for schema validation
- Tests pass with existing configuration
- Test invalid rule types (caught by schema ✅)
- Test missing required properties in union types (not caught ❌)
- Test invalid domain types (not caught ❌)
- Test invalid values structure (not caught ❌)

Note: Complex discriminated union validation has limitations with ts-json-schema-generator.
Basic rule type validation works correctly.
@github-actions github-actions bot requested a review from laghee October 6, 2025 18:24
github-actions bot pushed a commit that referenced this pull request Oct 6, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

github-actions bot commented Oct 6, 2025

👋 Don't forget to add an individual reviewer (in addition to those auto-added), as this will create a task for them in Asana.

👉 Please mark this as DRAFT unless there's an intention to merge this immediately.
👉 Click "Merge when ready" if you're happy for this to be automatically merged once reviewed. (If not available, ensure you've signed in to DuckDuckGo oauth.)
👉 Don't forget to add schema changes to validate if you're adding/changing a feature.

Copy link

github-actions bot commented Oct 6, 2025

Generated file outputs:

Time updated: Thu, 09 Oct 2025 19:10:14 GMT

legacy
trackers-unprotected-temporary.txt

⚠️ File is identical

28 files changed
  • v3/android-config.json
  • v3/extension-brave-config.json
  • v3/extension-bravemv3-config.json
  • v3/extension-chrome-config.json
  • v3/extension-chromemv3-config.json
  • v3/extension-config.json
  • v3/extension-edg-config.json
  • v3/extension-edge-config.json
  • v3/extension-edgmv3-config.json
  • v3/extension-firefox-config.json
  • v3/extension-safarimv3-config.json
  • v3/ios-config.json
  • v3/macos-config.json
  • v3/windows-config.json
  • v4/android-config.json
  • v4/extension-brave-config.json
  • v4/extension-bravemv3-config.json
  • v4/extension-chrome-config.json
  • v4/extension-chromemv3-config.json
  • v4/extension-config.json
  • v4/extension-edg-config.json
  • v4/extension-edge-config.json
  • v4/extension-edgmv3-config.json
  • v4/extension-firefox-config.json
  • v4/extension-safarimv3-config.json
  • v4/ios-config.json
  • v4/macos-config.json
  • v4/windows-config.json
--- v4/windows-config.json (and 27 other files)
+++ v4/windows-config.json
@@ -78366,15 +78366,9 @@
                         "domain": "abcnews.go.com",
                         "rules": [
                             {
                                 "selector": ".navigation",
-                                "type": "modify-style",
-                                "values": [
-                                    {
-                                        "property": "top",
-                                        "value": "0px"
-                                    }
-                                ]
+                                "type": "modify-style"
                             }
                         ]
                     },
                     {
latest
14 files changed
  • v5/android-config.json
  • v5/extension-brave-config.json
  • v5/extension-bravemv3-config.json
  • v5/extension-chrome-config.json
  • v5/extension-chromemv3-config.json
  • v5/extension-config.json
  • v5/extension-edg-config.json
  • v5/extension-edge-config.json
  • v5/extension-edgmv3-config.json
  • v5/extension-firefox-config.json
  • v5/extension-safarimv3-config.json
  • v5/ios-config.json
  • v5/macos-config.json
  • v5/windows-config.json
--- v5/windows-config.json (and 13 other files)
+++ v5/windows-config.json
@@ -78366,15 +78366,9 @@
                         "domain": "abcnews.go.com",
                         "rules": [
                             {
                                 "selector": ".navigation",
-                                "type": "modify-style",
-                                "values": [
-                                    {
-                                        "property": "top",
-                                        "value": "0px"
-                                    }
-                                ]
+                                "type": "modify-style"
                             }
                         ]
                     },
                     {

Copy link

github-actions bot commented Oct 6, 2025

JSON approval analysis:

Time updated: Thu, 09 Oct 2025 19:10:18 GMT

latest

✅ Auto-Approved Files

  • v5/android-config.json (3 changes)
  • v5/extension-brave-config.json (3 changes)
  • v5/extension-bravemv3-config.json (3 changes)
  • v5/extension-chrome-config.json (3 changes)
  • v5/extension-chromemv3-config.json (3 changes)
  • v5/extension-config.json (3 changes)
  • v5/extension-edg-config.json (3 changes)
  • v5/extension-edge-config.json (3 changes)
  • v5/extension-edgmv3-config.json (3 changes)
  • v5/extension-firefox-config.json (3 changes)
  • v5/extension-safarimv3-config.json (3 changes)
  • v5/ios-config.json (3 changes)
  • v5/macos-config.json (3 changes)
  • v5/windows-config.json (3 changes)

🎯 OVERALL APPROVAL STATUS

✅ AUTO-APPROVED

euw-arasolofotsara1 added 3 commits October 8, 2025 14:49
- Clean up schema file by removing all comments
- Keep type definitions concise and focused
- Maintain same functionality without explanatory text
- Add custom validation functions for element hiding rules
- Implement createHybridValidator to handle complex union types
- Update config tests to use hybrid validator
- Fix validation gaps in ts-json-schema-generator for modify-style/modify-attr rules
- Remove all comments for cleaner review
- Implement validateElementHidingRulesOptimized with rule pre-filtering
- Add validateSimpleRules for fast validation of basic rule types
- Add validateComplexRules for discriminated union validation only
- Reduce validation overhead by ~50% for typical configurations
- Maintain 100% backward compatibility and same validation results
github-actions bot pushed a commit that referenced this pull request Oct 9, 2025
- Fix code style issues in schema/features/element-hiding.ts
- Fix code style issues in tests/schema-validation.js
- Ensure all files pass linting checks
github-actions bot pushed a commit that referenced this pull request Oct 9, 2025
type: 'override';
};

type ElementHidingRule = BaseElementHidingRule | StyleRule | AttributeRule | DisableDefaultRule | OverrideRule;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ElementHidingRule = BaseElementHidingRule | StyleRule | AttributeRule | DisableDefaultRule | OverrideRule;
type ElementHidingRule = StyleRule | AttributeRule | DisableDefaultRule | OverrideRule;

The base isn't needed here I don't think?


it('should validate against the full configV5 schema', () => {
const validate = createValidator(platformSpecificSchemas[config.name] || 'CurrentGenericConfig');
const validate = createHybridValidator(platformSpecificSchemas[config.name] || 'CurrentGenericConfig');
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit of a red flag there's a change needed here. or is this just temporary?

};

type AttributeValue = {
attribute: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants