Add JSON editor aria labels, aria-ignore issue checks, and test hub - #272
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
📝 WalkthroughWalkthrough本次变更升级 JSON 编辑器接口,加入多语言 ChangesJSON 编辑器与本地化
测试 Hub 与无障碍检查
前端验证
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 102 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Actionable comments posted: 14
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/public/locales/lzh.json`:
- Around line 3662-3664: Update the `aria-label` value for all four `jsonEditor`
entries in `src/public/locales/lzh.json`, including the occurrences near the
referenced locations, replacing `JSON 樞機` with `JSON 編輯器` while leaving the
surrounding locale structure unchanged.
In `@src/public/pages/scripts/components/jsonEditor.mjs`:
- Line 1: Remove the pinned `@3` major version from both vanilla-jsoneditor CDN
URLs in src/public/pages/scripts/components/jsonEditor.mjs:1-1 and
src/public/pages/scripts/components/jsonEditor.mjs:69-69. Update the
createJSONEditor import and theme stylesheet URL to use standalone.js paths that
follow the latest upstream version.
- Around line 34-38: Remove JSON parsing from the Ctrl+S handler around the
onSave callback: call e.preventDefault() before invoking onSave, then pass the
editor result directly so saveConfig(), handleSaveConfig(), or saveFile()
performs validation. Preserve the existing Ctrl+S condition and onSave guard.
In `@src/public/parts/shells/config/public/index.html`:
- Line 38: Update the decorative img element in the shell markup to include an
empty alt attribute while preserving aria-hidden="true" and the existing
presentation.
In `@src/public/parts/shells/config/test/manifest.json`:
- Around line 4-10: Update the frontendShared arrays in
src/public/parts/shells/config/test/manifest.json lines 4-10 and
src/public/parts/shells/discordbot/test/manifest.json lines 19-25 to include
src/public/locales/**, ensuring locale-only changes trigger the JSON editor test
suites.
In `@src/public/parts/shells/serviceSourceManage/test/frontend/phases.mjs`:
- Around line 1-4: 为导出的 phases 配置补充一行真实的中文 JSDoc 摘要,说明其用于定义 Playwright
测试阶段配置;保留现有的 `@type` 类型标注不变。
In `@src/scripts/test/core/github_issue.mjs`:
- Around line 10-16: Update parseGithubIssueUrl in
src/scripts/test/core/github_issue.mjs (lines 10-16) to accept only HTTPS
github.com URLs without credentials or a port, while preserving the existing
issue-path validation. Add assertions in
src/scripts/test/selftest/github_issue.test.mjs (lines 20-23) that URLs using
non-HTTPS schemes, credentials, or ports return null.
In `@src/scripts/test/hub/apis/github_issue.mjs`:
- Around line 13-48: Update createGithubIssueRouter to parse each issue URL
once, pass the parsed result into probeGithubIssueClosed, and use that value for
probing. In probeGithubIssueClosed, read JSON exclusively from result.stdout,
compare state directly with 'CLOSED', and have the route return the cached
boolean without an additional === true check.
In `@src/scripts/test/hub/base_url.mjs`:
- Around line 10-16: Inline the single-use fromEnv and fromPage bindings in the
URL return expression, preserving the environment-first fallback order, trimming
each selected value, and removing one trailing slash as currently done.
In `@src/scripts/test/hub/clients/github_issue.mjs`:
- Around line 15-22: 为客户端 GitHub issue 查询增加有界超时:更新 github_issue.mjs 中的
isGithubIssueClosed,并同步处理 test_watch.mjs 中的 checkAriaIgnores,使对 /github-issue 的
fetch 在超时后结束并按未关闭处理;同时在服务端 github-issue 处理逻辑调用 execFile('gh', ...) 时配置超时,确保 gh
issue view 挂起不会无限等待。
In `@src/scripts/test/hub/clients/shared_store.mjs`:
- Around line 12-67: 在 shared-store 客户端中新增本地 URL 构造 helper,并让
hubSharedStoreGet、hubSharedStoreSet、hubSharedStoreDelete 统一通过它生成请求地址;移除
hubSharedStoreGet 中被 !res.ok 覆盖的 404 特判,并将 Set/Delete 的成功判断简化为直接返回 res.ok。
In `@src/scripts/test/hub/index.mjs`:
- Around line 25-46: 将两个 Express 中间件的参数从 _req 重命名为 req,因为第一个中间件实际读取了
req.method;同时调整 app.listen 结果返回的 url,复用已有的本地服务 URL 表达式,避免再次拼接 http://127.0.0.1:。
In `@src/scripts/test/manifest.json`:
- Around line 229-249: Rename the manifest suite currently named github_issue to
test_hub, keeping its existing run commands, test files, and triggers unchanged
so the suite name accurately reflects its hub self-test coverage.
In `@src/scripts/test/runner/index.mjs`:
- Around line 784-787: 在当前函数的 finally 清理逻辑中,删除对 FOUNT_TEST_HUB_URL 与 hub.url
的条件比较,直接移除 FOUNT_TEST_HUB_URL 环境变量;保留 hub.close() 的关闭处理不变。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8ce40cd3-fb67-4a69-a0e5-8c4560e0e1b7
📒 Files selected for processing (71)
.github/pages/test/frontend/fixtures.mjssrc/decl/locale_data.tssrc/public/locales/ar-SA.jsonsrc/public/locales/de-DE.jsonsrc/public/locales/emoji.jsonsrc/public/locales/en-UK.jsonsrc/public/locales/es-ES.jsonsrc/public/locales/fr-FR.jsonsrc/public/locales/hi-IN.jsonsrc/public/locales/is-IS.jsonsrc/public/locales/it-IT.jsonsrc/public/locales/ja-JP.jsonsrc/public/locales/ko-KR.jsonsrc/public/locales/lzh.jsonsrc/public/locales/nl-NL.jsonsrc/public/locales/pt-PT.jsonsrc/public/locales/ru-RU.jsonsrc/public/locales/uk-UA.jsonsrc/public/locales/vi-VN.jsonsrc/public/locales/zh-CN.jsonsrc/public/locales/zh-TW.jsonsrc/public/pages/AGENTS.mdsrc/public/pages/scripts/components/jsonEditor.mjssrc/public/pages/scripts/test/test_watch.mjssrc/public/parts/shells/config/public/index.htmlsrc/public/parts/shells/config/public/index.mjssrc/public/parts/shells/config/test/frontend/fixtures.mjssrc/public/parts/shells/config/test/frontend/jsonEditor.spec.mjssrc/public/parts/shells/config/test/frontend/phases.mjssrc/public/parts/shells/config/test/frontend/playwright.config.mjssrc/public/parts/shells/config/test/frontend/run.mjssrc/public/parts/shells/config/test/manifest.jsonsrc/public/parts/shells/config/test/node_bootstrap.mjssrc/public/parts/shells/discordbot/public/index.mjssrc/public/parts/shells/discordbot/test/frontend/jsonEditor.spec.mjssrc/public/parts/shells/discordbot/test/frontend/phases.mjssrc/public/parts/shells/discordbot/test/manifest.jsonsrc/public/parts/shells/serviceSourceManage/public/index.htmlsrc/public/parts/shells/serviceSourceManage/public/index.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/fixtures.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/jsonEditor.spec.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/phases.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/playwright.config.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/run.mjssrc/public/parts/shells/serviceSourceManage/test/manifest.jsonsrc/public/parts/shells/serviceSourceManage/test/node_bootstrap.mjssrc/public/parts/shells/telegrambot/public/index.mjssrc/public/parts/shells/telegrambot/test/frontend/jsonEditor.spec.mjssrc/public/parts/shells/telegrambot/test/frontend/phases.mjssrc/public/parts/shells/telegrambot/test/manifest.jsonsrc/public/parts/shells/wechatbot/public/index.mjssrc/public/parts/shells/wechatbot/test/frontend/jsonEditor.spec.mjssrc/public/parts/shells/wechatbot/test/frontend/phases.mjssrc/public/parts/shells/wechatbot/test/manifest.jsonsrc/scripts/test/AGENTS.mdsrc/scripts/test/core/github_issue.mjssrc/scripts/test/docs/playwright.mdsrc/scripts/test/hub/apis/github_issue.mjssrc/scripts/test/hub/apis/health.mjssrc/scripts/test/hub/apis/shared_store.mjssrc/scripts/test/hub/base_url.mjssrc/scripts/test/hub/clients/github_issue.mjssrc/scripts/test/hub/clients/shared_store.mjssrc/scripts/test/hub/index.mjssrc/scripts/test/manifest.jsonsrc/scripts/test/playwright/fixtures.mjssrc/scripts/test/playwright/github_issue.mjssrc/scripts/test/playwright/json_editor.mjssrc/scripts/test/runner/index.mjssrc/scripts/test/selftest/github_issue.test.mjssrc/scripts/test/selftest/test_hub.test.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
| @@ -1,29 +1,43 @@ | |||
| import { createJSONEditor as base } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor@2/standalone.js' | |||
| import { createJSONEditor as base } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor@3/standalone.js' | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
移除 CDN 主版本固定。
该项目的 CDN 策略要求跟随上游最新版本。不要固定到 @3。
src/public/pages/scripts/components/jsonEditor.mjs#L1-L1: 改为不含@3的standalone.js地址。src/public/pages/scripts/components/jsonEditor.mjs#L69-L69: 改为不含@3的主题样式地址。
Based on learnings: “remote ESM imports … are intentionally left unpinned to follow the latest upstream.”
📍 Affects 1 file
src/public/pages/scripts/components/jsonEditor.mjs#L1-L1(this comment)src/public/pages/scripts/components/jsonEditor.mjs#L69-L69
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/public/pages/scripts/components/jsonEditor.mjs` at line 1, Remove the
pinned `@3` major version from both vanilla-jsoneditor CDN URLs in
src/public/pages/scripts/components/jsonEditor.mjs:1-1 and
src/public/pages/scripts/components/jsonEditor.mjs:69-69. Update the
createJSONEditor import and theme stylesheet URL to use standalone.js paths that
follow the latest upstream version.
Source: Learnings
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/public/parts/shells/telegrambot/public/index.mjs (1)
230-242: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win删除一次性
configJson绑定。
configJson只用于填充一次请求体。保留该临时值会拉长解析流程。让解析后的值直接组成有语义的请求体绑定,并保留当前无效 JSON 的早退提示。按路径规范,“禁止只用一次的临时绑定,内联到使用处”。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/parts/shells/telegrambot/public/index.mjs` around lines 230 - 242, Remove the one-time configJson binding in the request-building flow: preserve the existing try/catch and invalid-JSON early return, then use the parsed result directly when constructing the config request body. Keep the token and character fields unchanged.Source: Path instructions
src/public/pages/scripts/test/test_watch.mjs (1)
244-258: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win并行且去重
aria-ignore查询。Line 246 位于节点循环内,并且每个 URL 都会串行等待 10 秒超时。Hub 不可达时,多个节点会把一次 a11y 扫描阻塞为
N × 10s;watchChain会继续放大该延迟。按 URL 去重后并行请求,并缓存本次页面的查询结果。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 244 - 258, 更新节点循环中的 aria-ignore 查询流程:按 URL 去重并缓存当前页面的查询结果,避免同一 URL 被重复请求;将唯一 URL 的 Hub 请求并行执行,而不是在循环中逐个等待 10 秒超时。保持现有 closed 判断、printedKeys 去重及错误容忍行为不变,并将查询结果复用于对应节点。src/scripts/test/hub/clients/shared_store.mjs (1)
23-75: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win为 shared-store request 加有界超时。
GET、PUT、DELETE 的
fetch都默认无限等待;Hub 进程或网络卡住时测试运行器可能一直挂起。为三个请求统一复用一个AbortController/超时常量或用请求 helper 封装。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/scripts/test/hub/clients/shared_store.mjs` around lines 23 - 75, 为 hubSharedStoreGet、hubSharedStoreSet 和 hubSharedStoreDelete 的 fetch 请求增加统一的有界超时;复用超时常量及 AbortController 或提取共享请求 helper,并在请求完成或失败后清理定时器,确保 Hub 或网络无响应时分别按现有返回约定结束而不会无限等待。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/public/pages/scripts/components/jsonEditor.mjs`:
- Around line 45-49: 将 createJsonEditor 中的 Ctrl+S keydown 监听器从 document 改为绑定到对应的
jsonEditorContainer,并保持现有的 preventDefault 与 onSave(result.getJson())
行为不变,确保只有该编辑器容器内的按键触发保存。
In `@src/scripts/test/core/github_issue.mjs`:
- Around line 11-13: Update the URL regular expression in the GitHub issue
parsing logic to require the entire input to match a valid Issue URL by adding
an end-of-string boundary. Keep the existing owner, repo, and issue-number
extraction in the match result unchanged, while rejecting URLs with trailing
segments or other extra characters.
In `@src/scripts/test/hub/apis/github_issue.mjs`:
- Around line 26-27: 在解析 GitHub issue 响应的函数中,移除只使用一次的 data 临时变量,直接对
JSON.parse(raw) 的结果执行 state === 'CLOSED' 判断并返回。
---
Outside diff comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 244-258: 更新节点循环中的 aria-ignore 查询流程:按 URL 去重并缓存当前页面的查询结果,避免同一 URL
被重复请求;将唯一 URL 的 Hub 请求并行执行,而不是在循环中逐个等待 10 秒超时。保持现有 closed 判断、printedKeys
去重及错误容忍行为不变,并将查询结果复用于对应节点。
In `@src/public/parts/shells/telegrambot/public/index.mjs`:
- Around line 230-242: Remove the one-time configJson binding in the
request-building flow: preserve the existing try/catch and invalid-JSON early
return, then use the parsed result directly when constructing the config request
body. Keep the token and character fields unchanged.
In `@src/scripts/test/hub/clients/shared_store.mjs`:
- Around line 23-75: 为 hubSharedStoreGet、hubSharedStoreSet 和
hubSharedStoreDelete 的 fetch 请求增加统一的有界超时;复用超时常量及 AbortController 或提取共享请求
helper,并在请求完成或失败后清理定时器,确保 Hub 或网络无响应时分别按现有返回约定结束而不会无限等待。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: da4c4264-2c2f-46e5-9fdd-3e1af8571902
📒 Files selected for processing (27)
.github/pages/test/manifest.jsonsrc/public/locales/lzh.jsonsrc/public/pages/AGENTS.mdsrc/public/pages/scripts/components/jsonEditor.mjssrc/public/pages/scripts/test/test_watch.mjssrc/public/parts/serviceGenerators/AI/proxy/display.mjssrc/public/parts/shells/config/public/index.htmlsrc/public/parts/shells/config/public/index.mjssrc/public/parts/shells/config/test/manifest.jsonsrc/public/parts/shells/discordbot/public/index.mjssrc/public/parts/shells/discordbot/test/manifest.jsonsrc/public/parts/shells/serviceSourceManage/public/index.mjssrc/public/parts/shells/serviceSourceManage/test/frontend/phases.mjssrc/public/parts/shells/serviceSourceManage/test/manifest.jsonsrc/public/parts/shells/telegrambot/public/index.mjssrc/public/parts/shells/telegrambot/test/manifest.jsonsrc/public/parts/shells/wechatbot/public/index.mjssrc/public/parts/shells/wechatbot/test/manifest.jsonsrc/scripts/test/AGENTS.mdsrc/scripts/test/core/github_issue.mjssrc/scripts/test/hub/apis/github_issue.mjssrc/scripts/test/hub/base_url.mjssrc/scripts/test/hub/clients/github_issue.mjssrc/scripts/test/hub/clients/shared_store.mjssrc/scripts/test/hub/index.mjssrc/scripts/test/manifest.jsonsrc/scripts/test/runner/index.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
💤 Files with no reviewable changes (1)
- .github/pages/test/manifest.json
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/public/pages/scripts/test/test_watch.mjs (1)
25-26: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win使浏览器校验与共享解析器一致。
当前正则接受
#fragment、查询串和尾斜杠。parseGithubIssueUrl()拒绝这些值。Hub 随后返回非成功响应,但此处把它当作未确认状态,因此不会报告非法aria-ignore。只接受与共享解析器相同的完整 URL。
建议修改
-const GITHUB_ISSUE_URL_RE = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+\/?(?:[?#].*)?$/i +const GITHUB_ISSUE_URL_RE = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+$/🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 25 - 26, 更新 GITHUB_ISSUE_URL_RE,使其与 parseGithubIssueUrl() 的完整 URL 解析规则一致,仅接受以 /issues/{数字} 结尾的 GitHub issue URL;移除对尾斜杠、查询串和 fragment 的接受,保留现有协议、主机及仓库路径校验。Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/scripts/test/playwright/github_issue.mjs`:
- Around line 8-10: 将 `isGithubIssueClosed` 上方的空 JSDoc 替换为一行真实的中文摘要,明确说明该函数用于判断
GitHub issue 是否已关闭;保持其余导出和实现不变。
---
Outside diff comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 25-26: 更新 GITHUB_ISSUE_URL_RE,使其与 parseGithubIssueUrl() 的完整 URL
解析规则一致,仅接受以 /issues/{数字} 结尾的 GitHub issue URL;移除对尾斜杠、查询串和 fragment
的接受,保留现有协议、主机及仓库路径校验。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 471b1666-b230-43ed-a1ea-6f97530076f0
📒 Files selected for processing (11)
.github/pages/test/frontend/fixtures.mjssrc/public/pages/scripts/components/jsonEditor.mjssrc/public/pages/scripts/test/test_watch.mjssrc/public/parts/shells/telegrambot/public/index.mjssrc/scripts/test/core/github_issue.mjssrc/scripts/test/hub/apis/github_issue.mjssrc/scripts/test/hub/clients/shared_store.mjssrc/scripts/test/playwright/fixtures.mjssrc/scripts/test/playwright/github_issue.mjssrc/scripts/test/selftest/github_issue.test.mjssrc/scripts/test/selftest/test_hub.test.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/public/pages/scripts/test/test_watch.mjs (1)
228-262: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win改用完整标识符,并内联一次性绑定。
el、res、where不够明确。data只使用一次。请改用element、response、location,并直接将await response.json()传入closedByUrl.set()。建议修改
-for (const el of nodes) { - const where = el.id ? `#${el.id}` : el.className || el.tagName +for (const element of nodes) { + const location = element.id ? `#${element.id}` : element.className || element.tagName - const res = await fetch(`${hub}/github-issue?url=${encodeURIComponent(url)}`, { + const response = await fetch(`${hub}/github-issue?url=${encodeURIComponent(url)}`, { signal: AbortSignal.timeout(10_000), }) - if (!res.ok) { + if (!response.ok) { closedByUrl.set(url, false) return } - const data = await res.json() - closedByUrl.set(url, data?.closed === true) + closedByUrl.set(url, (await response.json())?.closed === true)As per path instructions:标识符必须使用可读的完整词,且一次性临时绑定必须内联。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 228 - 262, 在遍历节点和请求 GitHub issue 的逻辑中,将一次性或缩写标识符重命名为完整可读名称:使用 element、location 和 response 替换 el、where 和 res;移除仅使用一次的 data 临时变量,并将 await response.json() 直接传入 closedByUrl.set()。Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 228-262: 在遍历节点和请求 GitHub issue 的逻辑中,将一次性或缩写标识符重命名为完整可读名称:使用
element、location 和 response 替换 el、where 和 res;移除仅使用一次的 data 临时变量,并将 await
response.json() 直接传入 closedByUrl.set()。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c4bfdd2f-160a-4715-87a9-f054b4243d09
📒 Files selected for processing (2)
src/public/pages/scripts/test/test_watch.mjssrc/scripts/test/playwright/github_issue.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/public/pages/scripts/test/test_watch.mjs (2)
19-23: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win同步模块说明与导出 API。
Line 23 导出了
ARIA_IGNORE,但模块头部 Line 2 仍写着“无导出”。这会误导维护者。更新模块说明,或在确认没有消费者后删除该导出。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 19 - 23, Update the module header documentation in test_watch.mjs to reflect that ARIA_IGNORE is exported, keeping the existing export API unchanged unless consumer checks confirm it is unused and removal is explicitly appropriate.
4-5: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win让 URL 校验真正兑现文档承诺。
[^/]+会接受?、#、空格和换行。比如https://github.com/owner?x/repo/issues/1会通过正则,但实际 URL 路径不是 GitHub issue 路径。该值随后仍会进入axe的exclude,而 Hub 失败或非成功响应也不会报错。让浏览器侧校验与
parseGithubIssueUrl共用同一解析逻辑。不要用第二套宽松正则绕过格式校验。Also applies to: 25-26, 239-245
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 4 - 5, 更新浏览器侧的 aria-ignore URL 校验逻辑,改为复用 parseGithubIssueUrl 的解析与格式判定,不再使用允许 ?、#、空白或换行的独立宽松正则;在相关校验位置(包括 25-26、239-245)统一拒绝解析失败的值,并仅将解析确认有效的 GitHub issue URL 传给 axe exclude,同时保留现有非法值报错行为。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 252-255: 更新 runA11y 中针对 github-issue 的查询逻辑,按测试运行缓存每个 URL
的进行中请求及成功结果,避免 DOM 变化时重复阻塞请求;失败结果应采用退避策略,并让 watchChain
复用缓存而非持续排队等待。收尾检查需要最新状态时,提供并调用显式刷新路径。
---
Outside diff comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 19-23: Update the module header documentation in test_watch.mjs to
reflect that ARIA_IGNORE is exported, keeping the existing export API unchanged
unless consumer checks confirm it is unused and removal is explicitly
appropriate.
- Around line 4-5: 更新浏览器侧的 aria-ignore URL 校验逻辑,改为复用 parseGithubIssueUrl
的解析与格式判定,不再使用允许 ?、#、空白或换行的独立宽松正则;在相关校验位置(包括 25-26、239-245)统一拒绝解析失败的值,并仅将解析确认有效的
GitHub issue URL 传给 axe exclude,同时保留现有非法值报错行为。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ead53459-53e2-49b6-94c4-8883448bcb08
📒 Files selected for processing (1)
src/public/pages/scripts/test/test_watch.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/public/pages/scripts/test/github_issue.mjs`:
- Around line 10-14: Remove the unnecessary String conversion in
parseGithubIssueUrl and match the declared string parameter directly against the
GitHub issue URL pattern. Preserve the existing null return for non-matching
valid strings, while allowing invalid non-string inputs to fail naturally
instead of being coerced.
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 126-127: Extract the duplicated hub URL normalization expression
into a shared getHubUrl() function, then replace the local implementations in
both probeGithubIssueClosed and checkAriaIgnores with calls to that function
while preserving the existing trailing-slash removal behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e3a92bf2-8c74-4998-9863-245495095d51
📒 Files selected for processing (4)
src/public/pages/scripts/test/github_issue.mjssrc/public/pages/scripts/test/test_watch.mjssrc/scripts/test/core/github_issue.mjssrc/scripts/test/manifest.json
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/public/pages/scripts/test/test_watch.mjs (1)
114-118: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win不要清空进行中的请求。
Line 117 删除
githubIssueInflight后,旧请求仍会继续执行。若kickWatch()立即发起刷新探测,旧响应可能覆盖新响应;旧请求的finally还可能删除新请求的 Map 项。最终的关闭态缓存不再代表显式刷新后的状态,CI 判定会漂移。保留进行中的 Promise,让
probeGithubIssueClosed(..., { refresh: true })先等待旧请求,再创建新请求。建议改法
function refreshGithubIssueProbes() { githubIssueClosedCache.clear() githubIssueBackoffUntil.clear() - githubIssueInflight.clear() }依据当前文件中
refreshGithubIssueProbes()、probeGithubIssueClosed()和kickWatch()的调用顺序。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/public/pages/scripts/test/test_watch.mjs` around lines 114 - 118, Remove the githubIssueInflight.clear() call from refreshGithubIssueProbes(). Keep in-flight promises intact so probeGithubIssueClosed(..., { refresh: true }) waits for the existing request before creating a replacement, preventing stale responses or finally handlers from affecting refreshed state; retain clearing the closed and backoff caches.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/public/pages/scripts/test/github_issue.mjs`:
- Line 11: 更新 github_issue.mjs 中生成 match 的 URL 正则:限制 owner 和 repo 不得包含 /、?、#
或空白字符,并要求 issue 编号为正数而非 0;保持完整 URL 格式校验,使非法输入无法生成 parsed 并进入 axe.exclude。
---
Outside diff comments:
In `@src/public/pages/scripts/test/test_watch.mjs`:
- Around line 114-118: Remove the githubIssueInflight.clear() call from
refreshGithubIssueProbes(). Keep in-flight promises intact so
probeGithubIssueClosed(..., { refresh: true }) waits for the existing request
before creating a replacement, preventing stale responses or finally handlers
from affecting refreshed state; retain clearing the closed and backoff caches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b3a297a0-c1dc-47fc-aba1-b40db122cc37
📒 Files selected for processing (2)
src/public/pages/scripts/test/github_issue.mjssrc/public/pages/scripts/test/test_watch.mjs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
steve02081504/fount-p2p(manual)
| * @returns {{ owner: string, repo: string, number: string } | null} 解析结果 | ||
| */ | ||
| export function parseGithubIssueUrl(url) { | ||
| const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
拒绝伪造的 GitHub issue URL。
当前正则允许 ?、# 和空白出现在 owner 或 repo 中。例如,https://github.com/org/repo?x/issues/1 会被解析成功。test_watch.mjs 随后仅按 parsed 把节点加入 axe.exclude,坏 URL 可以绕过无障碍扫描而不报错。
至少排除 URL 分隔符,并要求 issue 编号为正数。
建议改法
- const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/)
+ const match = url.match(/^https:\/\/github\.com\/([^/?#\s]+)\/([^/?#\s]+)\/issues\/([1-9]\d*)$/)依据 PR 目标中“非法格式报错”,以及 parsed 直接进入 axe.exclude 的调用契约。
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/) | |
| const match = url.match(/^https:\/\/github\.com\/([^/?#\s]+)\/([^/?#\s]+)\/issues\/([1-9]\d*)$/) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/public/pages/scripts/test/github_issue.mjs` at line 11, 更新
github_issue.mjs 中生成 match 的 URL 正则:限制 owner 和 repo 不得包含 /、?、# 或空白字符,并要求 issue
编号为正数而非 0;保持完整 URL 格式校验,使非法输入无法生成 parsed 并进入 axe.exclude。
Summary
ariaLabelon sharedvanilla-jsoneditorwrappers; add config/serviceSource/bot frontend coverage and locale keys.aria-ignoretake a GitHub issue URL; fail when the issue is closed (hub + Playwright teardown /test_watch).127.0.0.1:8903(hub/apis+ clients) so onefount testrun can share GitHub-issue state and KV across processes/browser.Test plan
fount test testkit:github_issue --no-parallelfount test shells/config:frontend:jsonEditor --no-parallel摘要
升级
vanilla-jsoneditorv3。统一使用contentErrors和getJson()。为配置、服务源和机器人页面增加本地化aria-label与 E2E 测试。规范aria-ignore,并检查关联 GitHub Issue 是否关闭。新增 Express test hub。测试运行器通过
127.0.0.1:8903和FOUNT_TEST_HUB_URL共享 Issue 状态及 KV 数据,并负责启动和清理。架构与审美风险
测试基础设施耦合偏重。固定端口和进程级环境变量可能引发端口冲突。Issue 检查依赖
gh和外部 GitHub 服务,可能降低测试稳定性。编辑器依赖 jsDelivr CDN,增加外部资源风险。