Skip to content

Refactor: Restructure project into pages/ and common/ with co-location convention.#31

Merged
matejvasek merged 1 commit into
masterfrom
031-refactor-page-colocation
May 29, 2026
Merged

Refactor: Restructure project into pages/ and common/ with co-location convention.#31
matejvasek merged 1 commit into
masterfrom
031-refactor-page-colocation

Conversation

@twoGiants
Copy link
Copy Markdown
Collaborator

@twoGiants twoGiants commented May 20, 2026

Changes

  • 🧹 Restructure src/ into src/pages/ (page-specific code with components/ subdirs) and src/common/ (shared services, utils, context, components)
  • 🧹 Extract EditToolbar and LeaveModal from FunctionEditPage into separate component files, then fold LeaveModal back into EditToolbar per sub-component rule
  • 🎁 Add EditToolbar tests (9 tests covering save flow, error handling, leave modal)
  • 🧹 Move all beforeEach/afterEach into describe blocks, merge duplicate beforeEach in OcpClusterService test
  • 🧹 Replace runtime import of @patternfly/react-code-editor with import type (fixes Monaco worker bundling)
  • 🎁 Add yarn ci script (lint + test + build)
  • 🧹 Update init-session command to use yarn ci and handle sandbox failures
  • 🧹 Update ARCHITECTURE.md with co-location convention, sub-component rule, hooks directory convention
  • 🧹 Update TESTING.md with component vs. page test rules, Vitest/MSW migration, scoping rule
  • 🧹 Update WORKFLOW.md startup sequence (drop old step 4, add Jira epic story selection)

@twoGiants twoGiants force-pushed the 031-refactor-page-colocation branch from 1d40185 to 7b474fb Compare May 21, 2026 09:22
@twoGiants twoGiants marked this pull request as ready for review May 21, 2026 09:23
@twoGiants twoGiants changed the title Refactor: Restructure page-specific components into co-located page directories. Refactor: Restructure project into pages/ and common/ with co-location convention. May 21, 2026
@twoGiants twoGiants requested a review from matejvasek May 21, 2026 09:26
@matejvasek
Copy link
Copy Markdown
Collaborator

/lgtm

@matejvasek
Copy link
Copy Markdown
Collaborator

matejvasek commented May 29, 2026

From Claude:

Minor test isolation regression in CreateFunctionForm.test.tsx

The old code had explicit mockClear() calls for the standalone vi.fn() mocks:

// old — describe scope
beforeEach(() => {
  onSubmit.mockClear();
  onCancel.mockClear();
});

The refactor replaced this with just vi.restoreAllMocks() in afterEach, dropping the mockClear() calls. In Vitest v4, vi.restoreAllMocks() only restores spies created with vi.spyOn — it does not clear standalone vi.fn() mocks. So onSubmit and onCancel call history now leaks between tests.

No current test breaks (none assert on call counts), but it's a latent isolation issue. Fix: use vi.clearAllMocks() instead of (or alongside) vi.restoreAllMocks() in the afterEach.

@matejvasek matejvasek force-pushed the 031-refactor-page-colocation branch from 011932f to 99446d5 Compare May 29, 2026 10:20
Restructure src/ into pages/ and common/ directories.
Page-specific components (CreateFunctionForm, FileTreeView,
FunctionTable, EmptyState) move next to their page. Shared
code (services, context, utils, UserAvatar) moves to common/.

Extract EditToolbar (with LeaveModal) from FunctionEditPage
into its own file with tests. Replace runtime import of
@patternfly/react-code-editor with import type to avoid
pulling Monaco workers into the bundle.

Update ARCHITECTURE.md, TESTING.md, and WORKFLOW.md with
co-location convention and related rules.

Also add yarn ci script, rework init-session startup
sequence, and clean up features.json.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matej Vašek <matejvasek@gmail.com>
Signed-off-by: Stanislav Jakuschevskij <sjakusch@redhat.com>
Signed-off-by: Matej Vašek <matejvasek@gmail.com>
@matejvasek matejvasek force-pushed the 031-refactor-page-colocation branch from 99446d5 to b586950 Compare May 29, 2026 10:29
@matejvasek matejvasek merged commit 9a8b3e5 into master May 29, 2026
1 check 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.

2 participants