合入两处 Jules 改进,并补齐评审发现的缺口

Closed
JU
6d ago
+94-26

User description

合入 #2275 与 #2276 两处 Jules 改进,并补齐评审发现的缺口。

一是 YAML 行扫描:加冒号前置检查、行内集合名改借用切片;评审一致指出的二次方开销问题已修:跟踪集合改回哈希表(借用切片保留),笔记里不实的“16 个上限”“零分配”说法也已纠正。

二是订阅 User-Agent 校验:入口与 HTTP 客户端两处都拦长度与控制字符;评审指出的两处真问题已修:被后端拒绝的值不再静默留在本地冒充生效(恢复后端现值并提示),长度报错里的“512 字符”改成“512 字节”以符实际按字节计的口径。

另:#2275 原 PR 上 Sonar 质量门报新代码可靠性 C 级,具体是哪条规则未从现有信息里确认,本 PR 的 CI 会重跑 Sonar,届时再看。


CodeAnt-AI Description

Validate subscription User-Agents and speed up YAML scanning

What Changed

  • Custom subscription User-Agents are trimmed and rejected if they exceed 512 bytes or contain control characters.
  • When a value is rejected, settings revert to the saved User-Agent and show an error; subscription requests use the default User-Agent if a saved value is invalid.
  • YAML scanning skips unnecessary checks on lines without mapping separators while keeping large anchor lookups efficient.

Impact

✅ Fewer failed subscription downloads from invalid User-Agents
✅ Clearer custom User-Agent rejection
✅ Faster scans of YAML lines without mapping separators

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.