Skip to content

Refactoring plan#4453

Draft
hoangdat wants to merge 2 commits intomasterfrom
refactoring-plan
Draft

Refactoring plan#4453
hoangdat wants to merge 2 commits intomasterfrom
refactoring-plan

Conversation

@hoangdat
Copy link
Copy Markdown
Member

2 Options:

  • EventBus with ***EmailAction + EmailActionQueue
  • Riverpod + Service

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e645f75-26ea-414f-97f0-a6c467cba3cf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactoring-plan

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

No application code in the PR — skipped Code Health checks.

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Copy link
Copy Markdown
Collaborator

@tddang-linagora tddang-linagora left a comment

Choose a reason for hiding this comment

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

Both options are solid. Personally, I would want to replace GetX with Riverpod.

|---|---|---|
| `ArchiveEmailAction extends EmailAction` | — | new file |
| `ArchiveBusHandler extends GetxService` | — | new file |
| Register in `BusHandlerRegistry` | 1-line entry | — |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be avoided with dependency injection as well I presume

| Task | Edit | Create |
|---|---|---|
| `ArchiveEmailAction extends EmailAction` | — | new file |
| `ArchiveBusHandler extends GetxService` | — | new file |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have a more specialized interface that GetXService

That interface actually can extend it.

More specialized interfaces préserve intent, helps di, etc...


### Positive

- **OCP-compliant** for adding new email actions — zero edits to existing files beyond a 1-line registry entry.
Copy link
Copy Markdown
Member

@chibenwa chibenwa Apr 16, 2026

Choose a reason for hiding this comment

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

With Dependency Injection we should even be able to sneak this 1 line centralized registry entry and can turn it into a 1 line decentralized registry......

## Alternatives Considered

- **Keep `consumeState` + mixin** — fails OCP, controllers keep growing.
- **Migrate to Riverpod + service architecture** (see ADR 0077) — cleaner long-term boundaries but high effort and framework risk.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Stupid question: does this move makes moving in the future to riverpod easier? Or harder?


- God-controllers are hard to test — setup requires spinning up DI graphs, bindings, and mocking `Get.context`.
- Cross-controller `Get.find` creates implicit, untyped dependencies.
- Integration tests are tied to GetX lifecycle (robots use `Get.put`).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's a real problem.
If test depends on internal framework then it is not it tests.

Can we imagine writing such tests without getX?

Imo it is the most priority topic...

- **High effort** — ~77 engineer-days across 16 phases.
- **High risk** — two DI systems coexist during months of migration; partial states possible on main.
- **Routing migration is invasive** — deferred loading, 15+ routes, web/mobile parity all at once.
- **Test suite rewrite** — all widget and integration tests must move off `Get.put` / robots.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:-/

MUST happen in priority to really protect the refactoring stage.

- **Routing migration is invasive** — deferred loading, 15+ routes, web/mobile parity all at once.
- **Test suite rewrite** — all widget and integration tests must move off `Get.put` / robots.
- **Team learning curve** — Riverpod generator, code-gen workflow, `ref` lifecycle rules.
- **Feature-delivery slowdown** during routing and auth phases (2-3 week partial freeze likely).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Acceptable

@hoangdat
Copy link
Copy Markdown
Member Author

will address in mob session with team in next monday

@chibenwa chibenwa requested review from 9clg6, Crash-- and jbrnzl April 17, 2026 08:06
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.

3 participants