Skip to content

Commit 1f991b3

Browse files
committed
Fix CodeQL warnings on CI
1 parent 23ec57b commit 1f991b3

8 files changed

Lines changed: 39 additions & 9 deletions

File tree

.github/copilot-instructions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ You are working in Newsletter Maker, a Django + DRF + Celery + Qdrant backend wi
4545
- TypeScript and React code should use JSDoc for exported utilities, hooks, route handlers, and non-trivial components when behavior is not obvious from the type signature alone.
4646
- If architecture or workflow behavior changes, update the most relevant docs in `docs/`, especially `docs/DEVELOPER_GUIDE.md`, `docs/IMPLEMENTATION_OVERVIEW.md`, `docs/MODELS.md`, `docs/RELEVANCE_SCORING.md`, or `docs/LOGGING.md`.
4747

48+
## Prompt Skill Conventions
49+
50+
- Application prompt skills live under `skills/<skill_name>/SKILL.md` and are loaded by `core/llm.py` using the folder name rather than the frontmatter `name`.
51+
- When adding or editing one of these prompt skills, always include a short frontmatter `description` so VS Code does not report incomplete skill metadata.
52+
- If a frontmatter `name` is present, prefer lowercase letters, numbers, and hyphens there to satisfy the Copilot markdown validator, even when the runtime skill key elsewhere in the app still uses underscores.
53+
4854
## Testing And Validation
4955

5056
- Backend tests use `pytest`.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: "Prompt Skill Markdown Guidelines"
3+
description: "Use when editing application prompt skills in skills/**/SKILL.md. Covers custom frontmatter, runtime lookup behavior, and keeping VS Code's skill validator quiet."
4+
applyTo:
5+
- "skills/**/SKILL.md"
6+
---
7+
8+
# Prompt Skill Markdown Guidelines
9+
10+
- Files under `skills/**/SKILL.md` are application prompt specs loaded by `core/llm.py`, not Copilot repo skills under `.github/skills/`.
11+
- The runtime skill key is the folder name, so keep folder names and code constants aligned with the app's expected key.
12+
- Always include a short frontmatter `description` to avoid VS Code skill-schema warnings.
13+
- If a frontmatter `name` is present, prefer lowercase letters, numbers, and hyphens so the Copilot validator stays quiet, even when the runtime key elsewhere in the app uses underscores.
14+
- Preserve the repo's `input` and `output` frontmatter fields because `core/llm.py` reads them to build prompts.
15+
- Keep the body concise and instruction-focused. Return-shape requirements should stay explicit in the markdown body.

core/permissions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
class PermissionBase:
1414
"""Typed shim for DRF permissions whose default methods return bool."""
1515

16-
def has_permission(self, request, view) -> bool: ...
16+
def has_permission(self, request, view) -> bool:
17+
pass
1718

18-
def has_object_permission(self, request, view, obj) -> bool: ...
19+
def has_object_permission(self, request, view, obj) -> bool:
20+
pass
1921

2022
else:
2123
PermissionBase = permissions.BasePermission

newsletters/intake.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
class QueuedTask(Protocol):
2525
"""Protocol for Celery tasks used by newsletter intake dispatch."""
2626

27-
def apply(self, *args: object, **kwargs: object) -> object: ...
27+
def apply(self, *args: object, **kwargs: object) -> object:
28+
pass
2829

29-
def delay(self, *args: object, **kwargs: object) -> object: ...
30+
def delay(self, *args: object, **kwargs: object) -> object:
31+
pass
3032

3133

3234
def _require_pk(instance: Model) -> int:

newsletters/tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
class DelayedTask(Protocol):
1616
"""Protocol for Celery tasks dispatched through ``delay``."""
1717

18-
def delay(self, *args: object, **kwargs: object) -> object: ...
18+
def delay(self, *args: object, **kwargs: object) -> object:
19+
pass
1920

2021

2122
def _enqueue_task(task: object, *args: object) -> None:

projects/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from django.conf import settings
66
from django.core.mail import send_mail
7-
from django.db.models import QuerySet
87
from django.utils import timezone
98
from drf_spectacular.utils import OpenApiResponse, extend_schema, inline_serializer
109
from rest_framework import mixins, serializers, status, viewsets

trends/api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ def accept(self, request, *args, **kwargs):
233233
try:
234234
accept_theme_suggestion(suggestion, user_id=request.user.id)
235235
except ValueError as exc:
236-
raise serializers.ValidationError({"status": str(exc)}) from exc
236+
raise serializers.ValidationError(
237+
{"status": "Unable to accept this theme suggestion."}
238+
) from exc
237239
suggestion = self.get_queryset().get(pk=suggestion.pk)
238240
serializer = self.get_serializer(suggestion)
239241
return Response(serializer.data)
@@ -266,7 +268,9 @@ def dismiss(self, request, *args, **kwargs):
266268
reason=serializer.validated_data["reason"],
267269
)
268270
except ValueError as exc:
269-
raise serializers.ValidationError({"status": str(exc)}) from exc
271+
raise serializers.ValidationError(
272+
{"status": "Unable to dismiss this theme suggestion."}
273+
) from exc
270274
response_serializer = self.get_serializer(suggestion)
271275
return Response(response_serializer.data)
272276

users/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
class DelayedTask(Protocol):
2727
"""Protocol for Celery tasks dispatched through ``delay``."""
2828

29-
def delay(self, *args: object, **kwargs: object) -> object: ...
29+
def delay(self, *args: object, **kwargs: object) -> object:
30+
pass
3031

3132

3233
def _enqueue_task(task: object, *args: object) -> None:

0 commit comments

Comments
 (0)