Split request handling into focused modules - #1847
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe request entrypoint now delegates to dedicated request-processing and application-routing modules. New helpers cover buffering, tracking redirects, setup paths, custom CSS responses, and read-only enforcement. Tests add coverage for routing, request errors, response behavior, session keys, and security headers. ChangesRequest routing refactor
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant handleRequest
participant processRequest
participant routeMainApp
participant prefixHandlers
Client->>handleRequest: submit request
handleRequest->>processRequest: process request in request scope
processRequest->>routeMainApp: route prepared request
routeMainApp->>prefixHandlers: dispatch matching prefix
prefixHandlers-->>processRequest: return response or null
processRequest-->>Client: finalize response
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/app/read-only.ts`:
- Around line 49-72: Refactor readOnlyBlock into an ordered declarative rule
table, following the repository’s precedence-table convention and preserving the
current matching order and return values. Define shared rule representations for
the conditions and outcomes, then have readOnlyBlock evaluate the table
sequentially rather than using the existing if-chain, including the default
null/page behavior for unmatched methods and paths.
In `@src/features/app/routes.ts`:
- Around line 279-283: Update the prefix handler invocation in the route
dispatch flow to replace optional chaining with the documented non-null
assertion after Object.hasOwn confirms the handler exists. Preserve the existing
notFoundResponse fallback for handler results that are nullish, while ensuring
an invalid routing-table state fails loudly.
In `@test/features/app/request.test.ts`:
- Around line 26-35: Update the “rejects a body-bearing POST with no content
type” test to use a binary Uint8Array body so Request does not synthesize a
Content-Type header. Assert the constructed request’s content-type header is
null before passing it to handleRequest, while preserving the existing 400
status and error-text assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 338c5b28-3d46-4b71-ac4d-0604291f1e00
📒 Files selected for processing (20)
BUSINESS_LOGIC_TODOS.mddocs/external-order-library.mdscripts/mutation/equivalent-mutants.txtsrc/features/app/read-only.tssrc/features/app/request.tssrc/features/app/routes.tssrc/features/app/rules.tssrc/features/auth.tssrc/features/index.tssrc/shared/db/settings-audit.tstest/features/app/read-only.test.tstest/features/app/request.test.tstest/features/app/routes.test.tstest/features/app/rules.test.tstest/features/index.test.tstest/features/response.test.tstest/features/router.test.tstest/integration/routes/read-only.test.tstest/lib/server-misc-routing.test.tstest/shared/session-private-key.test.ts
💤 Files with no reviewable changes (2)
- test/lib/server-misc-routing.test.ts
- test/integration/routes/read-only.test.ts
Summary
Checks
deno task typecheckdeno task lint:cideno task cpddeno task build:edgedeno task unit-tests-reportThe full test suite, precommit task, and mutation tests were not run, as requested for this time-sensitive refactor.
Summary by CodeRabbit