Repository navigation
✨ [Feature] 用 token-shingle 比较更新,并独立提示 userscript 元数据变更 - #1832
Draft
cyfung1031 wants to merge 3 commits into
Draft
cyfung1031 wants to merge 3 commits into
cyfung1031 wants to merge 3 commits into
Conversation
cyfung1031
marked this pull request as ready for review
November 7, 2026 02:42
cyfung1031
marked this pull request as draft
November 7, 2026 07:09
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.
Checklist / 检查清单
背景与实现
Replace ScriptCat's old character-based
string-similarity-jsupdate score with a pairwise token-shingle comparison inspired by Greasy Fork. Unlike a site-wide similar-script search, this computes a fingerprint of the installed and proposed versions during the existing update check; no global index or storage migration is needed.js-tokenstokenization; ignore whitespace and ordinary comments; 5-token overlapping shingles excluding structural punctuation; length-prefixed SHA-256-derived 64-bit hashes; bottom-256 unique hashes; cutoff-aware sampled Jaccard with token-count cap. Identical nonempty executable tokens score 100%. Missing/empty executable code is explicitly unscorable rather than a misleading numeric similarity.// ==UserScript==directives, including repeated ordered values and unknown/ScriptCat-specific tags. Classify permission, scope, dependency, injection, and update-source changes as sensitive; preserve localized display directives; detect missing/invalid headers and==UserConfig==changes.@connectbadge and existing update actions. A sensitive metadata change forces the major-change risk even with 100% code similarity. Version-only metadata changes remain represented in the version diff without duplicate warning clutter.<0.50major,0.50–<0.90noticeable,>=0.90tiny, with metadata/unscorable overrides. Do not interpret the score as a percentage of lines copied or proof of semantic equivalence.checkSilenceUpdatepolicy for newly added@connectis preserved. Extending silent-update policy for other metadata is a separate security decision. Common-snippet highlighting is a possible follow-up, not part of this numeric-score replacement.js-tokens, removestring-similarity-js, update the design document and translation keys in all 10 locales.验证 / Verification
BatchActionsBar.test.tsx— 6 passed.pnpm run lint:cipassed (Prettier, TypeScript, locale/issue-template validation, and ESLint); productionpnpm run buildsucceeded with bundle-size/Monaco warnings.pnpm run test:ciis not green in this environment (142 files failed in the concurrent run). A retry with two workers was also not green (57 files failed, 326 passed; 147 individual failures), including unrelated UI suites, while their isolated control run passed. This is not claimed as a complete repository-wide test pass.See design and implementation details, Greasy Fork scorer, and Greasy Fork's introduction.