2.3 KiB
2.3 KiB
Post-Delegation Audit Pattern
After subagents build spq-v2 pages, dispatch a second wave of auditing subagents before considering the work done.
Why
Subagent-generated code consistently has these issues that won't surface until runtime:
- Missing
onClickhandlers on buttons (text rendered, no action) - AI function signature mismatches between
src/lib/ai.tsand page code - Wrong PocketBase collection names (underscore vs camelCase)
sort: '-created'on collections lacking system date fieldsuseToastcalls withoutToastProviderwrapping the route tree- Empty state / error state / loading state transitions that swallow errors
How
Dispatch 3 auditing subagents in parallel, each covering 2-3 pages:
delegate_task tasks=[
{ goal: "Audit Dashboard + QuoteGenerator + Settings against originals", toolsets: ["file","terminal"] },
{ goal: "Audit Customers + RepairOrders + Appointments against originals", toolsets: ["file","terminal"] },
{ goal: "Audit FinancialDashboard + Invoices + Settings against originals", toolsets: ["file","terminal"] },
]
Each auditor must:
- READ the original v1 source files
- READ the spq-v2 page files
- Test PocketBase API calls at
http://127.0.0.1:8091(login: demo@shop.com/test1234) - Compare every feature, UI element, and API call
- Fix every bug found (they have
filetoolset to edit code) - Verify fixes with actual API calls
Common Root Causes Found
| Symptom | Root Cause | Fix |
|---|---|---|
| "Something went wrong" on Dashboard | sort: '-created' on quotes collection missing created field |
Change to sort: '-id' |
| "Something went wrong" on Financial | Same -created issue on repairOrders collection |
Change to sort: '-id' |
| "Something went wrong" on RepairOrders | Querying repair_orders but collection is repairOrders |
Fix collection name |
| Custom service add does nothing | Button has no onClick handler |
Add handler that creates service and calls handleAdd() |
| AI Write/Generate Priorities fail silently | Function signature mismatch between page code and ai.ts |
Align call signatures |
| White screen on page load | useToast called without ToastProvider |
Wrap <Routes> in <ToastProvider> |
Verification
After auditors finish, rebuild (npx vite build), restart the proxy server, and test every page in the browser.