social-reporting-tool/v2/operator-app
DJP 404425a06e Add Cancel button + POST /api/reports/:id/cancel route
The run page now has a Cancel button next to the status pill while a
pipeline is non-terminal. Clicking it (after a confirm prompt) hits
POST /api/reports/:id/cancel, which marks the row as failed with
"Cancelled by <email>" and SIGTERMs the spawned tsx child's whole
process group — so the Claude CLI subshell, ffmpeg, and Apify-poll
loops all stop together rather than orphaning.

Implementation notes:
- Replaced runningReportId with runningChild that holds the child handle
- Removed child.unref() so we can manage it. Pulled both the run and
  retry spawn paths into a single spawnPipeline() helper to avoid drift
- Mark the row before sending the signal so the spawn-exit handler's
  COALESCE doesn't overwrite "Cancelled by" with "killed by SIGTERM"
- Cancel from a different server process (e.g. after a server restart)
  returns 409 with a hint that the child handle is no longer in scope —
  the user can mark it failed manually if needed

Already-completed stages are preserved on disk via .state sentinels, so
"Cancel + edit brief + Force re-run" works without re-spending on
finished stages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 21:48:40 -04:00
..
public Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
src Add Cancel button + POST /api/reports/:id/cancel route 2026-04-29 21:48:40 -04:00
.env.example Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
.gitignore Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
index.html Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
package.json Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
postcss.config.js Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
tailwind.config.ts Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
tsconfig.json Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
tsconfig.node.json Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
vite.config.ts Wire SPA + SSO redirect URI to /social-reports/ prefix; in-place cutover script 2026-04-29 18:40:38 -04:00