Skip to content

refactor: Huge pyro servers composable cleanup #3745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 11, 2025
Merged

refactor: Huge pyro servers composable cleanup #3745

merged 15 commits into from
Jun 11, 2025

Conversation

IMB11
Copy link
Member

@IMB11 IMB11 commented Jun 5, 2025

DEV-67
DEV-19

  • Uses real OOP instead of types.
  • Modules are now defined as classes, you can easily add new modules by simply extending the ServerModule abstract class. All modules have a base fetch function which should be used to populate themselves with data. See GeneralModule for a good example.
  • Moved types to modrinth utils

  • Fix lint issues
  • Fix broken enums for power endpoint.

@IMB11 IMB11 added enhancement New feature or request web Relates to Modrinth.com web frontend frontend and removed web Relates to Modrinth.com web frontend labels Jun 5, 2025
@IMB11 IMB11 marked this pull request as ready for review June 6, 2025 00:09
@IMB11 IMB11 requested a review from Copilot June 6, 2025 00:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors server components to use real OOP modules (PyroServer classes) instead of plain types and centralizes shared types in the new @modrinth/utils package.

  • Migrates all local ~/types/servers imports to @modrinth/utils
  • Replaces the old Server<…> generic type with the PyroServer class in props
  • Cleans up various imports (formatters, modules) to align with the new composable structure

Reviewed Changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ServerPlanSelector.vue Swapped formatPrice import to @modrinth/utils
LoaderIcon.vue Migrated Loaders type import to @modrinth/utils
ServerStats.vue Migrated Stats type import to @modrinth/utils
ServerSidebar.vue Replaced generic Server prop with PyroServer class
ServerListing.vue Migrated Project, Server types to @modrinth/utils and added usePyroServer
ServerInstallation.vue Swapped generic Server prop for PyroServer class and central Loaders type
SaveBanner.vue Swapped generic Server prop for PyroServer class
PlatformVersionSelectModal.vue Updated Loaders type import, added PyroServer, tightened error status access
PlatformMrpackModal.vue Added PyroServer import and replaced Server generic
PlatformChangeModpackVersionModal.vue Added PyroServer, removed optional chaining on general.reinstall
PanelServerStatus.vue Migrated ServerState type import to @modrinth/utils
FilesUploadZipUrlModal.vue Centralized handleError & PyroServer imports
FilesUploadDropdown.vue Switched FSModule import to new modules directory
BackupSettingsModal.vue Replaced generic Server prop with PyroServer class
BackupRestoreModal.vue Replaced generic Server prop with PyroServer class
BackupRenameModal.vue Replaced generic Server prop with PyroServer class and added backup type
BackupItem.vue Migrated Backup type import to @modrinth/utils
BackupDeleteModal.vue Removed unused Server prop definition
BackupCreateModal.vue Added ServerBackup type, replaced generic Server prop, tightened error status
Files not reviewed (1)
  • .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)

apps/frontend/src/components/ui/servers/PlatformChangeModpackVersionModal.vue:101

  • Removing the optional chaining on props.server.general?.reinstall may cause a runtime crash if general is undefined. Consider re-adding the ? check or ensuring general is always initialized before calling reinstall.
await props.server.general.reinstall(

@IMB11 IMB11 marked this pull request as draft June 6, 2025 00:49
@IMB11 IMB11 marked this pull request as ready for review June 6, 2025 13:53
Copy link
Member

@Prospector Prospector left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome, great!!

@Prospector Prospector enabled auto-merge June 11, 2025 21:41
@Prospector Prospector added this pull request to the merge queue Jun 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jun 11, 2025
@Prospector
Copy link
Member

looks like there's a conflict that needs resolving

@vacla
Copy link

vacla commented Jun 11, 2025

Not sure if it is intentional but there are still references to pyro in the PR.

Signed-off-by: IMB11 <hendersoncal117@gmail.com>
@IMB11 IMB11 enabled auto-merge June 11, 2025 22:20
@IMB11 IMB11 added this pull request to the merge queue Jun 11, 2025
Merged via the queue into main with commit 1b1d416 Jun 11, 2025
2 checks passed
@IMB11 IMB11 deleted the cal/dev-67 branch June 12, 2025 13:31
Prospector added a commit that referenced this pull request Jun 14, 2025
* Show up to 15 projects in chart tooltips (#3739)

* fix(frontend): remove fixed height from ManySelect (#2898)

* fix(frontend): remove fixed height from ManySelect

Frontend development is not my passion, there might be a better fix.

I've tested my changes in all places that I found using the chganed components (ManySelect, ScrollablePanel):

- Changelog filters
- Version filters
- Download dialog
- Search filters

Fixes #2334

* Revert incorrect merge

* fix merge conflict

* fix: reset reset-icon state value correctly in edit world modal (#3748)

* Fix random_projects route not returning the requested number of projects (#3758)

* Fix random_projects route not returning the requested number of projects

* fix(labrinth): further improve random project route SQL query

* chore: fix typo in comment

* tweak(labrinth): more apparent and fast randomness for `random_projects_get`

* tweak(labrinth): even better random projects query

* chore: address formatting review

---------

Co-authored-by: Alejandro González <me@alegon.dev>

* Make get_user_from_headers and check_is_moderator_from_headers take in a bitflag of Scopes rather than a slice of Scopes (#3765)

* Update a bunch of dependencies (#3766)

* Add handling for new loaders, fix max height being applied when scrolling is disabled from #2898 (#3761)

* perf(labrinth/random_projects_get): speed up through spatial queries according to profiling results (#3762)

* fix: hydration issues caused by duplicate components on servers panel (#3753)

* fix: server stats icons

* fix: fix chart jumping

* refactor: iconComponent -> icon

* fix: panel hydration issues

* fix: apply requested changes

* fix: MOD-292 repair button showing during installation (#3734)

* fix: MOD-292 repair button showing during installation

* fix: lint

* Update apps/app-frontend/src/pages/instance/Index.vue

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: IMB11 <hendersoncal117@gmail.com>

* fix: lint issues

---------

Signed-off-by: IMB11 <hendersoncal117@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat(labrinth): ignore email case differences in password recovery flow (#3771)

* feat(labrinth): ignore email case differences in password recovery flow

* chore(labrinth): run `sqlx prepare`

* Add segmentation to reports list to fix it (#3772)

* feat(frontend): Organisations are now sorted alphabetically in dashboard and on user pages (#3755)

* feat: Organisations are now sorted alphabetically in dashboard and on user pages

* Use computed ref

---------

Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>

* fix: undefined instance path by using emitted event instead when opening world folder (#3746)

* fix: undefined instance path by using emitted event instead

* fix: linting

* refactor: Huge pyro servers composable cleanup (#3745)

* refactor: start refactor of pyro servers module-based class

* refactor: finish modules

* refactor: start on type checking + matching api

* refactor: finish pyro servers composable refactor

* refactor: pyro -> modrinth

* fix: import not refactored

* fix: broken power action enums

* fix: remove pyro mentions

* fix: lint

* refactor: fix option pages

* fix: error renames

* remove empty pyro-servers.ts file

---------

Signed-off-by: IMB11 <hendersoncal117@gmail.com>
Co-authored-by: Prospector <prospectordev@gmail.com>

* frontend: Improve file too large error (#3774)

* Improve file too large error

Signed-off-by: IThundxr <me@ithundxr.dev>

* MB -> MiB

Signed-off-by: Prospector <6166773+Prospector@users.noreply.github.com>

---------

Signed-off-by: IThundxr <me@ithundxr.dev>
Signed-off-by: Prospector <6166773+Prospector@users.noreply.github.com>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>

* enh(ci): optimize Turbo CI check workflow, track Rust and Node toolchain versions in well-known files (#3776)

* enh(ci): optimize Turbo CI check workflow, track Rust and Node toolchain versions in well-known files

* fix(ci): build `sqlx-cli` with `rustls` to fix Postgres TLS failures

* fix(app): make instances with non-UTF8 text file encodings launcheable and importable (#3721)

Previous to these changes, the app always assumed that Minecraft and
other launchers always use UTF-8, which is not necessarily always true.

* fix(app): make per-instance launch hooks clearable (#3757)

* fix(app): make per-instance launch hooks clearable

* chore(apps/app-frontend): fix Prettier lints

* Update Rust and Turbo versions (#3781)

* chore: bump Rust version from 1.86 to 1.87

* chore: update Turbo

* chore(.cargo/config.toml): minor comment tweak

* Small CI flakiness fix and performance tweak (#3780)

* perf(ci): use Turbo to schedule both `lint` and `test` tasks at once

* fix(ci): wait until service containers are initialized for tests

This is achieved by adding a health check to the containers, and
instructing the CI workflow to wait until the containers are healthy.
Not doing this wait risks spurious CI failures due to DB migrations
being applied before the DB even starts.

* chore(turbo): use locally installed schema in new Turbo override file

On the latest versions of Turbo, this ensures that the used schema is
always in sync with what's available in the installed Turbo version,
which is something that has already caused confusion to me before.

* refactor: inherit Clippy lint config and Rust edition from workspace (#3782)

* refactor: inherit Clippy lint config and Rust edition from workspace

This also ensures developers running `clippy lint` locally get the same
lints as during CI, especially when the Rust toolchain version is fixed
through a `rust-toolchain.toml` file.

* chore(clippy.toml): bump MSRV to 1.87

* chore(clippy): enable and fix many stricter lints (#3783)

* chore(clippy): enable and fix many stricter lints

These ensure that the codebase uses more idiomatic, performant, and
concise language constructions.

* chore: make non-Clippy compiler warnings also deny by default

* Fix lint

* Update changelog

---------

Signed-off-by: IMB11 <hendersoncal117@gmail.com>
Signed-off-by: IThundxr <me@ithundxr.dev>
Signed-off-by: Prospector <6166773+Prospector@users.noreply.github.com>
Co-authored-by: Erb3 <49862976+Erb3@users.noreply.github.com>
Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com>
Co-authored-by: Emma Alexia <emma@modrinth.com>
Co-authored-by: Alejandro González <me@alegon.dev>
Co-authored-by: Josiah Glosson <soujournme@gmail.com>
Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Co-authored-by: IMB11 <hendersoncal117@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: worldwidepixel <58098422+worldwidepixel@users.noreply.github.com>
Co-authored-by: IThundxr <me@ithundxr.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend
Development

Successfully merging this pull request may close these issues.

3 participants