fix(api): route Paperclip title-sync/webhooks through the Port — 500 on case rename (INV-G12)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s

PUT /api/cases/{n} crashed with 500 (NameError: 'paperclip_client' is
not defined) whenever the title changed. The G12 platform-port refactor
dropped the `paperclip_client`/`paperclip_api` module imports from
app.py but left three call sites still referencing the old module names:

  - app.py:2096  paperclip_client.update_project_name  (title sync → fires on every rename)
  - app.py:3806  paperclip_api.emit_export_complete_webhook
  - app.py:7390  paperclip_api.emit_missing_precedent_webhook

All three are background_tasks, so the latter two were latent NameErrors
waiting to fire. Expose the three functions through agent_platform_port
(the single Paperclip seam) and call them via the Port, restoring G12.

Invariants: upholds INV-G12 (all Paperclip access via agent_platform_port).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-14 08:37:51 +00:00
parent 6fc87de1c5
commit e2c94144d0
2 changed files with 14 additions and 3 deletions

View File

@@ -28,6 +28,8 @@ from __future__ import annotations
# ── the Paperclip shell — imported ONLY here (the Port is the single seam) ──
from web.paperclip_api import (
emit_case_status_webhook,
emit_export_complete_webhook,
emit_missing_precedent_webhook,
pc_request,
require_paperclip_db_url,
)
@@ -52,6 +54,7 @@ from web.paperclip_client import (
reset_agent_session as pc_reset_agent_session,
respond_to_interaction as pc_respond_to_interaction,
restore_project as pc_restore_project,
update_project_name as pc_update_project_name,
wake_analyst_for_appraiser_facts as pc_wake_analyst_for_appraiser_facts,
wake_ceo_agent as pc_wake_ceo,
wake_ceo_for_feedback_fold as pc_wake_ceo_for_feedback_fold,
@@ -63,6 +66,7 @@ from web.paperclip_client import (
archive_case_project = pc_archive_project
restore_case_project = pc_restore_project
create_case_project = pc_create_project
rename_case_project = pc_update_project_name
notify_case_status = emit_case_status_webhook
__all__ = [
@@ -75,11 +79,15 @@ __all__ = [
"archive_case_project",
"restore_case_project",
"create_case_project",
"rename_case_project",
"notify_case_status",
"emit_case_status_webhook",
"emit_export_complete_webhook",
"emit_missing_precedent_webhook",
"pc_archive_project",
"pc_restore_project",
"pc_create_project",
"pc_update_project_name",
# issues / workflow
"pc_create_workflow_issue",
"pc_get_case_issues",