Add the ability to use local optimization_config#1186
Open
mu-hun wants to merge 8 commits intofix/1180_local_build_from_cachefrom
Open
Add the ability to use local optimization_config#1186mu-hun wants to merge 8 commits intofix/1180_local_build_from_cachefrom
mu-hun wants to merge 8 commits intofix/1180_local_build_from_cachefrom
Conversation
6507dd5 to
3bcca2e
Compare
Alex-302
reviewed
Apr 7, 2026
3bcca2e to
df6f136
Compare
Adds support for downloading and reusing optimization config locally, so the optimization result can be checked before changes are deployed to the server. - `percent.json` is saved under `temp/optimization_config_cache/` and read from there when `--use-cache` is active. Both `--generate-cache` and `--use-cache` flags now include optimization config handling alongside the existing filter source caching. `@adguard/filters-compiler` is set to `AdguardTeam/FiltersCompiler#local_optimization_config` in `package.json`. This requires `dist/` to be committed to the branch, as GitHub shorthand installation does not trigger a build step. Upd AdguardTeam/FiltersCompiler#216
df6f136 to
424e89f
Compare
Member
Author
Please specify how to perform the test.I have just aligned with the flags you created (#1181). In the PR description,
|
Verifies --use-cache calls setPath() and --generate-cache calls generate() + setPath() with the correct cache path. Dynamically imports build.js per test after vi.resetModules() to re-execute its module-level side effects with controlled process.argv. Mocks fs, @adguard/filters-compiler, and find_files to stay isolated.
e04f297 to
867ab88
Compare
No output when setPath() activates local config, making it non-obvious whether the feature is in use. Co-authored-by: Copilot <copilot@github.com>
Member
Author
Crash fixed7691c68. The cache dir is wiped with Verification guideline (Draft)I tested the steps below, but the result had no output. Maybe I wrote the steps incorrectly or missed something.
If step 6 returns output, the stats cache is wired correctly end-to-end: grep -rF "||banggood.com^$domain=topic.lt" platforms/
# → prints matching lines with file pathsAfter restoring the hit count and running # Rule is absent (before change hit count to 9999) — cache working correctly:
grep -rF "||banggood.com^$domain=topic.lt" platforms/
# → no output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for downloading and reusing the optimization config locally, allowing users to review the optimization results before deploying changes to the server.
This feature should be managed through the build option in the FiltersRegistry, not by FiltersCompiler.
The workflow
percent.jsonis stored intemp/optimization_config/and read from there when--use-cacheis enabled.optimization_config/percent.json, edit it locally, then use it in the build.Both
--generate-cacheand--use-cacheflags now include optimization config handling alongside the existing filter source caching.Note to
@adguard/filters-compiler@adguard/filters-compileris set toAdguardTeam/FiltersCompiler#local_optimization_configinpackage.json.This requires
dist/to be committed to the branch, as GitHub shorthand installation does not trigger a build step.