Skip to content

feat(routing): implement radix route tree and cache-control policy matrix - #35

Merged
ATLURI0001 merged 1 commit into
mainfrom
feat/route-tree-cache-matrix
Nov 21, 2026
Merged

ATLURI0001 merged 1 commit into
mainfrom
feat/route-tree-cache-matrix

Conversation

@ATLURI0001

Copy link
Copy Markdown
Owner

Technical Deep-Dive & Defensive Hardening

1. Radix Route Tree Routing Engine (src/buildsite/route_tree.py)

  • Trie Traversal Model:
    • Implements a deterministic segment-based trie tree supporting exact static routes, dynamic parameterized segments (:param), and trailing wildcard catch-alls (*wildcard).
    • Strict segment precedence hierarchy:
      $$\text{Exact Static Match} \succ \text{Dynamic Parameter Match} \succ \text{Wildcard Catch-all}$$
    • Backtracking support ensures that if a static branch terminates without a matching route, evaluation seamlessly falls back to valid parameter or wildcard siblings.

2. HTTP Cache-Control Policy Synthesis

  • Policy Directives Matrix (RoutePolicy):
    • STATIC_ASSET: Generates immutable cache headers for hashed content: public, max-age=31536000, immutable.
    • SSG_HTML: Generates CDN-friendly cached headers with stale revalidation: public, max-age=3600, s-maxage=86400, stale-while-revalidate=60.
    • DYNAMIC_API: Strict origin revalidation: no-cache, no-store, must-revalidate.
    • ISR_REVALIDATE: Edge micro-caching with error shielding: public, max-age=60, s-maxage=300, stale-if-error=86400.

3. Defensive URL Sanitization & Path Traversal Guards

  • Normalizes URL paths by stripping query parameters and hash fragments.
  • Defensively detects and blocks path traversal attempts (.. and encoded %2e%2e).
  • Collapses duplicate slashes and normalizes trailing slashes to prevent route ambiguity.

4. Automated Verification & Regression Suite (tests/test_route_tree.py)

  • 80/80 tests passing across all test modules, validating exact matches, precedence ordering, cache header synthesis, traversal rejection, and URL normalization.

@ATLURI0001
ATLURI0001 merged commit d1b5e34 into main Nov 21, 2026
@ATLURI0001
ATLURI0001 deleted the feat/route-tree-cache-matrix branch November 21, 2026 02:15
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