Skip to content

feat(mapper): preserve Django include route prefixes#103

Merged
steipete merged 4 commits into
openclaw:mainfrom
rohitjavvadi:feat/django-include-route-prefixes
May 22, 2026
Merged

feat(mapper): preserve Django include route prefixes#103
steipete merged 4 commits into
openclaw:mainfrom
rohitjavvadi:feat/django-include-route-prefixes

Conversation

@rohitjavvadi
Copy link
Copy Markdown
Contributor

Summary

  • compose literal Django include("module.urls") child routes with their mount prefix
  • avoid emitting included child urls.py routes as standalone root routes
  • cover nested literal includes, mounted tests, and unmounted child route suppression

Why

Django projects commonly split route declarations across package-level urls.py files. Previously, routes under path("api/", include("api.urls")) could be surfaced as bare child paths such as /users/:pk/, which loses the actual public route shape.

Tests

  • ./node_modules/.bin/vitest run src/mapper.test.ts -t 'Django urls.py routes'
  • ./node_modules/.bin/vitest run src/mapper.test.ts
  • ./node_modules/.bin/tsc -p tsconfig.json --noEmit
  • ./node_modules/.bin/oxlint . --config oxlint.json
  • ./node_modules/.bin/oxfmt --check src/mappers/python.ts src/mapper.test.ts
  • git diff --check
  • ./node_modules/.bin/vitest run
  • ./node_modules/.bin/tsc -p tsconfig.build.json

@rohitjavvadi rohitjavvadi requested a review from a team as a code owner May 21, 2026 17:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e7dba1a17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/mappers/python.ts Outdated
return prefix;
}
return normalizeDjangoRoutePath(
`${prefix.replace(/^\/+|\/+$/gu, "")}/${route.replace(/^\/+/u, "")}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect slashless include prefixes when composing routes

When expanding include(...) routes, this join always inserts a / between prefix and child, which mis-models valid Django patterns like path('api', include('app.urls')): Django concatenates the remaining URL directly, so child path('users/', ...) resolves under /apiusers/, not /api/users/. With the current logic, mapped feature routes can be incorrect whenever the parent include omits a trailing slash, which affects route accuracy and any downstream trust-boundary/test association tied to the generated path.

Useful? React with 👍 / 👎.

@rohitjavvadi
Copy link
Copy Markdown
Contributor Author

Addressed in 12a7be1: Django include path composition now preserves slashless path() semantics, so path(api, include(...)) maps concatenated child routes without an inserted separator. Added regression coverage for nested slashless includes.

@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 22, 2026

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(mapper): preserve Django include route prefixes This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete steipete merged commit 6b76a3a into openclaw:main May 22, 2026
6 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.

2 participants