refactor: extract route middleware helpers (ARC-5)#1705
Merged
OneStepAt4time merged 1 commit intodevelopfrom Apr 12, 2026
Merged
refactor: extract route middleware helpers (ARC-5)#1705OneStepAt4time merged 1 commit intodevelopfrom
OneStepAt4time merged 1 commit intodevelopfrom
Conversation
- Add registerWithLegacy() to register both /v1/ and legacy paths in one call - Add withOwnership() wrapper to eliminate inline requireOwnership checks - Add withValidation() wrapper for Zod body parsing (available for future use) - Apply to 20 dual-registration sites across session-actions, session-data, sessions, and health route modules - Convert 15 inline ownership checks to withOwnership wrapper - Remove dead rate limit code from server.ts (RATE_LIMITS, createRateLimitPreHandler, 8 unused preHandler variables) - Net reduction: 49 lines of boilerplate Closes #1698
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts three route middleware helpers into \src/routes/context.ts\ and applies them across route modules, eliminating boilerplate from dual-registration and inline ownership checks.
Changes
egisterWithLegacy()* β registers both /v1/...\ and legacy /...\ paths in one call
Impact
equireOwnership\ checks replaced with \withOwnership\ wrapper
Quality Gate
px tsc --noEmit\ β
pm run build\ β
pm test\ β (159 files, 2814 tests pass)
Aegis version
Developed with: v0.3.2-alpha
Closes #1698