Skip to content

fix: 404 page returns 404, not 200 or a traceback-less 500 - #1077

Merged
japsu merged 1 commit into
mainfrom
fix/404-page-post
Sep 30, 2026
Merged

japsu merged 1 commit into
mainfrom
fix/404-page-post

Conversation

@japsu

@japsu japsu commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

feedback_context bound FeedbackForm to request.POST on every POST, so an
unparsable multipart body (e.g. Next.js server action scanners) raised
MultiPartParserError inside handler404. Django swallows exceptions from
error handlers and returns a bare 500, logged without a traceback. The
feedback widget submits to /feedback, which binds the form itself, so the
context processor now always provides an unbound form.

not_found_view also rendered with the default status 200.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Summary by CodeRabbit

  • Bug Fixes
    • Requests for pages that don’t exist now receive a clear “Not Found” response with the correct 404 status, helping browsers and other services handle missing pages appropriately.

feedback_context bound FeedbackForm to request.POST on every POST, so an
unparsable multipart body (e.g. Next.js server action scanners) raised
MultiPartParserError inside handler404. Django swallows exceptions from
error handlers and returns a bare 500, logged without a traceback. The
feedback widget submits to /feedback, which binds the form itself, so the
context processor now always provides an unbound form.

not_found_view also rendered with the default status 200.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 82601d77-3dd2-483b-8651-30aaa4c849d5

📥 Commits

Reviewing files that changed from the base of the PR and between 3377c78 and 6e54a65.

📒 Files selected for processing (2)
  • kompassi/access/views/error_views.py
  • kompassi/feedback/context_processors.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The not-found view now sets the response status to 404. The feedback context processor now constructs FeedbackForm directly and no longer imports or calls initialize_form.

Changes

Not-found response status

Layer / File(s) Summary
Set the not-found response status
kompassi/access/views/error_views.py
The not-found view passes status=404 to render.

Feedback form construction

Layer / File(s) Summary
Construct the feedback form
kompassi/feedback/context_processors.py
feedback_context returns a newly constructed FeedbackForm instead of calling initialize_form. The initialize_form import was removed.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6e54a

The changes address the intended 404 and feedback-form behavior without an identified regression; no merge-blocking risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 6e54a

The change affects 1 system.

Changed systems: kompassi

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — kompassi (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in kompassi/access/views/error_views.py: not_found_view now passes status=404 to render.
  • observed — Modified behavior in kompassi/feedback/context_processors.py: feedback_context no longer calls initialize_form(FeedbackForm, request); it returns a newly constructed FeedbackForm directly. The initialize_form import was removed.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary changes: the 404 page now returns HTTP 404, and the feedback form change prevents a traceback-less 500 during 404 handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@japsu
japsu merged commit c3c510f into main Sep 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant