• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

liqd / roots / 26236818915

21 May 2026 03:47PM UTC coverage: 80.383% (+0.1%) from 80.274%
26236818915

push

github

web-flow
[ST-2214] Add more Information to Sentry Error + Solve absolute Url Bug

12 of 27 new or added lines in 5 files covered. (44.44%)

2 existing lines in 2 files now uncovered.

7474 of 9298 relevant lines covered (80.38%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.38
/apps/projects/utils.py
1
"""Shared utilities for the projects app."""
2

3
import json
1✔
4
import logging
1✔
5

6
from sentry_sdk import capture_exception
1✔
7

8
from apps.contrib.models import Settings
1✔
9
from apps.summarization.export_utils.attachments.handlers import (
1✔
10
    collect_document_attachments,
11
)
12
from apps.summarization.export_utils.attachments.handlers import (
1✔
13
    integrate_document_summaries,
14
)
15
from apps.summarization.export_utils.core import generate_full_export
1✔
16
from apps.summarization.pydantic_models import ProjectSummaryResponse
1✔
17
from apps.summarization.sentry_tags import set_sentry_project_tags
1✔
18
from apps.summarization.services import AIService
1✔
19

20
logger = logging.getLogger(__name__)
1✔
21

22

23
def generate_project_summary(
1✔
24
    project, request=None, base_url=None, *, allow_regeneration=True
25
):
26
    """
27
    Generate AI summary for a project. Used by the view and by the periodic Celery task.
28

29
    Args:
30
        project: Project instance.
31
        request: Optional Django request (for document absolute URLs). If None, base_url is used.
32
        base_url: Optional base URL (e.g. settings.WAGTAILADMIN_BASE_URL) when request is None.
33

34
    Returns:
35
        ProjectSummaryResponse from the AI service.
36

37
    Raises:
38
        Exception: Re-raises any exception from the AI service (caller handles display/retry).
39
    """
NEW
40
    set_sentry_project_tags(project)
×
41

UNCOV
42
    export_data = generate_full_export(project)
×
43

44
    if request is not None or base_url:
×
45
        documents_dict, handle_to_source = collect_document_attachments(
×
46
            export_data, request=request, base_url=base_url
47
        )
48
        if documents_dict:
×
49
            try:
×
50
                service = AIService()
×
51
                document_response = service.request_vision_dict(
×
52
                    documents_dict=documents_dict,
53
                    project=project,
54
                )
55
                integrate_document_summaries(
×
56
                    export_data,
57
                    document_response.documents,
58
                    handle_to_source,
59
                )
60
            except Exception as e:
×
61
                logger.error(
×
62
                    "Failed to summarize documents for project %s: %s",
63
                    project.slug,
64
                    e,
65
                    exc_info=True,
66
                )
67
                capture_exception(e)
×
68

69
    json_text = json.dumps(export_data, indent=2)
×
70
    prompt = Settings.get_value("project_summary_prompt")
×
71
    service = AIService()
×
72
    response = service.project_summarize(
×
73
        project=project,
74
        text=json_text,
75
        result_type=ProjectSummaryResponse,
76
        prompt=prompt,
77
        allow_regeneration=allow_regeneration,
78
    )
79
    return response
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc