Skip to content

refactor: replace magic names, extract animations, and rename vars - #187

Merged
YumeYuka merged 1 commit into
Moefrom
refactortract-animations-rename-vars
Sep 27, 2026
Merged

YumeYuka merged 1 commit into
Moefrom
refactortract-animations-rename-vars

Conversation

@YumeLira

@YumeLira YumeLira commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Refactor shared UI behavior and routing preset configuration to use typed models, centralized constants, and reusable helpers.

Enhancements:

  • Replace profile import type indices and routing preset magic constants with typed enums and centralized definitions.
  • Consolidate official MRS preset metadata, policies, URL generation, rule sources, and region definitions into reusable abstractions.
  • Extract shared navigation and proxy-sheet animation configurations and simplify related type references.
  • Improve code readability by replacing fully qualified references and clarifying state and parameter names.

@sourcery-ai

sourcery-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This refactor removes magic constants and overly qualified references by introducing type-safe profile import modes, shared animation helpers, and centralized declarative Official MRS preset metadata, while preserving the existing UI, routing, and runtime behavior.

File-Level Changes

Change Details Files
Centralize navigation and proxy-sheet animation definitions while moving shared sizing and type references to reusable APIs.
  • Extract the repeated Decompose stack animation into a shared helper and reuse it across navigation hosts.
  • Extract proxy sheet transition construction into a parameterized helper while preserving direction, duration, offset, and fade variations.
  • Replace the local proxy sheet height constant and fully qualified model types with shared/imported symbols.
app/src/presentation/navigation/AppNavContainer.kt
app/src/presentation/navigation/SecondaryDetailHost.kt
feature/proxy/src/ProxySheetContent.kt
Replace integer-based profile import modes with a type-safe enum throughout state, UI, and submission flows.
  • Introduce ProfileImportType mappings for spinner indices and persisted profile types, including explicit QR handling.
  • Propagate enum state through form content, sheet actions, validation, permission logic, and draft submission.
  • Generate selector labels from enum entries and rename type-index variables and fields.
ui/src/presentation/util/ProfileImportRules.kt
app/src/screen/profiles/ProfileAddFormState.kt
app/src/screen/profiles/ProfileAddSheet.kt
app/src/screen/profiles/ProfileAddSheetContent.kt
app/src/screen/profiles/ProfileAddSheetLayout.kt
app/src/screen/profiles/ProfileSubmission.kt
Consolidate Official MRS preset constants and declarative metadata into reusable definitions.
  • Replace magic-name constants with the OfficialMrs namespace for policies, URLs, intervals, group names, paths, and rule strings.
  • Model regions, icons, routes, services, providers, and detection rules through definition/helper factories instead of repetitive enum constructor data.
  • Represent default-enabled and deferred rule ordering with enum values and update template analysis/building to consume the typed definitions.
feature/meta/src/feature/meta/presentation/util/CustomRoutingPresetTemplate.kt
feature/meta/src/feature/meta/presentation/util/CustomRoutingPresetAnalysis.kt
feature/meta/src/feature/meta/presentation/util/CustomRoutingPresetYamlBuilder.kt
Simplify qualified references and imports across runtime service code.
  • Import log API types and shorten the CoreController subscription signature.
  • Import Proxy and CoreProcess symbols to remove fully qualified model and service references.
runtime/service/src/runtime/service/controller/CoreController.kt
runtime/service/src/runtime/service/preview/PreviewRuntimeManager.kt
runtime/service/src/runtime/service/session/SessionRuntime.kt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The refactor changes how routing presets and proxy rules are constructed, so an unnoticed mistake could persist an incorrect direct/proxy policy in generated user configurations, exposing traffic or breaking connectivity. Reverting the code would not undo configurations already generated, although regeneration can repair them.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@YumeLira
YumeLira added this pull request to stack #190 September 27, 2026 10:44
@YumeYuka
YumeYuka force-pushed the refactortract-animations-rename-vars branch from a6faac2 to c77c63b Compare September 27, 2026 12:09
@YumeYuka
YumeYuka added this pull request to the merge queue Sep 27, 2026
Merged via the queue into Moe with commit 7181c24 Sep 27, 2026
8 checks passed
@YumeYuka
YumeYuka deleted the refactortract-animations-rename-vars branch September 27, 2026 12:14
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