Repository navigation
fix(popup): return localization keys for unsupported pages - #30
Merged
Merged
Conversation
Signed-off-by: aliyun1121003339 <jacob.hxx.cn@outlook.com>
审查者指南扩展页面支持契约,为每种不受支持的协议类型添加带类型的本地化原因代码,同时不更改现有的回退原因或 HTTP(S) 行为,并增加了针对性的表格驱动回归测试。 文件级变更
提示与命令与 Sourcery 交互
自定义体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideExtends the page-support contract with typed localization reason codes for every unsupported protocol family, without changing existing fallback reasons or HTTP(S) behavior, and adds focused table-driven regression coverage. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
4 tasks done
There was a problem hiding this comment.
嘿——我发现了 1 个问题
给 AI 智能体的提示
请处理此代码审查中的评论:
## 单条评论
### 评论 1
<location path="tests/page-support.test.mjs" line_range="34" />
<code_context>
supported: boolean
reason: string
+ reasonCode?: 'noPage' | 'browserBuiltin' | 'extensionPage' | 'about' | 'viewSource' | 'devtools' | 'localFile' | 'dataBlob' | 'unsupportedProtocol'
}
const getProtocol = (url: unknown): string => {
</code_context>
<issue_to_address>
**更改后的回退消息仍能通过测试**
当不受支持的情况返回非空但不正确的 `reason` 字符串时,测试 `unsupported protocols expose the localization key already consumed by the popup` 在第 33 行使用 `assert.ok(checkPageSupport(url).reason)`,因此即使将现有回退消息替换成任意其他非空字符串,测试仍会通过,无法发现回退消息发生了变化。
请针对每个不受支持的 URL 断言预期的回退 `reason` 字符串。
</issue_to_address>Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/page-support.test.mjs" line_range="34" />
<code_context>
supported: boolean
reason: string
+ reasonCode?: 'noPage' | 'browserBuiltin' | 'extensionPage' | 'about' | 'viewSource' | 'devtools' | 'localFile' | 'dataBlob' | 'unsupportedProtocol'
}
const getProtocol = (url: unknown): string => {
</code_context>
<issue_to_address>
**Changed fallback messages pass**
When an unsupported case returns a nonempty but incorrect `reason` string, the test `unsupported protocols expose the localization key already consumed by the popup` uses `assert.ok(checkPageSupport(url).reason)` on line 33, so replacing an existing fallback message with any other nonempty string still passes and the test does not catch changed fallback messages.
Assert the expected fallback `reason` string for each unsupported URL.
</issue_to_address>
7 tasks done
Signed-off-by: aliyun1121003339 <jacob.hxx.cn@outlook.com>
setube
added a commit
that referenced
this pull request
Oct 21, 2026
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.
1. Context & Motivation (Context)
support.reasonCodeto select translated messages, butcheckPageSupport()only returns a Chinese fallback string. Unsupported tabs therefore lose the expected localization key and produce three TS2339 errors.supportedand the existingreasonstrings, preserving current consumers.2. Implementation Details (Implementation)
3. Testing Strategies (Validation)
node --test tests/page-support.test.mjspasses on this branch.bun run typecheck(including production extension build) andbun run lintpass on Windows x64 / Node 22.19.0.Sourcery 摘要
通过从页面支持检查中公开稳定的原因代码,恢复对不受支持页面的本地化弹窗消息。
Bug 修复:
增强:
测试:
Original summary in English
Sourcery 总结
通过页面支持检查返回稳定的原因代码,恢复不支持的页面的本地化弹窗消息。
Bug 修复:
增强功能:
测试:
Original summary in English
Summary by Sourcery
Restore localized popup messaging for unsupported pages by returning stable reason codes from page-support checks.
Bug Fixes:
Enhancements:
Tests: