Repository navigation
refactor(dashboard): split sidebarVisibility god-file (1197→291) into types + sections leaves - #5660
diegosouzapw wants to merge 1 commit into
Conversation
…ctions leaves Behavior-preserving decomposition: src/shared/constants/sidebarVisibility.ts 1197 -> 291 LOC by extracting two leaves under sidebarVisibility/: - types.ts (160): HIDEABLE_SIDEBAR_ITEM_IDS + all sidebar types (self-contained). - sections.ts (762): section building-block consts + SIDEBAR_SECTIONS (imports types only — cycle-safe). COMPRESSION_CONTEXT_GROUP + SIDEBAR_SECTIONS stay exported; host re-exports both + 'export *' of types, so every consumer import path is unchanged. Byte-identical data verified via JSON.stringify of HIDEABLE_SIDEBAR_ITEM_IDS / SIDEBAR_ICON_ACCENTS / COMPRESSION_CONTEXT_GROUP / SIDEBAR_SECTIONS / SIDEBAR_PRESETS + getSectionItems output (identical before/after). typecheck:core, check:cycles (no cycles), check:file-size (3 files <800), and the 3 sidebar suites (20/20) pass. No logic changed. Note: file-size frozen baseline for sidebarVisibility.ts (1198) can ratchet to 291 to lock the shrink (left for the release ratchet / operator).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request refactors the sidebar visibility configuration by extracting types, interfaces, and section definitions from sidebarVisibility.ts into a new subfolder sidebarVisibility/ containing types.ts and sections.ts. The review feedback correctly points out that the import statements in sidebarVisibility.ts are placed after the export statements, and suggests moving them to the top of the file to align with standard TypeScript code organization practices.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| export * from "./sidebarVisibility/types"; | ||
| export { COMPRESSION_CONTEXT_GROUP, SIDEBAR_SECTIONS } from "./sidebarVisibility/sections"; | ||
|
|
||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "./sidebarVisibility/types"; | ||
| import type { | ||
| HideableSidebarItemId, | ||
| SidebarSectionId, | ||
| SidebarItemDefinition, | ||
| SidebarSectionChild, | ||
| SidebarSectionDefinition, | ||
| SidebarPresetDefinition, | ||
| } from "./sidebarVisibility/types"; |
There was a problem hiding this comment.
As declarações de importação (import) devem ser posicionadas no topo do arquivo, antes de qualquer exportação (export) ou outras instruções. Isso garante a conformidade com os guias de estilo padrão de JavaScript/TypeScript (como as regras import/first ou import/order do ESLint) e melhora a legibilidade do código.
| export * from "./sidebarVisibility/types"; | |
| export { COMPRESSION_CONTEXT_GROUP, SIDEBAR_SECTIONS } from "./sidebarVisibility/sections"; | |
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "./sidebarVisibility/types"; | |
| import type { | |
| HideableSidebarItemId, | |
| SidebarSectionId, | |
| SidebarItemDefinition, | |
| SidebarSectionChild, | |
| SidebarSectionDefinition, | |
| SidebarPresetDefinition, | |
| } from "./sidebarVisibility/types"; | |
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "./sidebarVisibility/types"; | |
| import type { | |
| HideableSidebarItemId, | |
| SidebarSectionId, | |
| SidebarItemDefinition, | |
| SidebarSectionChild, | |
| SidebarSectionDefinition, | |
| SidebarPresetDefinition, | |
| } from "./sidebarVisibility/types"; | |
| export * from "./sidebarVisibility/types"; | |
| export { COMPRESSION_CONTEXT_GROUP, SIDEBAR_SECTIONS } from "./sidebarVisibility/sections"; |
|
Superseded by #5683 — rehomed para |
BLOCO D — god-file de dados (decomposição)
Decomposição behavior-preserving de
src/shared/constants/sidebarVisibility.ts(1197 LOC, #2 god-file de dados):sidebarVisibility/types.ts(160) —HIDEABLE_SIDEBAR_ITEM_IDS+ todos os tipos do sidebar (self-contained, zero imports).sidebarVisibility/sections.ts(762) — os 19 building-blocks de seção +SIDEBAR_SECTIONS(importa só tipos → cycle-safe).COMPRESSION_CONTEXT_GROUPeSIDEBAR_SECTIONScontinuam exportados.export *dos types +export { COMPRESSION_CONTEXT_GROUP, SIDEBAR_SECTIONS }), então nenhum import de consumidor muda. Mantém: icon-accents,getSectionItems, keys, presets, ordering/normalize.Validação
JSON.stringifyde HIDEABLE_SIDEBAR_ITEM_IDS / SIDEBAR_ICON_ACCENTS / COMPRESSION_CONTEXT_GROUP / SIDEBAR_SECTIONS / SIDEBAR_PRESETS + saída degetSectionItemsidêntico antes/depois.typecheck:core✅ ·check:cycles✅ (sem ciclos, 303 files) ·check:file-size✅ (3 arquivos <800) · lint ✅.Nota
Baseline frozen de file-size do
sidebarVisibility.ts(1198) pode ser ratchetado p/ 291 (lock do shrink) — deixei p/ o ratchet do release / operador.Defer
cliTools.ts(817) não entrou: não é violação viva (frozen-cap 875) e o único split semântico (por categoria) reordenalistCliTools()(categorias interleaved) — ROI baixo + risco de ordem na UI.