Skip to content

fix(routing): render /affiliations and route 404 via worker template engine - #89

Open
tarunagnihotri534 wants to merge 1 commit into
alphaonelabs:mainfrom
tarunagnihotri534:fix/affiliations-and-404-template-render
Open

tarunagnihotri534 wants to merge 1 commit into
alphaonelabs:mainfrom
tarunagnihotri534:fix/affiliations-and-404-template-render

Conversation

@tarunagnihotri534

Copy link
Copy Markdown

Fixes #88

Problem

  1. /affiliations served raw template syntax:
    • In wrangler.toml, run_worker_first was missing "/affiliations".
    • In src/worker.py, STATIC_CLEAN_ROUTES was missing "/affiliations": "/affiliations.html".
    • As a result, requests to /affiliations bypassed worker template rendering and directly returned the unrendered static template file containing {% extends "base.html" %}.
  2. 404 routes served raw unrendered template code:
    • In wrangler.toml, not_found_handling = "404-page" caused Cloudflare Assets to directly return static public/404.html without running worker rendering logic.
    • In src/worker.py, render_404() rendered template tags but did not inline <div id="site-navbar"></div> and <div id="site-footer"></div> partials.

Fix

  • wrangler.toml:
    • Added "/affiliations" to run_worker_first.
    • Changed not_found_handling = "none" so unknown routes fall through to the Worker dispatcher to be rendered by render_404().
  • src/worker.py:
    • Added "/affiliations": "/affiliations.html" to STATIC_CLEAN_ROUTES.
    • Inlined navbar and footer partials in render_404() to provide full consistent styling on error pages.
  • tests/test_dispatcher.py:
    • Added test_affiliations_clean_route_serves_page() verifying /affiliations resolves and serves 200.
    • Added test_missing_file_renders_404_template_without_raw_tags() verifying 404 responses render template tags properly.

Verification

  • Ran python -m py_compile src/worker.py (clean exit, code 0).
  • Ran pytest tests/test_dispatcher.py -k TestStaticFileServing (6/6 tests passed).
  • Ran npx wrangler deploy --dry-run (76 assets read, bundled successfully, exit code 0).

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e09f13e5-fddd-4363-a9a5-11a5cc6f68c9
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

[Bug] /affiliations and 404 error handler serve raw unrendered Django/Jinja template source code

1 participant