跟著 Twitter 範例操作
本指南以 Panolayer 的 Twitter 範例中的貼文刪除錯誤為例。你將閱讀問題、循著說明回到程式碼,並在決定是否合併前理解驗證摘要。
若要跟著操作,請在試用範例應用程式下開啟 Twitter Clone。它會以 twitter-starter 開啟。完整的設定與修正逐步說明,請參閱使用 Panolayer 修正你的第一個錯誤。螢幕擷取畫面顯示的是某一次錄製的執行結果;你的問題順序與數量可能不同。
從問題頁面開始
當你開啟程式碼庫時,Panolayer Verification Engine 便開始執行。它會將程式碼庫解析到函式、符號與相依性層級,建立視覺化架構,並檢查程式碼以找出錯誤。
開啟問題。在此範例中,執行已完成,狀態顯示為驗證完成。需要調查的問題會列在需要關注底下。
驗證完成描述的是該次執行。 這表示執行已結束;請閱讀結果,確認是否找到失敗。
閱讀刪除問題
此範例的第一個問題指出,某個條件可能會阻止已確認的刪除:
多餘的
canDelete防護可能會在使用者已確認的情況下阻止刪除,與所述「刪除目前貼文」的行為不符。
規則是對函式行為的預期:它應該回傳什麼、應該執行什麼動作,或其他程式碼對它的期待。這裡的預期是:使用者確認後刪除目前貼文。
請將問題的檔案、函式、狀態與說明一起閱讀:
| 你看到的內容 | 它告訴你什麼 |
|---|---|
components/Post.tsx | 包含待調查函式的檔案。 |
handleDelete() | 行為已受檢查的函式。 |
| 失敗 | 受檢查的行為未符合規則。 |
| 嚴重度 3 · 功能 | 問題的嚴重度與類別可協助你排定調查優先順序。 |
| 詳細資料 | 說明與原始碼位置可協助你了解問題被回報的原因。 |
按一下詳細資料。說明指出,當 canDelete 為 false 時,函式可能會提前回傳,而未完成規則所述的刪除。原始碼參照會指向相關程式碼。
在決定要變更什麼之前,先確認規則符合預期的行為。若預期有誤,請修正規則。若程式碼有誤,請修正程式碼。變更也可能影響其他檔案中的呼叫端,因此請循著結果中顯示的受影響呼叫端追查。
這些狀態代表什麼?
請將狀態與其說明及所套用的程式碼一起閱讀。
| 結果 | 如何解讀 |
|---|---|
| 通過 | 受檢查的程式碼通過了所評估的規則。這描述的是該規則,而非應用程式所有可能的行為。 |
| 失敗 | 所評估的規則不成立。請閱讀說明並檢查原始碼,以決定需要修正什麼。 |
| 待處理或執行中 | 結果尚未就緒。請等待檢查完成後再下結論。 |
| 無法使用 | 檢查無法完成。請閱讀隨附訊息並解決回報的問題,然後再檢查一次。 |
| 未檢查 | 該預期尚未被評估。這不是通過的結果。 |
若驗證無法完成,請依照回報的錯誤處理,並參閱解決設定與代理程式問題。
修正錯誤,讓驗證再次執行
在刪除相關的 issue 上,按一下 修正,然後選擇 Panolayer Agent。Panolayer 會把 issue 的脈絡傳遞給 agent,因此你不需要自行撰寫提示來說明這個錯誤。
Panolayer Agent 是內建的。你也可以安裝其他支援的 agent 後再使用;請參閱支援的 agent。
Agent 會在自己的 Git worktree 中作業,讓它的編輯與你的分支保持分開。在 我的 Agent 中追蹤任務,或按一下執行卡片上的 開啟 來檢視它的活動與變更。
隨著程式碼變更,Panolayer 會再次檢查受影響的函式與相連的程式碼,包括其他檔案中的呼叫端。這有助於捕捉 agent 編輯範圍之外的迴歸問題。
迴歸是指這次變更所引入的新問題。若驗證在修正過程中捕捉到迴歸,agent 可以修復它並再次執行驗證,然後才請求合併。因此,一個任務在可供你審查之前,可能會經歷多次驗證執行。
合併前先閱讀驗證摘要
當這次執行完成後,Panolayer 會顯示 Panolayer Agent 已可合併。對話框會摘要說明驗證在任務期間檢查與修復了什麼。
| 摘要欄位 | 這次執行 | 代表意義 |
|---|---|---|
| 已修復的失敗 | 1 | 這項工作修復了任務開始前就已存在的失敗。 |
| 通過的規則 | 21 條中的 14 條 | 在變更的程式碼上,21 條規則中有 14 條通過。請搭配健康狀態訊息與另外列出的既有失敗那一行一起解讀。 |
| 驗證執行次數 | 1 | 這項工作期間有 1 次驗證執行得出結果。這裡計數的是驗證執行次數,而非個別測試或規則。 |
| 變更的檔案 | 4 | 此任務變更了 4 個檔案。請審查完整的變更集,包括任何測試與相依性檔案。 |
健康狀態訊息顯示 沒有新的失敗、警告或未檢查的規則。 請將該訊息與各項計數一起解讀:它描述的是這項工作的結果,而下一行則說明自工作開始前即已存在的失敗。
如果出現「捕捉到的迴歸」怎麼辦?
有些執行也會顯示 捕捉到的迴歸。它回報驗證在工作期間偵測到的新問題,有助於將這些問題擋在目標分支之外。請閱讀最新結果以了解還有什麼需要處理;這個計數描述的是工作期間捕捉到的次數,而非目前尚未解決的失敗數。
此欄位未顯示於這張截圖中。刪除範例顯示的是 1 個已修復的既有失敗;它並未示範在修正期間捕捉到的迴歸。
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.