最新资讯
stackoverflow.blog 欢迎来到芯片时代:半导体制造、AI 数据中心与芯片设计的未来 www.youtube.com AI Agent 总犯同样的错:CentralAgent AI 将记忆重构为经验系统 pub.towardsai.net Netflix 科学家建议重采样 LLM 评判:5 次仅将误差棒缩小 13% pub.towardsai.net Jev 作为 LLM 前的静默层:构建提示感知的模型路由器 reddit.com OpenAI 称 Astra 仅满足 10% 安全任务标准 dev.to FreeToken:在自有 GPU 上运行前沿 MoE 模型及其内存需求 dev.to 当 AI Agent 说“完成”时,究竟完成了什么? dev.to 部署 Underdog Bark 3.0 Pro:逐字转写、自定义后端与分块设置 dev.to 为艰难对话构建 AI:五个 Agent、一条安全正则与一位盲评监督者 techcrunch.com Palo Alto Networks 洽谈以 5 亿美元收购 AI Agent 安全初创公司 Clutch theinformation.com 黄仁勋被要求就涉华间谍指控向国会作简报 www.infoq.com Edera 推出 Object Capability Bounded Authority,试图将凭证与 AI Agent 工作负载隔离
多元动态
登录 注册
行业动态 dev.to · @Debashish Ghosal

1,558 个测试全绿却无鉴权:那些从未真正运行的测试

原文 我的收藏

文章列举三个绿色测试套件掩盖真实失败的案例:planner-critic-engine 中名为 test_all_adapters_importable 的测试函数体只有 pass,不验证任何内容;同一仓库 65 个断言文件中有 57 个格式错误,harness 解析到零个断言后返回 0/0 并视为成功;CauterRule v0.3.0 报告 1,558 个测试通过,但鉴权守卫实际从未执行。作者借此提醒不要因测试全绿而放松警惕。

AI推荐理由 以三个具体案例说明绿色测试套件掩盖真实失败:空断言测试、断言文件格式错误导致 harness 返回 0/0 仍视为通过、以及 1,558 个测试中鉴权守卫从未运行。对 AI 辅助编码与测试可靠性有警示价值,但属个人项目经验,未提供可独立复现的仓库或数据。

66

正文

A test named test_all_adapters_importable asserted nothing. It would pass forever, even if every adapter was broken. 57 of 65 assertion files were in the wrong format, and the harness returned 0 / 0 without a whisper. If a green suite makes you relax, this post is going to un-relax you. Three Times a Green Suite Hid a Real Failure 1. The test gutted to pass. In planner-critic-engine, a test literally had a pass body: def test_all_adapters_importable(): # if it imported, it's fine — except this proves nothing pass Enter fullscreen mode Exit fullscreen mode It was caught in code review, not by CI, and only before the LLM sweep because a human read it. Issue #236. 2. The harness that returned 0 / 0 and called it green. In the same repo, 57 of 65 assertion files were in the wrong format. The harness parsed them, found zero assertions to run, and returned 0 / 0 — which it treated as success. The suite was green because it had executed nothing. 3. The auth guard that never ran. In CauterRule v0.3.0 the suite reported 1,558 tests green. The MCP HTTP bearer-auth guard never ran, because an import was swallowed. Every unit test passed. The only reason we found the unauthenticated store read was a Docker field test running the real thing in a real container. The Dangerous Thing Wasn't the Bug In all three cases the bug mattered, but it wasn't the scariest part. The scariest part was the confidence. We treat "tests pass" as evidence. Sometimes it's evidence that the harness silently skipped a module, or that an import was swallowed, or that a fixture file was parsed into an empty set. The suite stays green and the system ships with an unauthenticated read path. The Fix Is a Meta-Test, Not More Tests The fix is not to write more tests. It's to assert that your tests actually ran and actually asserted. def test_suite_is_not_empty(): results = run_assertion_files("tests/assertions/") assert results.executed > 0, "harness ran zero assertions" assert results.assertions > 0, "assertions parsed to empty set" Enter fullscreen mode Exit fullscreen mode Two rules fall out of this: CI must fail when a module produces zero results. 0 / 0 is an error state, not a pass. Distinguish "did not run" from "ran and passed." A swallowed import and a skipped module should be loud failures, not silence. That single distinction is the difference between a flaky gate and a strict one. The Honest Limitation Meta-tests add process, and process can rot — a meta-test that stops checking is just another green checkmark. And no amount of test discipline catches the false negatives you never thought to test for. This reduces the class of "green but broken." It does not eliminate it. But it does close the worst category: the test that never ran and told you everything was fine. What's the last green build you caught lying to you? I now trust a green suite about as far as I can read its raw output. Repos and receipts: CauterRule · CauterRule v0.3.0 field test report · PlannerCritic failure-mode register · agent-tooltrust design decisions — all MIT, all public.

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容