Skip to content

fix(@redhat-cloud-services/frontend-components-config-utilities,@redhat-cloud-services/frontend-components-config): revert reload nav on CRD change - #2395

Merged
charlesmulder merged 1 commit into
masterfrom
revert-2391-bot/RHCLOUD-49555
Jul 27, 2026
Merged

fix(@redhat-cloud-services/frontend-components-config-utilities,@redhat-cloud-services/frontend-components-config): revert reload nav on CRD change#2395
charlesmulder merged 1 commit into
masterfrom
revert-2391-bot/RHCLOUD-49555

Conversation

@karelhala

@karelhala karelhala commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Reverts #2391

Summary by CodeRabbit

  • Bug Fixes
    • Improved outgoing-request matching for configuration-driven CRD/FEO interception via navigation-aware matching.
    • Stopped automatic browser reloads triggered by CRD/config changes and limited CRD updates to in-memory handling.
    • Adjusted proxy interception behavior to rely on response-side modifications.
  • Removed
    • Eliminated the local CRD interceptor server and its interceptable API routes.
    • Removed CRD interception/FEO support from the development proxy startup and route generation.

@karelhala
karelhala requested a review from a team as a code owner July 27, 2026 12:15
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: e775c07b-cd2f-48a2-a204-ac0020dd8d4d

📥 Commits

Reviewing files that changed from the base of the PR and between 574fe2c and 60c771f.

📒 Files selected for processing (3)
  • packages/config-utils/src/proxy.ts
  • packages/config/src/bin/crd-interceptor-server.ts
  • packages/config/src/bin/dev-proxy-script.ts

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

The development proxy removes CRD interceptor server startup, routing, and teardown. Proxy handling retains CRD refresh and response interception while removing browser reload signaling and request-header stripping.

Changes

CRD interception and proxy behavior

Layer / File(s) Summary
Update proxy interception behavior
packages/config-utils/src/proxy.ts
FEO request matching uses matchNavigationRequest; CRD changes update in-memory state without websocket reloads, and request-side cache-header manipulation is removed.
Remove development interceptor wiring
packages/config/src/bin/dev-proxy-script.ts, packages/config/src/bin/crd-interceptor-server.ts
The CRD interceptor server is deleted, along with its route mappings, startup logic, and teardown from the development proxy flow.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is far too brief and misses the required summary, issue link, checklist, and reviewer notes from the template. Add a 2-3 sentence description with what/why, an RHCLOUD issue link, reviewer notes, checklist items, and AI disclosure; remove screenshots for non-visual changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the revert of CRD-change navigation/reload behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-2391-bot/RHCLOUD-49555

Comment @coderabbitai help to get the list of available commands.

@LightOfHeaven1994 LightOfHeaven1994 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thank you!

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/config-utils/src/proxy.ts (1)

241-245: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve cache bypass for intercepted responses.

Without stripping conditional headers, the upstream can return 304 Not Modified; there is then no body for modifyRequest to replace, so CRD changes remain stale in the browser. Restore conditional-request removal and cache-prevention headers for isInterceptAbleRequest responses, and add a regression test covering a CRD update followed by a conditional navigation request.

Proposed fix
+      onProxyReq: (proxyReq, req) => {
+        if (FEOFeaturesEnabled && frontendCrdRef.current && isInterceptAbleRequest(req.url)) {
+          proxyReq.removeHeader('if-none-match');
+          proxyReq.removeHeader('if-modified-since');
+        }
+      },
       onProxyRes: (proxyRes, req, res) => {
         if (FEOFeaturesEnabled && frontendCrdRef.current && isInterceptAbleRequest(req.url)) {
+          delete proxyRes.headers.etag;
+          delete proxyRes.headers['last-modified'];
+          delete proxyRes.headers['cache-control'];

As per coding guidelines, “All functions in @redhat-cloud-services/frontend-components-config-utilities must have comprehensive unit tests.”

🤖 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 `@packages/config-utils/src/proxy.ts` around lines 241 - 245, Update the
intercepted-response path in the onProxyRes handler to remove conditional
request headers and apply cache-prevention headers whenever
isInterceptAbleRequest(req.url) is true, ensuring upstream responses include a
body for modifyRequest. Add a unit regression test covering a CRD update
followed by a conditional navigation request and verify the updated CRD content
is returned.

Source: Coding guidelines

🤖 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 `@packages/config/src/bin/dev-proxy-script.ts`:
- Line 238: Update the routesConfigPath assignment in the dev-proxy startup flow
to pass a per-invocation filename or temporary-directory-scoped path to
createRoutesConfig instead of the shared /tmp/routes.json default. Ensure
concurrent dev-proxy sessions generate and bind-mount distinct routes files.
- Line 85: Update createRoutesConfig to replace fecConfig: any with a concrete
type exposing the required routes and routesPath fields. Replace the fixed
temporary routes.json location with a unique per-run temporary filename under
os.tmpdir(), ensuring concurrent dev-proxy instances do not overwrite one
another’s mounted routes file.

---

Outside diff comments:
In `@packages/config-utils/src/proxy.ts`:
- Around line 241-245: Update the intercepted-response path in the onProxyRes
handler to remove conditional request headers and apply cache-prevention headers
whenever isInterceptAbleRequest(req.url) is true, ensuring upstream responses
include a body for modifyRequest. Add a unit regression test covering a CRD
update followed by a conditional navigation request and verify the updated CRD
content is returned.
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 3ca2aa2f-466c-47da-a2e7-bc327a0e9edc

📥 Commits

Reviewing files that changed from the base of the PR and between 46d4858 and a87b9da.

📒 Files selected for processing (3)
  • packages/config-utils/src/proxy.ts
  • packages/config/src/bin/crd-interceptor-server.ts
  • packages/config/src/bin/dev-proxy-script.ts
💤 Files with no reviewable changes (1)
  • packages/config/src/bin/crd-interceptor-server.ts

filename: string = 'routes.json',
interceptorPort?: number,
): string {
function createRoutesConfig(fecConfig: any, cdnPath: string, port: string, SPAFallback: boolean, filename: string = 'routes.json'): string {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline packages/config/src/bin/dev-proxy-script.ts --items all --match createRoutesConfig
rg -n --type ts -C2 'interface .*Config|type .*Config|routesPath|validateFECConfig' packages/config/src packages/config-utils/src

Repository: RedHatInsights/frontend-components

Length of output: 13570


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' packages/config/src/bin/dev-proxy-script.ts | cat -n
printf '\n---\n'
sed -n '220,340p' packages/config/src/bin/dev-proxy-script.ts | cat -n
printf '\n---\n'
sed -n '1,260p' packages/config-utils/src/proxy.ts | cat -n

Repository: RedHatInsights/frontend-components

Length of output: 24778


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- dev-proxy-script.ts: lines 220-360 ---'
sed -n '220,360p' packages/config/src/bin/dev-proxy-script.ts | cat -n

printf '\n%s\n' '--- all createRoutesConfig call sites ---'
rg -n 'createRoutesConfig\(' packages/config/src/bin/dev-proxy-script.ts packages/config/src/bin -C 2

printf '\n%s\n' '--- routes.json / mount references ---'
rg -n 'routes.json|routesConfigPath|custom_routes|/config/' packages/config/src/bin/dev-proxy-script.ts packages/config-utils/src/proxy.ts -C 2

Repository: RedHatInsights/frontend-components

Length of output: 10917


Replace fecConfig: any and stop using a fixed temp filename.

  • Use a concrete config type for the routes/routesPath fields instead of any.
  • os.tmpdir()/routes.json is shared across runs, so concurrent dev-proxy instances can overwrite each other’s mounted routes file.
🧰 Tools
🪛 ast-grep (0.44.1)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { exec, execSync } from 'child_process';
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

🤖 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 `@packages/config/src/bin/dev-proxy-script.ts` at line 85, Update
createRoutesConfig to replace fecConfig: any with a concrete type exposing the
required routes and routesPath fields. Replace the fixed temporary routes.json
location with a unique per-run temporary filename under os.tmpdir(), ensuring
concurrent dev-proxy instances do not overwrite one another’s mounted routes
file.

Sources: Coding guidelines, Path instructions

try {
cdnPath = getCdnPath(fecConfig, webpackConfig, cwd);
routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback, 'routes.json', interceptorPort);
routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Use a per-invocation routes filename.

This now defaults every dev-proxy process to /tmp/routes.json. Concurrent sessions overwrite the file bind-mounted into an existing proxy container, causing it to use another session’s routes. Pass a PID- or temp-directory-scoped filename.

Proposed fix
-    routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback);
+    routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback, `routes-${process.pid}.json`);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback);
routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback, `routes-${process.pid}.json`);
🧰 Tools
🪛 ast-grep (0.44.1)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { exec, execSync } from 'child_process';
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

🤖 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 `@packages/config/src/bin/dev-proxy-script.ts` at line 238, Update the
routesConfigPath assignment in the dev-proxy startup flow to pass a
per-invocation filename or temporary-directory-scoped path to createRoutesConfig
instead of the shared /tmp/routes.json default. Ensure concurrent dev-proxy
sessions generate and bind-mount distinct routes files.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

@charlesmulder charlesmulder changed the title Revert "fix(@redhat-cloud-services/frontend-components-config-utilities): reload nav on CRD change" ix(@redhat-cloud-services/frontend-components-config-utilities,@redhat-cloud-services/frontend-components-config): revert reload nav on CRD change Jul 27, 2026
@charlesmulder charlesmulder changed the title ix(@redhat-cloud-services/frontend-components-config-utilities,@redhat-cloud-services/frontend-components-config): revert reload nav on CRD change fix(@redhat-cloud-services/frontend-components-config-utilities,@redhat-cloud-services/frontend-components-config): revert reload nav on CRD change Jul 27, 2026
@charlesmulder
charlesmulder force-pushed the revert-2391-bot/RHCLOUD-49555 branch from a87b9da to 574fe2c Compare July 27, 2026 12:39
…at-cloud-services/frontend-components-config): revert reload nav on CRD change
@charlesmulder
charlesmulder force-pushed the revert-2391-bot/RHCLOUD-49555 branch from 574fe2c to 60c771f Compare July 27, 2026 13:00
@charlesmulder
charlesmulder merged commit d38f11d into master Jul 27, 2026
1 of 2 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.

3 participants