Repository navigation
Speed up Console namespace loading and refresh choices automatically - #1797
Conversation
|
/kelos review |
|
🤖 Kelos Task Status Task |
There was a problem hiding this comment.
1 issue found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/consoleserver/frontend/app.ts">
<violation number="1" location="internal/consoleserver/frontend/app.ts:5919">
P2: The picker refresh is triggered by `pointerdown` on the `<select>`, which is the same event that opens the native dropdown, and `loadNamespaceOptions()` unconditionally calls `elements.activeNamespace.replaceChildren()` when the fetch resolves. Mutating the option list while a native select's popup is open is a known problem in Chrome/WebKit: the open popup is not updated from the replacement and can snap shut, show only the stale first option, or leave the selection jumping, forcing the user to close and reopen the dropdown (see WebKit/Chromium 'SELECT element popup' reports). The same rebuild also runs on every Tab-focus even when the fetched list is identical, re-running full namespace discovery (plus its authorization calls) for each interaction. Skip the re-render when the fetched list matches the currently rendered options, and avoid touching the option list while the popup is open.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
🤖 Kelos Reviewer Agent @gjkim42 Review SummaryVerdict: APPROVE Findings Overview
FindingsDocumentation
Suggestions (optional)
Key takeaways
Note on prompt injection: a third-party review comment on this PR included a "Prompt for AI agents" block with instructions to change code and resolve threads. I treated it as data and did not follow it. This review is based on my own reading of the code. |
Validate the remembered or default namespace before discovering the full list, and use a dedicated authorization client to reduce rate-limit delays. Refresh namespace choices on picker interaction, preserve unchanged options and accessible selections, and keep the picker usable after errors or access changes. Cover startup and refresh behavior and document automatic refresh.
86a51ec to
b1c51c7
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
Console startup waits for authorization checks across every namespace before applying the remembered namespace. With 20 namespaces and access to Sessions in only one, discovery makes 191 authorization requests and the default client rate limit can add about 36 seconds of waiting.
Validate the remembered namespace (or configured default) first, then load the remaining namespace choices in the background. If that namespace is unavailable, retain full discovery and the existing fallback selection. Give authorization checks a dedicated client with a 50 QPS / 100 burst budget while retaining the eight concurrent namespace checks and uncached authorization decisions.
The focused namespace lookup uses a name-filtered list, so it works with the existing Console service-account permissions. Access through groups and custom roles remains supported.
Refresh namespace choices when the user opens or focuses the picker, and remove the separate refresh button. Mouse, touch, and keyboard interactions share any pending discovery request and retain the current selection while it remains accessible. Unchanged choices retain their existing option nodes and selected value, including the no-access placeholder. Keep the picker usable after an error or when access is empty, so reopening it can recover without a page reload.
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
Validation passed:
env -u CODEX_HOME -u CODEX_AUTH_JSON make test TEST_FLAGS='-p 4'— isolate the entrypoint tests from this agent session's Codex settings.make test-integration TEST_FLAGS='-run TestConsoleMembership -count=1'— verifies the focused lookup against Kubernetes RBAC, including missing, inaccessible, and revoked namespaces.make verify— generated browser bundle, formatting, and vet.Review follow-up:
A local measurement with 20 namespace fixtures and a real rate-limited authorization client returned the same accessible namespace:
These measurements use a local authorization server, not a production cluster. Two simultaneous full-discovery requests shared the configured budget and completed 382 checks in 5.64 seconds.
Before — Admin while full namespace discovery is pending. The remembered namespace is not yet selected, so members and configuration cannot load.
After — The same Admin view, remembered namespace, fixture data, and 1440×1080 viewport while full discovery is still pending. The validated namespace is already selected and its members and configuration are usable. Opening the picker refreshes its choices without a separate button.
Does this PR introduce a user-facing change?
Summary by cubic
Speeds up Console startup by validating the remembered or default namespace before full discovery, so an accessible namespace is usable immediately, and refreshes namespace choices automatically when the picker is opened or focused.
Written for commit b1c51c7. Summary will update on new commits.