Both lifecycle paths duplicated cleanup instead of routing through CrTeardownService.remove(), so they skipped job cancellation, process kill, workspace cleanup, event emission, and unlinking.
Ejemplo de informe de auditoría de código
Un extracto en inglés basado en el análisis de una base de código interna. Muestra la evidencia, cómo se prioriza un hallazgo y qué incluye la corrección propuesta.
Extracto Representativo
Both resetProject() and purgeProject() bypassed the canonical teardown seam, duplicating ad-hoc cleanup that skipped job cancellation, agent process termination, workspace cleanup, event emission, and CodeStudy unlinking. Project-owned records could survive reset, and running jobs could continue against deleted change requests.
Consolidate project lifecycle cleanup through canonical CR teardown: route both resetProject() and purgeProject() through CrTeardownService.remove(), then run one project-scoped sweep for the remaining project-owned data.
The UI promised an initial-state reset, but Features, Ideas, Initiatives, CodeStudies, BusinessRules, and KnowledgeDocuments survived and polluted future planning runs.
Bypassing teardown allowed BullMQ jobs and long-running agent processes to continue operating against deleted change requests on two user-facing flows.
This approach replaces two hand-curated cleanup matrices with one canonical seam. A point fix on resetProject() alone would leave the same orphan and process-residue risk on the delete-project path.
- Harden RuntimeSession/Event projectId ownership for orphan prevention
- Add CodeStudy {status, updatedAt} indexes for stuck-study scanning
- Add Spec dependency indexes for graph maintenance