<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>测量调度 | 锤子前端</title><description>Now vibe coding, so learning hammer FE ?</description><link>https://channel.meo-ai.com</link><item><title>《在 GitHub Copilot 应用中流畅渲染超大 Pull Request》</title><link>https://channel.meo-ai.com/posts/713</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/713</guid><pubDate>Sat, 26 Sep 2026 23:54:52 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《在 GitHub Copilot 应用中流畅渲染超大 Pull Request》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;br /&gt;&lt;a href=&quot;/search/result?q=%23%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B&quot; title=&quot;#软件工程&quot;&gt;#软件工程&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96&quot; title=&quot;#前端性能优化&quot;&gt;#前端性能优化&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23PullRequest&quot; title=&quot;#PullRequest&quot;&gt;#PullRequest&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E8%99%9A%E6%8B%9F%E5%8C%96%E6%B8%B2%E6%9F%93&quot; title=&quot;#虚拟化渲染&quot;&gt;#虚拟化渲染&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23React&quot; title=&quot;#React&quot;&gt;#React&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%B5%8B%E9%87%8F%E8%B0%83%E5%BA%A6&quot; title=&quot;#测量调度&quot;&gt;#测量调度&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%BB%9A%E5%8A%A8%E9%94%9A%E5%AE%9A&quot; title=&quot;#滚动锚定&quot;&gt;#滚动锚定&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%80%A7%E8%83%BD%E7%9B%91%E6%8E%A7&quot; title=&quot;#性能监控&quot;&gt;#性能监控&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;文章介绍了 GitHub Copilot 应用如何重构 Pull Request 视图，使其能够流畅处理包含 2,200 个文件、超过 100 万行代码变更和 400 多条内联评论的超大型 PR。核心挑战在于评论高度的动态性——与代码行不同，评论高度取决于 Markdown 换行、可展开区块、回复框和图片加载等渲染时才能确定的因素。团队通过分离确定性与动态几何、实现智能测量调度器、采用滚动锚定技术，并建立自动化测量循环来解决这一问题，最终实现了百万行 diff 的流畅浏览体验。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;&lt;br /&gt;1. &lt;b&gt;代码与评论的几何分离&lt;/b&gt;：代码行高度固定且可预先计算，而评论高度动态变化。团队将文档高度分为确定性代码高度（精确前缀和）和动态块高度（估算后测量），两者独立管理，避免评论调整时重建整个代码几何。&lt;br /&gt;&lt;br /&gt;2. &lt;b&gt;智能测量调度器&lt;/b&gt;：放弃每块一个 ResizeObserver 的方案（会触发反馈循环），改为单一的空闲和滚动门控测量通道。仅在视口附近约 2400px 范围内进行测量，屏幕上的块优先批量读取，离屏块最多做一次有限渲染，超过视口高度的块跳过测量。&lt;br /&gt;&lt;br /&gt;3. &lt;b&gt;滚动锚定技术&lt;/b&gt;：当测量高度与估算不符时，通过身份而非像素来校正——记录用户锚定的行或块，应用高度增量后，将同一锚点解析到新像素位置并滚动，确保用户视线不跳动。区分用户滚动与程序滚动，避免侧边栏切换等操作误触发保护机制。&lt;br /&gt;&lt;br /&gt;4. &lt;b&gt;数据管道优化&lt;/b&gt;：流式传输结构优先于内容，文件树和元数据在文档加载时即可渲染；语法高亮在主线程外运行，行先以纯文本显示；释放文档时保留最近几个 diff 的缓存，平衡内存与返回时的加载速度。&lt;br /&gt;&lt;br /&gt;5. &lt;b&gt;自动化测量循环&lt;/b&gt;：建立&quot;变更→测量→改进&quot;的无人值守循环，包括无头探针车道（声明式流程 + 生产环境插桩）和自动驾驶仪（驱动真实桌面应用），通过健康信号（如无未填充间隙、评论块非空）自动检测问题，实现机械式调试而非人工复现。&lt;br /&gt;&lt;br /&gt;URL：&lt;br /&gt;&lt;a href=&quot;https://github.blog/engineering/user-experience/rendering-huge-pull-requests-in-the-github-copilot-app/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://github.blog/engineering/user-experience/rendering-huge-pull-requests-in-the-github-copilot-app/&quot;&gt;https://github.blog/engineering/user-experience/rendering-huge-pull-requests-in-the-github-copilot-app/&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://github.blog/engineering/user-experience/rendering-huge-pull-requests-in-the-github-copilot-app&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;How we rebuilt the diff surface in the GitHub Copilot app to open a million-line pull request with hundreds of inline review comments.&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;The GitHub Blog&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;Rendering huge pull requests in the GitHub Copilot app&quot; src=&quot;/static/https://cdn4.telesco.pe/file/Q0e6XCy4GREe5APpCJ0_bG8D7plewPDXZ0hOGWczxwxKYLRaDieMV2SFTC2_VsffSvc68IJy_EE7N0hWt6obHCbDcB7AqLxgmsf_SnKQlcb0FtcO1Z4Ss5KpTVtFGlctYtgOkZOu_7kKZxiMZoqHhr2Yod-hCeNOSxlP7QSUPkDiYNsakYKauC-cRnRgLdmaKpYUAmmSnsWRBcrcWDVTCQ1DqrdWm7ekEr60xsIWQdmCENdNNmv0EV3s_Lt-nl09t2wBa3avHjdmaD1dRPJSLolpITbqM9JdutIsD7Q0624iueRS7ZhEg2ZKOTeB-jXwp-KIrev8BevUBEPog2DNKA.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;Rendering huge pull requests in the GitHub Copilot app&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;How we rebuilt the diff surface in the GitHub Copilot app to open a million-line pull request with hundreds of inline review comments.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>《十个防止 AI 代码泛滥的前端项目护栏》</title><link>https://channel.meo-ai.com/posts/705</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/705</guid><pubDate>Thu, 10 Sep 2026 23:23:08 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《十个防止 AI 代码泛滥的前端项目护栏》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;br /&gt;&lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF&quot; title=&quot;#前端&quot;&gt;#前端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23TypeScript&quot; title=&quot;#TypeScript&quot;&gt;#TypeScript&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23React&quot; title=&quot;#React&quot;&gt;#React&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23AI%E7%BC%96%E7%A8%8B&quot; title=&quot;#AI编程&quot;&gt;#AI编程&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E4%BB%A3%E7%A0%81%E8%B4%A8%E9%87%8F&quot; title=&quot;#代码质量&quot;&gt;#代码质量&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23ESLint&quot; title=&quot;#ESLint&quot;&gt;#ESLint&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%B5%8B%E8%AF%95%E7%AD%96%E7%95%A5&quot; title=&quot;#测试策略&quot;&gt;#测试策略&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23CI_CD&quot; title=&quot;#CI_CD&quot;&gt;#CI_CD&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E4%BB%A3%E7%A0%81%E5%AE%A1%E6%9F%A5&quot; title=&quot;#代码审查&quot;&gt;#代码审查&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5&quot; title=&quot;#工程实践&quot;&gt;#工程实践&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;&lt;br /&gt;本文针对 AI 生成代码速度远超人类审查能力的前端项目，提供了一套实用的十项防护清单。核心思路是通过自动化工具链（类型系统、Linter、变异测试、CI 门禁）在代码合并前拦截机械性错误，而非依赖人工逐行审查。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;&lt;br /&gt;1. &lt;b&gt;用 OpenAPI 契约替代手写类型&lt;/b&gt;：通过 Hey API 等工具从 OpenAPI 规范直接生成 TypeScript 类型、客户端和 Zod 校验，避免 AI 臆造不存在的 API 字段（如 &lt;code&gt;user.fullName&lt;/code&gt;），让编译器在构建期就报错。&lt;br /&gt;&lt;br /&gt;2. &lt;b&gt;开启严格 TypeScript 配置&lt;/b&gt;：启用 &lt;code&gt;noUncheckedIndexedAccess&lt;/code&gt; 等严格标志，让数组索引访问返回 &lt;code&gt;T | undefined&lt;/code&gt;，迫使代码显式处理边界情况，减少 AI 常见的&quot;想当然&quot;代码。&lt;br /&gt;&lt;br /&gt;3. &lt;b&gt;把 Linter 当作行为过滤器&lt;/b&gt;：使用 SonarJS、react-you-might-not-need-an-effect、vitest/playwright 插件、jsx-a11y 等 ESLint 插件，自动拦截认知复杂度过高、不必要的 Effect、可访问性违规等问题。&lt;br /&gt;&lt;br /&gt;4. &lt;b&gt;设定架构层边界&lt;/b&gt;：使用 eslint-plugin-boundaries 或 dependency-cruiser 强制实施分层架构（如 UI 层不得直接访问 API 层），防止 AI 生成的代码逐渐退化为&quot;GitHub 平均水平&quot;的混乱结构。&lt;br /&gt;&lt;br /&gt;5. &lt;b&gt;将重复出现的错误转化为自定义 Linter 规则&lt;/b&gt;：当同一种 bug 第二次出现时，立即编写自定义 ESLint 规则禁止该模式。例如禁止在服务层函数中使用 &lt;code&gt;Math.round&lt;/code&gt; 和 &lt;code&gt;toFixed&lt;/code&gt;，避免双重取整导致的薪资计算错误。&lt;br /&gt;&lt;br /&gt;6. &lt;b&gt;把规则直接喂给 AI 模型&lt;/b&gt;：通过项目规则文件（如 &lt;code&gt;.cursor/rules&lt;/code&gt;、&lt;code&gt;CLAUDE.md&lt;/code&gt;）或技能文件（如 react-doctor），将项目约定、架构决策和禁止模式直接提供给 AI，让模型在生成代码时就遵循规范。&lt;br /&gt;&lt;br /&gt;7. &lt;b&gt;用变异测试验证测试有效性&lt;/b&gt;：使用 Stryker 故意破坏代码（翻转运算符、反转条件、交换返回值），检查现有测试是否能捕获这些变异。存活的变异体通常暴露&quot;只测形状不测内容&quot;的无效测试。一个项目约 4,700 个变异体在 6 分钟内完成扫描。&lt;br /&gt;&lt;br /&gt;8. &lt;b&gt;用 Knip 清理死代码&lt;/b&gt;：Knip 可以检测未使用的文件、导出和依赖，配合自定义可达性脚本填补其盲区，防止 AI 生成大量&quot;以防万一&quot;却无人调用的冗余代码。&lt;br /&gt;&lt;br /&gt;9. &lt;b&gt;用 jscpd 检测重复代码&lt;/b&gt;：AI 倾向于在不同地方生成几乎相同的逻辑，jscpd 能发现这些重复，提示抽象机会或错误的复制粘贴。&lt;br /&gt;&lt;br /&gt;10. &lt;b&gt;将所有检查强制设为 CI 门禁&lt;/b&gt;：上述所有工具（类型检查、Lint、测试、变异测试、重复检测）必须作为 CI 的强制通过项，而非可选建议，确保 AI 生成的代码无法绕过质量关卡。&lt;br /&gt;&lt;br /&gt;11. &lt;b&gt;成本与局限&lt;/b&gt;：这些护栏会产生噪音（误报）、规则过时和新人上手摩擦等成本，建议按&quot;类型 → Lint → 测试 → CI&quot;的顺序渐进式推行。同时需注意，这些检查只能捕获机械性错误，无法识别糟糕的品味或错误的抽象。&lt;br /&gt;&lt;br /&gt;URL：&lt;br /&gt;&lt;a href=&quot;https://evilmartians.com/chronicles/ten-anti-ai-slop-moves-for-frontend-projects-going-faster-than-humans-can-review&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://evilmartians.com/chronicles/ten-anti-ai-slop-moves-for-frontend-projects-going-faster-than-humans-can-review&quot;&gt;https://evilmartians.com/chronicles/ten-anti-ai-slop-moves-for-frontend-projects-going-faster-than-humans-can-review&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://evilmartians.com/chronicles/ten-anti-ai-slop-moves-for-frontend-projects-going-faster-than-humans-can-review&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;Ten checks that catch what AI-written frontend code hides: contract codegen, boundary linting, mutation testing, and dead-code detectors.&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;evilmartians.com&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;10 anti-AI slop moves for frontend projects going faster than humans can review—Martian Chronicles, Evil Martians’ team blog&quot; src=&quot;/static/https://cdn4.telesco.pe/file/M8U_Fe7M2gHOVcQM8XPpszalMyQIXRzmCokcCm_4dgcjkvIzQMlUYvsgmehUQC-NXCJGc3I8VY2eVIBkKPAVZkYiGTqLga5hRE0vlrIEN-NkyQMSO8-2Jvw2KDqQbQreg_haZqG_9bJF5WftGhdMmwjZOuCvSjmydEd5cT5fncbj22jwHNKyE0bKDJsBv9lYte-NCz1-Luv1TDht4195efFJApkQ1lPvOF_LBJz_mw8fvv9SPSbysOMKWZ8GCcH5JGEb56pCMV7ioa2QMiq3Xu84zYM95pDo-s18Pce77OetyKD2n7Yn8M6J_CVFGam6c__TEJncp_jGmxQsYu7KLQ.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;10 anti-AI slop moves for frontend projects going faster than humans can review—Martian Chronicles, Evil Martians’ team blog&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;Ten checks that catch what AI-written frontend code hides: contract codegen, boundary linting, mutation testing, and dead-code detectors.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item></channel></rss>