[
https://issues.apache.org/jira/browse/FINERACT-2941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Abhishek Chaudhary resolved FINERACT-2941.
------------------------------------------
Resolution: Fixed
> Forbid the legacy command API in packages migrated to fineract-command
> ----------------------------------------------------------------------
>
> Key: FINERACT-2941
> URL: https://issues.apache.org/jira/browse/FINERACT-2941
> Project: Apache Fineract
> Issue Type: Improvement
> Components: Build
> Reporter: Abhishek Chaudhary
> Assignee: Abhishek Chaudhary
> Priority: Major
> Fix For: 1.17.0
>
>
> h3. Background
> FSIP-5 is moving command processing to fineract-command. On develop, 459
> handlers still implement the legacy NewCommandSourceHandler and 50 implement
> the new CommandHandler. Nothing stops a package that has already been
> migrated from picking the legacy API back up, for example a new write
> endpoint built with CommandWrapperBuilder and a JsonCommand handler. Since
> the legacy style is what most of the code shows, it is also the pattern most
> likely to be copied.
> h3. Proposal
> Add a Checkstyle ImportControl rule. A new
> config/checkstyle/import-control.xml lists the migrated packages, and code in
> them may not import:
> * anything from org.apache.fineract.commands (NewCommandSourceHandler,
> @CommandType, CommandWrapper, CommandWrapperBuilder,
> PortfolioCommandSourceWritePlatformService, ...)
> * JsonCommand
> * FromJsonHelper
> Every other package is unaffected. The list only grows: when a feature
> finishes its migration, its package is added. It is the same ratchet idea as
> the REST Assured baseline from FINERACT-2858, in the other direction.
> Packages that already pass (12): infrastructure.businessdate,
> infrastructure.cache, infrastructure.documentmanagement,
> infrastructure.event.external, infrastructure.hooks, organisation.monetary,
> organisation.staff, portfolio.floatingrates,
> portfolio.loanproduct.productmix, portfolio.note, portfolio.paymenttype,
> template.
> Exceptions:
> * infrastructure.hooks keeps the entity and action name constants in
> CommandWrapperConstants, because hooks select events by those names.
> * CommandProcessingResult is not blocked; infrastructure.event.external maps
> it into external events.
> organisation.workingdays, portfolio.collateralmanagement,
> portfolio.interestratechart and portfolio.meeting have new-style handlers but
> still import the legacy API, so they are added once their migration is
> finished.
> h3. Verification
> * No violations on develop across all Java files.
> * Probe files confirm it flags each blocked import (including static imports)
> in a migrated package and its subpackages, and ignores unmigrated parent
> packages, unrelated packages, packages with a matching name prefix and files
> outside org.apache.fineract.
> h3. Discussion
> dev@: [Need reviews of open PRs, plus
> AI|https://lists.apache.org/thread/xcw8djv45t4sjok5pj9rt750tn20pdnb]
> The rule set and package list are FSIP-5's call, so this should get sign-off
> from the FSIP-5 owners before it merges.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)