Skip to content

fix(dashboard): drop the resource map ConfigMaps once the map is unreadable - #4789

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
cozystack:mainfrom
yankawai:fix/dashboard-configmaps-access-loss
Oct 8, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
cozystack:mainfrom
yankawai:fix/dashboard-configmaps-access-loss

Conversation

@yankawai

@yankawai europrinter (yankawai) commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Follow-up to #4612.

The ConfigMaps tab takes its names from the application's resource map. React Query keeps the last successful list when a refetch fails, so when the resource map became forbidden or went away after a successful read, useApplicationConfigMaps went on parsing the old copy. The tab stayed with the old names, every listed ConfigMap showed an access error, and a malformed map kept its old error. A map that is unreadable from the start already hid the tab.

Now a 403 or 404 on the resource map drops the names and the error whether or not an earlier read succeeded, so the tab goes away in both cases. Any other error is still shown on the tab, as before.

The new tests are a page test with stale resource map data next to a 403, and hook tests that read the map and then refetch it with 403 and with 404, plus a malformed map followed by a 403. All four fail on main and pass here. pnpm typecheck, pnpm test (451 tests in 62 files) and pnpm lint pass.

Screenshots

No visual change. Once the resource map is unreadable, the page looks the same as for an application whose map was never readable, with no ConfigMaps tab. The tab itself is shown in #4612.

Downstream repositories

Walked the trigger map against the diff. It touches only the console hook that reads the resource map and its tests. No chart, values, schema, CRD or hack/ file changes, and the console is vendored in this repository.

Release note

fix(dashboard): the ConfigMaps tab now goes away when the application's resource map stops being readable, instead of keeping the names from the last successful read

Summary by CodeRabbit

  • Bug Fixes
    • ConfigMaps are no longer displayed when access to the resource map is forbidden or the resource map is missing.
    • The ConfigMaps tab is excluded when the resource map cannot be accessed.

…adable

React Query keeps the last successful list when a refetch fails. After the
resource map became forbidden or went away, the hook went on parsing that
old copy, so the ConfigMaps tab stayed with stale names, and a malformed
map kept its old error, instead of the tab going away as it does when the
map is unreadable from the start.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: cozystack/cozystack/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 341357cc-7e03-436f-ba39-c98e67fec77f
📥 Commits

Reviewing files that changed from the base of the PR and between 3cce629 and 8ce3f85.

📒 Files selected for processing (3)
  • packages/system/dashboard/images/console/apps/console/src/routes/detail/ApplicationDetailPage.test.tsx
  • packages/system/dashboard/images/console/apps/console/src/routes/detail/ConfigMapsTab.test.tsx
  • packages/system/dashboard/images/console/apps/console/src/routes/detail/use-app-configmaps.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The ConfigMap hook ignores resource-map data after 403 or 404 errors. Tests cover the resulting ConfigMaps tab visibility and displayed content.

Changes

ConfigMap access error handling

Layer / File(s) Summary
Handle access errors and verify ConfigMap views
packages/system/dashboard/images/console/apps/console/src/routes/detail/use-app-configmaps.ts, packages/system/dashboard/images/console/apps/console/src/routes/detail/*test.tsx
The hook returns no ConfigMap names for 403 or 404 errors. Tests verify that the ConfigMaps tab is excluded or that previously displayed ConfigMaps and alerts are cleared.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8ce3f

No actionable issue remains in the supplied evidence; the change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: stop using ConfigMaps when the resource map is unreadable.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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.

europrinter (@yankawai) LGTM. React Query keeps the last successful data after a failed refetch, so the stale names were real, and moving the 403/404 check in front of the parse is the smallest fix for it.

On a trial merge with current main the detail route tests pass, typecheck is clean and lint stays at the three existing warnings. With the hook reverted to main, all four new tests fail, so they pin the fix.

CI hasn't run on this head yet, every workflow is waiting for approval.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 76c030d into cozystack:main Oct 8, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/dashboard Issues or PRs related to the dashboard / UI kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants