Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

After updating @jk-com/adblock-compiler in #217, local validation accepted fields not in the upstream ISource interface: content: string[] and type: "inline".

Changes

  • validation.ts: Enforce upstream schema

    • Require source field (URL or file path)
    • Remove content field validation
    • Restrict type to 'adblock' | 'hosts' (remove 'inline')
  • compiler-config.json: Migrate example to file-based source

    • Create data/input/user-rules.txt with inline content
    • Replace invalid inline source with file reference
  • validation.test.ts: Update test assertions

Migration

Configs using invalid schema need conversion:

  {
    "sources": [{
-     "type": "inline",
-     "content": ["||example.com^", "||tracker.net^"]
+     "source": "data/input/my-rules.txt",
+     "type": "adblock"
    }]
  }

Valid file/URL sources continue working unchanged.

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:

  • dl.deno.land
    • Triggering command: /usr/bin/curl curl --fail --location --progress-bar --output /home/REDACTED/.deno/bin/deno.zip REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Getting validation errors when attempting to compile lists


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Remove support for 'content' field and 'inline' type (not in upstream ISource)
- Make 'source' field required (per upstream schema)
- Update valid types to only 'adblock' or 'hosts' (per upstream SourceType enum)
- Create user-rules.txt file to replace inline content
- Update compiler-config.json to use file-based source
- Update tests to reflect schema changes

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
@jaypatrick jaypatrick requested a review from Copilot January 19, 2026 05:13
Copilot AI changed the title [WIP] Fix validation errors during list compilation Align validation schema with upstream @jk-com/adblock-compiler Jan 19, 2026
Copilot AI requested a review from jaypatrick January 19, 2026 05:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes validation errors during filter list compilation by aligning the local validation schema with the upstream @jk-com/adblock-compiler package. The local code was incorrectly accepting non-standard fields (content array and type: 'inline') that don't exist in the upstream schema.

Changes:

  • Removed validation support for the content field in source objects (not in upstream schema)
  • Restricted type field to only accept 'adblock' or 'hosts' (removed 'inline' option)
  • Made source field required (no longer optional with content alternative)
  • Migrated inline content from config to a new file-based source (data/input/user-rules.txt)
  • Updated test assertions to reflect the schema changes

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/rules-compiler-typescript/src/validation.ts Simplified source validation to match upstream schema - removed content field support and inline type, made source required
src/rules-compiler-typescript/src/validation.test.ts Updated test assertion to remove reference to removed content field
src/rules-compiler-typescript/compiler-config.json Replaced inline content with file-based source reference
data/input/user-rules.txt New file containing the user rules previously defined inline

"||example-ads.com^",
"||tracking.example.net^"
]
"source": "data/input/user-rules.txt",
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The file path referenced in the configuration will not resolve correctly. The compiler runs from the src/rules-compiler-typescript/ directory (as shown in CI workflows), so data/input/user-rules.txt will resolve to src/rules-compiler-typescript/data/input/user-rules.txt, but the actual file was created at data/input/user-rules.txt (repository root).

The path should be ../../data/input/user-rules.txt to correctly reference the file at the repository root from the compiler's working directory.

Copilot uses AI. Check for mistakes.
@jaypatrick jaypatrick marked this pull request as ready for review January 19, 2026 05:18
@jaypatrick jaypatrick merged commit 81732bc into main Jan 19, 2026
16 of 20 checks passed
@jaypatrick jaypatrick deleted the copilot/fix-validation-errors-compile-lists branch January 19, 2026 05:19
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.

2 participants