Skip to content

fix(routing): replace the drifted route tables with a single registry - #583

Merged
kRamu81 merged 3 commits into
kRamu81:mainfrom
MOHITKOURAV01:fix/spa-route-registry
Jul 30, 2026
Merged

fix(routing): replace the drifted route tables with a single registry#583
kRamu81 merged 3 commits into
kRamu81:mainfrom
MOHITKOURAV01:fix/spa-route-registry

Conversation

@MOHITKOURAV01

@MOHITKOURAV01 MOHITKOURAV01 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #575.

Route information lived in three hand-maintained places that had to be edited together:

  1. the routeMap object in src/App.jsx — URL slug → page key
  2. the switch in src/routes/AppRoutes.jsx — page key → component + role guard
  3. the import list above that switch — page key → module

Nothing kept them consistent, and they had drifted badly.

Stacked on #578. main does not build at all, so this branch includes that fix to be
verifiable. Review the second commit; the diff collapses to it once #578 merges.

What was broken

Two components rendered without ever being imported. AppRoutes.jsx imported
SecurityKeyVaultPage but rendered KeyVaultSecurityPage; MicrosegmentationPage was not
imported under any name. Both are uncaught ReferenceErrors that the ErrorBoundary turns into a
blank screen on /keyvault and /microsegmentation.

Four route keys declared twice, so the second was dead.

case "keyvault-security":
case "keyvault":
case "keyvault-security":     // unreachable

case "microsegmentation" appeared once under the ZTNA group and again under the SDP group. The
first wins, so MicrosegmentationPage was unreachable and /microsegmentation silently rendered
ZeroTrustNetworkPage.

In App.jsx's routeMap, help was declared twice and microsegmentation twice with different
targets
("ztna" and "microsegmentation"). In an object literal the last wins silently, so
/microsegmentation mapped to the page whose case was itself dead.

Fourteen security consoles had no route at allCspmPage, SbomPage, SoarPage,
SecurityPosturePage, SecurityGovernancePage, SecurityObservabilityPage,
SecurityPlaybookPage, SecurityThreatPage, SecurityVulnerabilityPage,
SamlIdentityProviderPage, ThreatIntelligencePage, ComplianceEvidencePage,
ComplianceReportingPage, IncidentResponsePlaybookPage. SecurityPosturePage was even imported
and then never referenced.

UnauthorizedPage accepted a message prop that nothing ever passed, so every denial showed
the same generic sentence.

Why none of it was reported

package.json had no eslintConfig field. react-scripts therefore ran its ESLint plugin
against eslint-config-react-app/base only, never loading the ruleset where no-undef,
no-dupe-keys and no-duplicate-case are errors. I verified this by building with both components
still undefined — Compiled successfully.

(I originally wrote in #575 that these were build failures. They were not, and I have corrected the
issue.)

The fix

src/routes/routeRegistry.js becomes the single source of truth — one entry per page carrying its
canonical slug, aliases, component, access level, layout flag and dynamic-segment prop name:

{ page: "microsegmentation", slugs: ["microsegmentation", "sdp", "perimeter-security"],
  component: MicrosegmentationPage, access: AUTHENTICATED },

Both App.jsx and AppRoutes.jsx now derive from it. Three consequences worth calling out:

  • App.jsx no longer keeps its own noLayoutPages list. Whether a page shows the navbar and
    footer is a property of the route, declared once (chrome: false).
  • AppRoutes.jsx no longer hard-codes which prop each page expects. The registry records that
    edit-equipment takes equipmentId while orderstatus takes order.
  • Unknown paths now resolve to the 404 page. The previous routeMap[path] || "landing" fallback
    rendered the landing page for any mistyped URL — which is precisely what hid this class of bug.

Denials now name the roles permitted on the route, so message finally carries something.

Enabling ESLint caught two more real defects

Adding eslintConfig immediately surfaced:

src/components/auth/EnterpriseSecurityCenter.jsx
  Line 383:66:  'Network' is not defined  no-undef
  Line 384:59:  'Award' is not defined    no-undef

Both are used as tab icons. Fixed by importing them.

Six rule families are explicitly switched off: no-unused-vars, react-hooks/exhaustive-deps,
eqeqeq, and three jsx-a11y rules. Roughly 40 files carry pre-existing violations of them.
react-scripts promotes every warning to a build error under CI=true, so leaving them on would
fail the build for reasons unrelated to this change. Each is worth fixing — as its own PR, where the
diff is reviewable, rather than burying a real regression in ~200 lines of noise. This is recorded
in docs/frontend-build.md.

Verification

$ CI=true npm run build
check-syntax: 169 file(s) parsed cleanly.
check-routes: 65 routes, 102 slugs, 38 security consoles - all consistent.
Compiled successfully.

  485.83 kB  build/static/js/main.7cb2d069.js

scripts/check-routes.js runs from prebuild and fails when a referenced component is not
imported, an imported module does not exist, a page key or slug is claimed twice, or a
src/pages/auth/*Page.jsx is unregistered.

I verified it catches the original defects by re-injecting all three:

$ node scripts/check-routes.js
check-routes: 3 problem(s) found.

  - route "microsegmentation" renders MicrosegmentationPage, which is never imported
  - slug "pam" is claimed by both "pam" and "pam-dupe" - one of them is unreachable
  - SbomPage exists in src/pages/auth/ but is not registered, so no URL reaches it

It is static analysis rather than a runtime import, so it needs no React runtime, no JSDOM and no
test framework, and finishes in well under a second. It also exits 2 if it parses zero routes, so
a change to the registry's shape cannot make the checks vacuously pass.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective (scripts/check-routes.js, verified against
    re-injected defects)
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Improved navigation with centralized route handling, including dynamic URLs and base-path support.
    • Added more consistent access control and clearer unauthorized-page messaging.
    • Preserved appropriate navigation layouts across pages.
  • Bug Fixes

    • Fixed missing security-center tab icons.
  • Quality Improvements

    • Builds now automatically validate route consistency and detect invalid or missing pages before deployment.
    • Added stronger correctness checks during frontend builds.
  • Documentation

    • Updated frontend build documentation with the new validation and linting behavior.

@MOHITKOURAV01
MOHITKOURAV01 requested a review from kRamu81 as a code owner July 29, 2026 18:22
@github-actions github-actions Bot added the ECSoC26 ECSoC 2026 Initiative label Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kRamu81, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2de9d0d8-03de-4ed4-b41b-11ca5a8fc0b3

📥 Commits

Reviewing files that changed from the base of the PR and between 7e77694 and 834d4ee.

📒 Files selected for processing (6)
  • docs/frontend-build.md
  • package.json
  • scripts/check-routes.js
  • src/App.jsx
  • src/routes/AppRoutes.jsx
  • src/routes/routeRegistry.js
📝 Walkthrough

Walkthrough

The PR centralizes SPA route definitions and access control in routeRegistry.js, updates application navigation and rendering to use it, adds build-time route consistency validation, restores ESLint configuration, and imports missing security-center icons.

Changes

Routing and build validation

Layer / File(s) Summary
Canonical route registry
src/routes/routeRegistry.js
Defines route metadata, URL aliases, dynamic parameters, access policies, layout flags, lookup maps, path conversion helpers, and authorization checks.
Registry-driven rendering and navigation
src/routes/AppRoutes.jsx, src/App.jsx
Replaces switch-based routing and local path maps with registry lookups, centralized access handling, parameter mapping, navigation URL construction, and registry-controlled layout chrome.
Build-time route consistency validation
scripts/check-routes.js, package.json, docs/frontend-build.md
Adds static checks for route imports, page files, duplicate keys and slugs, and auth-page registration; runs the checks during prebuild and documents the behavior.
Build configuration and icon imports
package.json, docs/frontend-build.md, src/components/auth/EnterpriseSecurityCenter.jsx
Restores the react-app ESLint configuration with selected rule overrides and imports the Network and Award icons used by the security center.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant App
  participant routeRegistry
  participant AppRoutes
  participant PageComponent
  Browser->>App: pathname
  App->>routeRegistry: resolvePath(currentRoutePath())
  routeRegistry-->>App: page and data
  App->>AppRoutes: currentPage and pageData
  AppRoutes->>routeRegistry: checkAccess(user, currentPage)
  routeRegistry-->>AppRoutes: access result
  AppRoutes->>PageComponent: render selected component
Loading

Possibly related PRs

Suggested labels: ECSoC26-L3, good-pr

Suggested reviewers: kramu81

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: replacing drifted route tables with a single registry.
Linked Issues check ✅ Passed The registry unifies routing, restores ESLint checks, registers auth pages, and passes role-specific denial reasons, matching the linked issue.
Out of Scope Changes check ✅ Passed All changes support routing consolidation, validation, linting, or related docs; no unrelated modifications stand out.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added documentation Improvements or additions to documentation Frontend Frontend related changes labels Jul 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
src/routes/routeRegistry.js (2)

277-285: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

checkAccess fails open for unknown pages. An unregistered page key returns allowed: true. AppRouter currently guards with getRoute first, so this isn't exploitable today, but any other caller (e.g. a nav-link visibility check) would silently grant access. Prefer default-deny here.

🛡️ Proposed fix
 export function checkAccess(user, page) {
   const route = getRoute(page);
-  if (!route || route.access === PUBLIC) {
+  if (!route) {
+    return { allowed: false, reason: "unknown-route" };
+  }
+  if (route.access === PUBLIC) {
     return { allowed: true, reason: null };
   }
🤖 Prompt for 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.

In `@src/routes/routeRegistry.js` around lines 277 - 285, Update checkAccess so an
unknown page from getRoute(page) returns allowed: false rather than entering the
public-route success path. Preserve allowed access for registered routes whose
access is PUBLIC, and leave the existing unauthenticated handling unchanged.

192-198: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Comment promises an ordering guarantee the code doesn't provide. filter preserves registry declaration order; nothing sorts longest-prefix-first. It happens to be safe today (no parameterised slug is a prefix of another), but the invariant is unenforced. Either sort explicitly or drop the claim.

♻️ Proposed fix
-const PARAMETERISED_ROUTES = ROUTES.filter((route) => route.param);
+const PARAMETERISED_ROUTES = ROUTES.filter((route) => route.param).sort(
+  (a, b) => Math.max(...b.slugs.map((s) => s.length)) - Math.max(...a.slugs.map((s) => s.length))
+);
🤖 Prompt for 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.

In `@src/routes/routeRegistry.js` around lines 192 - 198, Update
PARAMETERISED_ROUTES so its construction enforces the documented
longest-prefix-first ordering by sorting parameterised routes by descending
path-prefix length; otherwise remove the ordering claim from the comment.
Preserve the existing route filtering and matching behavior.
src/App.jsx (1)

21-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer a plain prefix strip over a constructed RegExp. BASE_PATH is a trusted module constant so the static-analysis ReDoS hint is a false positive, but interpolating an unescaped string into RegExp is a footgun the moment the base path gains a regex metacharacter (., +). A case-insensitive startsWith is equivalent and cheaper.

♻️ Proposed fix
-const currentRoutePath = () =>
-  window.location.pathname
-    .replace(new RegExp(`^${BASE_PATH}`, "i"), "")
-    .replace(/^\/+|\/+$/g, "");
+const currentRoutePath = () => {
+  const { pathname } = window.location;
+  const bare = pathname.toLowerCase().startsWith(BASE_PATH.toLowerCase())
+    ? pathname.slice(BASE_PATH.length)
+    : pathname;
+  return bare.replace(/^\/+|\/+$/g, "");
+};
🤖 Prompt for 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.

In `@src/App.jsx` around lines 21 - 24, Update currentRoutePath to remove
BASE_PATH using a case-insensitive startsWith check and string slicing instead
of constructing an interpolated RegExp, while preserving the existing slash
trimming behavior.

Source: Linters/SAST tools

src/routes/AppRoutes.jsx (1)

45-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

reason doubles as both a sentinel and a user-facing string. checkAccess returns the magic value "unauthenticated" for one branch and a rendered message for another, so a wording change in the registry silently breaks this comparison. Consider a discriminated result, e.g. { allowed, code, message }, and branch on code.

🤖 Prompt for 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.

In `@src/routes/AppRoutes.jsx` around lines 45 - 55, Update checkAccess and its
caller in AppRoutes so access results use a stable discriminant such as code for
authentication status, while carrying the user-facing denial text separately as
message. Change the unauthenticated branch to compare the discriminant and pass
the message to UnauthorizedPage, preserving the existing LoginPage and denial
behavior.
🤖 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 `@scripts/check-routes.js`:
- Around line 137-153: Update the duplicate-slug validation around seenSlugs so
parameterized routes are checked in their own map instead of being skipped.
Maintain separate maps for static and parameterized slugs, allowing the same
slug across maps while calling fail when duplicated within either map; preserve
the existing conflict message and route-page reporting.

In `@src/routes/AppRoutes.jsx`:
- Around line 47-49: Update src/routes/AppRoutes.jsx lines 47-49 to redirect
unauthenticated users via onNavigate("login") from an effect instead of
rendering LoginPage inline, keeping page state, URL, and layout chrome
synchronized. Also update src/App.jsx lines 62-64 to evaluate hasChrome using
the router’s effective rendered page if needed, so substituted LoginPage or
NotFoundPage layouts do not inherit chrome from the requested currentPage.

In `@src/routes/routeRegistry.js`:
- Around line 13-15: Update the comments in routeRegistry.js, including the
entry near the route registry and the one around line 200, to reference
scripts/check-routes.js as the build-time validator instead of the non-existent
routeRegistry.test.js; preserve the existing explanation of the validation
checks.

---

Nitpick comments:
In `@src/App.jsx`:
- Around line 21-24: Update currentRoutePath to remove BASE_PATH using a
case-insensitive startsWith check and string slicing instead of constructing an
interpolated RegExp, while preserving the existing slash trimming behavior.

In `@src/routes/AppRoutes.jsx`:
- Around line 45-55: Update checkAccess and its caller in AppRoutes so access
results use a stable discriminant such as code for authentication status, while
carrying the user-facing denial text separately as message. Change the
unauthenticated branch to compare the discriminant and pass the message to
UnauthorizedPage, preserving the existing LoginPage and denial behavior.

In `@src/routes/routeRegistry.js`:
- Around line 277-285: Update checkAccess so an unknown page from getRoute(page)
returns allowed: false rather than entering the public-route success path.
Preserve allowed access for registered routes whose access is PUBLIC, and leave
the existing unauthenticated handling unchanged.
- Around line 192-198: Update PARAMETERISED_ROUTES so its construction enforces
the documented longest-prefix-first ordering by sorting parameterised routes by
descending path-prefix length; otherwise remove the ordering claim from the
comment. Preserve the existing route filtering and matching behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bfca85ae-7d83-43ae-a8b5-b570cd72a535

📥 Commits

Reviewing files that changed from the base of the PR and between 45f2ed6 and 7e77694.

📒 Files selected for processing (7)
  • docs/frontend-build.md
  • package.json
  • scripts/check-routes.js
  • src/App.jsx
  • src/components/auth/EnterpriseSecurityCenter.jsx
  • src/routes/AppRoutes.jsx
  • src/routes/routeRegistry.js

Comment thread scripts/check-routes.js
Comment thread src/routes/AppRoutes.jsx Outdated
Comment on lines +47 to +49
if (!allowed && reason === "unauthenticated") {
return <LoginPage onNavigate={onNavigate} />;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Layout chrome can disagree with the page actually rendered. AppRouter may substitute LoginPage or NotFoundPage for the requested route, but App.jsx decides navbar/footer visibility from currentPage alone — so a signed-out hit on /equipment renders the full-bleed login layout wrapped in Navbar + Footer.

  • src/routes/AppRoutes.jsx#L47-L49: instead of rendering LoginPage in place, redirect through onNavigate("login") (in an effect) so page state, URL, and chrome all agree.
  • src/App.jsx#L62-L64: alternatively (or additionally), have the router surface the effective page so hasChrome is evaluated against what is rendered rather than what was requested.
📍 Affects 2 files
  • src/routes/AppRoutes.jsx#L47-L49 (this comment)
  • src/App.jsx#L62-L64
🤖 Prompt for 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.

In `@src/routes/AppRoutes.jsx` around lines 47 - 49, Update
src/routes/AppRoutes.jsx lines 47-49 to redirect unauthenticated users via
onNavigate("login") from an effect instead of rendering LoginPage inline,
keeping page state, URL, and layout chrome synchronized. Also update src/App.jsx
lines 62-64 to evaluate hasChrome using the router’s effective rendered page if
needed, so substituted LoginPage or NotFoundPage layouts do not inherit chrome
from the requested currentPage.

Comment thread src/routes/routeRegistry.js Outdated
Route information lived in three hand-maintained places - the routeMap
object in App.jsx, the switch in AppRoutes.jsx, and the import list above
it - with nothing keeping them consistent. The accumulated drift:

- KeyVaultSecurityPage and MicrosegmentationPage were rendered but never
  imported, an uncaught ReferenceError that ErrorBoundary turns into a
  blank screen on /keyvault and /microsegmentation
- case 'keyvault-security' and case 'microsegmentation' each appeared
  twice, so the second was dead and /microsegmentation silently rendered
  the ZTNA page
- routeMap declared help twice, and microsegmentation twice with
  different targets; in an object literal the last silently wins
- fourteen security consoles existed as page components with no route
- UnauthorizedPage accepted a message prop that nothing ever passed, so
  every denial showed the same generic sentence

One registry entry per page removes the drift by construction. Access
level, layout chrome and the dynamic-segment prop name are declared
alongside the component, so App.jsx no longer keeps its own noLayoutPages
list and AppRoutes no longer hard-codes which prop each page expects.

Unknown paths now resolve to the 404 page. The previous
routeMap[path] || 'landing' fallback rendered the landing page for any
mistyped URL, which hid exactly this class of bug.

package.json gains the eslintConfig field it never had. Without it
react-scripts runs its ESLint plugin against eslint-config-react-app/base
only and never loads the ruleset where no-undef, no-dupe-keys and
no-duplicate-case are errors - which is why none of the above was ever
reported. Enabling it caught two further defects: Network and Award used
as icons in EnterpriseSecurityCenter.jsx without being imported.

scripts/check-routes.js runs from prebuild and fails on an unimported
component, a duplicate page key or slug, or an unregistered console.
Verified by re-injecting all three original defects.

Refs kRamu81#575
Three findings, all valid:

- scripts/check-routes.js skipped parameterised routes entirely when
  checking for duplicate slugs, so two dynamic routes could claim the
  same prefix and resolvePath would always pick whichever came first in
  ROUTES, leaving the other permanently unreachable. Static and
  parameterised slugs now get their own map, so a slug may appear once as
  each but not twice within either kind. Verified by injecting a second
  route on the 'apply' prefix.

- Layout chrome was decided from the requested page while AppRoutes may
  render a different one. A signed-out visit to /equipment rendered the
  full-bleed login screen wrapped in the navbar and footer. Added
  resolveEffectivePage to the registry and both AppRoutes and App.jsx now
  derive the substitution from it, so the two cannot disagree about what
  is on screen.

- Two comments in routeRegistry.js referenced routeRegistry.test.js,
  which does not exist; the validator is scripts/check-routes.js.

Refs kRamu81#575
@MOHITKOURAV01
MOHITKOURAV01 force-pushed the fix/spa-route-registry branch from 7e77694 to 66d48a8 Compare July 30, 2026 05:11
@MOHITKOURAV01

Copy link
Copy Markdown
Contributor Author

Thanks @coderabbitai — all three findings were valid and are fixed in the latest push.

1. scripts/check-routes.js skipped parameterised routes entirely. Correct, and the consequence was worse than ambiguity: resolvePath iterates PARAMETERISED_ROUTES in registry order and returns on first prefix match, so a second dynamic route on the same prefix would be permanently unreachable rather than merely ambiguous.

Fixed with separate maps, as suggested — a slug may appear once as static and once as parameterised (blog and blog/:slug), but not twice within either kind. Verified by injecting a duplicate:

$ node scripts/check-routes.js
check-routes: 1 problem(s) found.
  - parameterised slug "apply" is claimed by both "apply" and "apply-dupe" - one of them is unreachable

2. Layout chrome disagreeing with the page actually rendered. Good catch, and it is a real visual defect — a signed-out visit to /equipment rendered the full-bleed login screen wrapped in the navbar and footer.

I took the second option you offered rather than the redirect, because redirecting from an effect would change the URL on a bookmarked deep link and lose the destination the user was trying to reach. Instead the registry now exports resolveEffectivePage(user, page), and both AppRoutes and App.jsx derive the substitution from it. That keeps the fix consistent with the point of this PR — one table that both sides read — rather than adding a second place where the two could drift apart again.

3. Stale routeRegistry.test.js references. Both corrected to scripts/check-routes.js. My mistake: I planned a Jest test, found that react-scripts test is not wired up in this project (no test script in package.json), switched to a standalone Node script, and left the comments behind.

CI=true npm run build passes; check-routes reports 65 routes / 102 slugs / 6 parameterised / 38 consoles consistent.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@MOHITKOURAV01 Thanks for the thorough follow-up. The separate static/parameterised slug validation and shared resolveEffectivePage(user, page) approach address the reachability and chrome-consistency issues cleanly, while preserving deep-link URLs. The successful CI build and route-registry validation are also reassuring.

🐇✨


✏️ Learnings added
Learnt from: MOHITKOURAV01
URL: https://github.com/kRamu81/MedTrack_Application/pull/583

Timestamp: 2026-07-30T05:12:16.770Z
Learning: In `src/routes/routeRegistry.js`, access-driven page substitution is centralized in `resolveEffectivePage(user, page)`. Both `src/App.jsx` (for layout chrome) and `src/routes/AppRoutes.jsx` (for rendering) must use this helper so the layout matches the page actually rendered while preserving protected deep-link URLs.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

@kRamu81

kRamu81 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

@MOHITKOURAV01 bro you can join discord community only 5 prs per day

@MOHITKOURAV01

Copy link
Copy Markdown
Contributor Author

@kRamu81 Yes bro, yesterday I raised 5 PRs, so I am raising 5 today as well.

@kRamu81

kRamu81 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

@MOHITKOURAV01 today you got all spam because i was merged your prs yesterday 3 only today 7 so all prs going to spam

make everyday i am checking prs at 9 to 11.30 pm

@kRamu81
kRamu81 merged commit 0eb5dfe into kRamu81:main Jul 30, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ECSoC26-SPAM ECSoC26 ECSoC 2026 Initiative Frontend Frontend related changes

Projects

None yet

2 participants