Public v2 endpoints answer 304 before the view runs and cache error responses
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
Read contentcuration/kolibri_public/views.py around metadata_cache and get_last_modified, then inspect the tests for the contentnode and contentnode_tree endpoints. Add coverage for conditional requests, error response cache headers, and unchanged caching on successful responses; done means all listed acceptance criteria pass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
metadata_cache wraps every public v2 endpoint in Django's last_modified, keyed on the newest ChannelMetadata.last_updated across all channels. Django answers a request whose If-Modified-Since is later than that with 304 before the view runs, so a request for a missing node, or with invalid parameters, gets 304 instead of 404 or 400. The decorator also marks error responses public and cacheable for 5 minutes, so a CDN serves them to everyone.
Complexity: Low
Target branch: hotfixes
Context
metadata_cacheandget_last_modifiedapplylast_modified,patch_response_headersandpatch_cache_control(public=True)to every response.- Reproduced:
GET /api/public/v2/contentnode/<nonexistent id>/with anIf-Modified-Sincelater than the newest channel update returns 304. A 404 or 400 response carriesCache-Control: max-age=300, public, stale-while-revalidate=100.
The Change
- A conditional request should get 304 only when the view would otherwise return 200.
- Error responses should not be marked public or cacheable.
Acceptance Criteria
General
- A request for a missing node or with invalid parameters returns its 404 or 400 whatever its
If-Modified-Since. - 4xx and 5xx responses from public v2 endpoints carry no public
Cache-Controlormax-age. - 200 responses keep their current caching headers, and conditional requests for them still get 304.
Testing
- Tests cover each criterion on the contentnode and contentnode_tree endpoints.
AI usage
I scoped the audit. Claude Code found and reproduced these failures and drafted this issue.
- Vorherrschende Sprache
- Python
- Sterne
- 212
- Forks
- 321
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 14
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus learningequality/studio
-
Community library status changes don't update `date_updated`Evtl. vergeben @ArpitaSamanta10 hat das heute übernommen. Offencommunity-contribution-in-progress DEV: backend good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
learningequality/studio#6414 · 8 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
learningequality/studio#6410 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
learningequality/studio#6409 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/studio#6407 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Stripe webhook accepts events when no webhook secret is configuredEvtl. vergeben @adibmbrk hat das heute übernommen. Offencommunity-contribution-in-progress DEV: backend good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/studio#6404 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in learningequality/studio
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
canonical/paas-charm#407 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 5 Tagen
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
FAIRmat-NFDI/pynxtools-spm#136 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement tooling
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
`read_nexus` entry point points to a function that no longer existsEvtl. vergeben @RubelMozumder hat das heute übernommen. Offenannotator bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
FAIRmat-NFDI/pynxtools#876 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: HTTP 499 (Client Closed Request) is classified as a non-retryable format_error, so a mid-flight abort fails the turn over instead of retryingEvtl. vergeben @yipinghuang1991 hat das heute übernommen. Offencomp/agent P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
NousResearch/hermes-agent#156837 ·
Maintainer antworten meist innerhalb von 1 Tag