remove_page_from_job

Permanently remove a page and all its data from a cloning job

Overview

Hard-delete a single page from a cloning job when it no longer exists on the source site. Removes all child rows (issues, comparison results, lens data, junction table entries) and performs best-effort cleanup of any files stored in B2 (HTML snapshots, screenshots, videos, diff images). The operation is permanent and irreversible. Use discover_all_pages with its built-in discover_then_delete mode for bulk removal.

How It Works

  1. Looks up the page by source URL across all of the current user's cloning jobs.
  2. Returns not_found if the URL is not tracked — the call is safe to make speculatively.
  3. Collects all B2 file keys for the page (HTML, screenshots, videos, diff images) and deletes them on a best-effort basis before opening the DB transaction.
  4. Opens a single transaction and cascades: issue sub-tables → issues → lens sub-tables → page_compare_lens → page_compare → junction tables (page_stylesheet_page, route_page_a, content_type_field_page, content_type_page) → page.
  5. Returns removed: true plus page_id, source_url, and job_id on success.

Input Parameters

ParameterTypeRequiredDescription
source_url string required URL of the source (original) page to remove

What You Get Back

Example Use Case

A source page returned 404 on re-compare and is confirmed gone. Call remove_page_from_job with the source URL to hard-delete it and stop it surfacing in get_next_actionable_page.

Tips

The call is idempotent for the not_found path — calling it twice on the same URL is safe.
Job-level tables (shared_page_element, design_system, route, content_type, page_stylesheet) are not affected — only per-page rows and junction table entries are removed.
B2 cleanup is best-effort. If cleanup fails the DB transaction still commits and the page is deleted.
For removing many stale pages at once, use discover_all_pages — it has a built-in discover_then_delete mode that re-crawls and removes pages no longer on the source site.
After removal, run_full_comparison and get_next_actionable_page will naturally exclude the deleted page.

Related Tools