跟随 Twitter 示例
本指南跟随 Panolayer 的 Twitter 示例中的删除帖子 bug。你将阅读该问题,顺着它的说明回到代码,并在决定是否合并之前理解验证摘要。
要跟随操作,请在 试用示例应用 下打开 Twitter Clone。它会以 twitter-starter 打开。完整的设置与修复演练,请参阅用 Panolayer 修复你的第一个 bug。截图展示的是一次录制运行;你看到的问题顺序和数量可能不同。
从问题页面开始
打开代码库后,Panolayer verification engine 就会开始运行。它会将代码库解析到函数、符号和依赖层级,构建可视化架构,并检查代码以找出 bug。
打开 问题。在此示例中,运行已结束,状态显示为 验证完成。需要排查的问题会出现在 需要关注 下。
验证完成描述的是这次运行。 它表示运行已结束;请阅读结果,看是否发现了失败。
阅读删除问题
示例的第一个问题指出,某个条件可能会阻止已确认的删除:
额外的
canDelete守卫会在用户已确认的情况下阻止删除,这与所声明的“删除当前帖子”行为不符。
规则是对函数行为的预期:它应返回什么、应执行什么操作,或其他代码对它有什么期待。这里的预期是:在用户确认后删除当前帖子。
把问题的文件、函数、状态和说明放在一起阅读:
| 你看到的内容 | 它告诉你的信息 |
|---|---|
components/Post.tsx | 包含待排查函数的文件。 |
handleDelete() | 被检查行为的函数。 |
| 失败 | 被检查的行为未满足规则。 |
| 严重程度 3 · 功能 | 问题的严重程度和类别可帮助你确定排查优先级。 |
| 详情 | 说明和源码位置可帮助你理解该问题为何被报告。 |
点击 详情。说明中指出,当 canDelete 为 false 时,函数会在完成规则所述的删除之前提前返回。源码引用指向相关代码。
在决定改动什么之前,先确认规则与预期行为一致。如果预期有误,就修正规则。如果代码有误,就修复代码。改动也可能影响其他文件中的调用方,因此请顺着结果中显示的受影响调用方继续查看。
这些状态分别是什么意思?
阅读状态时,请结合它的说明及其适用的代码。
| 结果 | 如何理解 |
|---|---|
| 通过 | 所评估的规则在受检代码上通过了。这描述的是该规则,而非应用的所有可能行为。 |
| 失败 | 所评估的规则不成立。请阅读说明并检查源码,以确定需要修复什么。 |
| 待处理或运行中 | 结果尚未就绪。请等待检查结束再下结论。 |
| 不可用 | 检查无法完成。请阅读随附的消息,解决所报告的问题后再重新检查。 |
| 未检查 | 该预期尚未被评估。它不属于通过结果。 |
如果验证无法完成,请按照报告的错误处理,并参阅解决设置与 Agent 问题。
修复缺陷,让验证再次运行
在删除相关的问题上,点击 Fix,然后选择 Panolayer Agent。Panolayer 会把该问题的上下文传给 agent,因此你无需编写提示词来解释这个缺陷。
Panolayer Agent 是内置的。你也可以安装其他受支持的 agent 后使用;参见受支持的 agent。
该 agent 在自己的 Git worktree 中工作,其修改与你的分支相互隔离。在 My Agents 中跟踪任务进度,或点击运行卡片上的 Open 查看其活动和改动。
随着代码发生变化,Panolayer 会重新检查受影响的函数以及与之关联的代码,包括其他文件中的调用方。这有助于发现 agent 所改代码行之外的回归问题。
回归是指本次改动引入的新问题。如果验证在修复过程中捕获到回归,agent 可以修复它并再次运行验证,然后再请求合并。因此,一个任务在可供你审查之前,可能会经历多次验证运行。
合并前先阅读验证摘要
本次运行结束后,Panolayer 会显示 Panolayer Agent 已准备好合并。该对话框汇总了任务期间验证检查了什么、修复了什么。
| 摘要字段 | 本次运行 | 含义 |
|---|---|---|
| 已修复的失败 | 1 | 本次工作修复了一个在任务开始前就已存在的失败。 |
| 通过的规则 | 21 项中的 14 项 | 在改动后的代码上,21 条规则中有 14 条通过。请结合健康状态消息和单独列出的既有失败行一起阅读。 |
| 验证运行次数 | 1 | 本次工作期间有 1 次验证运行得出了结果。这里统计的是验证运行次数,而非单个测试或规则。 |
| 变更文件数 | 4 | 该任务改动了 4 个文件。请审查完整的变更集,包括测试和依赖文件。 |
健康状态消息显示 没有新的失败、警告或未检查的规则。 请将该消息与各项计数结合阅读:它描述的是本次工作的结果,而下一行则说明任务开始前就已存在、目前仍然存在的失败。
如果出现“捕获到回归”怎么办?
某些运行还会显示 捕获到回归。它报告验证在工作期间检测到的新问题,有助于阻止这些问题进入目标分支。请阅读最新结果,了解还有哪些问题需要处理;该计数描述的是工作期间的捕获次数,而不是当前尚未解决的失败数量。
此截图中未显示该字段。删除示例展示的是一个已修复的既有失败,并未演示修复过程中捕获到的回归。
Why can it be ready to merge when failures remain?
Panolayer compares the result with the baseline: the state of the codebase before the change. This separates problems introduced by the task from problems that were already there.
- A new failure was introduced by the change and needs investigation before you accept the work.
- A pre-existing failure was present before the task started. It can still matter, but this task did not introduce it.
- A repaired failure was present before the task and was fixed during the work.
In the screenshot, the dialog reports 7 pre-existing failures that do not block this merge. The selected deletion issue was repaired, and those other issues remain separate work.
The repository’s issue list and an agent’s verification summary can cover different scopes. The issue list shows what needs attention in the codebase; the merge summary describes the agent’s work against its baseline. An agent’s result can report no new failures while the repository still has pre-existing issues.
You can assign a pre-existing issue as another task using Fix. That gives the agent a specific issue to work on next.
Ready to merge does not mean every issue in the repository is resolved. Read what this task repaired, what it introduced, and what was already there.
Decide what reaches your branch
You control the merge. Before accepting the result:
- Check that the repaired issue matches the bug you asked the agent to fix.
- Read the verification summary, including any new failures, warnings, or checks that could not finish.
- Open Details for more context and inspect the agent’s changed files. Review the relevant tests and run the application when the behavior needs a runtime check.
- Confirm the target branch. Choose Merge into main when you’re satisfied, or Not now to keep reviewing.
Verification gives you evidence for the decision. Read it alongside the code and relevant tests; it does not cover every possible bug.