Skip to content

refactor(dashboard): split sidebarVisibility god-file (1197→291) into types + sections leaves - #5660

Closed
diegosouzapw wants to merge 1 commit into
release/v3.8.42from
refactor/split-data-godfiles
Closed

diegosouzapw wants to merge 1 commit into
release/v3.8.42from
refactor/split-data-godfiles

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

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_GROUP e SIDEBAR_SECTIONS continuam exportados.
  • Host (1197→291) — re-exporta tudo via barrel (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

  • Byte-idêntico ✅ — JSON.stringify de HIDEABLE_SIDEBAR_ITEM_IDS / SIDEBAR_ICON_ACCENTS / COMPRESSION_CONTEXT_GROUP / SIDEBAR_SECTIONS / SIDEBAR_PRESETS + saída de getSectionItems idêntico antes/depois.
  • typecheck:core ✅ · check:cycles ✅ (sem ciclos, 303 files) · check:file-size ✅ (3 arquivos <800) · lint ✅.
  • 3 suítes sidebar 20/20. Lógica não alterada (diff do host = só deleções + header de barrel).

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) reordena listCliTools() (categorias interleaved) — ROI baixo + risco de ordem na UI.

…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).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment on lines +1 to +12
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";

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.

medium

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.

Suggested change
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";

@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Superseded by #5683 — rehomed para release/v3.8.43 (cherry-pick limpo).

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.

1 participant